Routing Essentials

4

I'm a programmer trying to fill a big hole in my understanding of networking basics. I've been reading a good book (Networking Bible by Sosinki) but I have been finding that there is a lot of "assumed" information contained, where terms/concepts are thrown at the reader without a proper introduction to them.

I understand that a "route" is a path through a network. But I am struggling with visualizing some routing-based concepts. Namely:

  1. How do routes actually manifest themselves in the hardware? Are they just a list of IP addresses that get computed at the network layer, and then executed by the transport?
  2. What kind of data exists in a so-caleld routing table? Is a routing-table just the mechanism for holding these lists of IP address (read above)?
  3. What are the performance pros/cons for having a static route, as opposed to a dynamic route?

pnongrata

Posted 2011-10-03T19:13:13.523

Reputation: 2 212

I like the fact that you bought a book and just started reading. No intimidation to stop you. – surfasb – 2011-10-04T02:13:02.277

Answers

5

A route isn't defined by any one piece of hardware. A router's job is to look at the IP and decide if the packet belongs on it's network, or another, and send it along its way depending on what it decides. A router is really only concerned with the next step and nothing past, no single device routes the entire path of a packet.

A routing table contains the information a router needs to know to decide whether a packet belongs on it's own network or not and the next hop to send it to if it needs to go elsewhere. From wikipedia:

The routing table consists of at least three information fields:

 -the network id: i.e. the destination network id
 -cost: i.e. the cost or metric of the path through which the packet is to be sent
 -next hop: The next hop, or gateway, is the address of the next station to which the packet is to be sent on the way to its final destination

 Depending on the application and implementation, it can also contain
 additional values that refine path selection:

 -quality of service associated with the route. For example, the U flag indicates that an IP route is up.
 -links to filtering criteria/access lists associated with the route
 -interface: such as eth0 for the first Ethernet card, eth1 for the second Ethernet card, etc.

Choosing a static route or dynamic route wholly depends on the application. Static routing is not very fault-tolerant, but may be easier to troubleshoot certain network issues as your route will never change.

MaQleod

Posted 2011-10-03T19:13:13.523

Reputation: 12 560

Thanks @MaQleod! So I assume that routing tables are located on every router, and that no network of connected routers share the same table, yes? Also, do routing tables contain information on whether or not a particular route is static or dynamic? If not, where is this information stored? – pnongrata – 2011-10-03T19:51:40.793

Exactly, a routing table is specific to the router and the network it routes. Static and dynamic routes are also in the router, but they will be defined in the local/running config, not the routing table. – MaQleod – 2011-10-03T20:01:24.193

2

A "route"(when used as a noun), in networking terminology, refers to list of the possible next hops (IP addresses of intermediate routers(layer 3 devices)) which can be taken to reach a particular destination(identified by an IP address). As a verb, "route" is same as "send".

Suppose, you want to send IP packets from host1 to host2: host1[20.0.0.1]====router1[1.1.1.1]====router2[2.2.2.2]====router3[3.3.3.3]====host2[40.0.0.1]

So, your "route" or path to host2 from host 1 is: 1.1.1.1>2.2.2.2>3.3.3.3

Note:

  1. From a given source, there can be several "routes" to a destination. This happens because each router decides where to send the packet next(ie, it decides who will be the next hop router). And these next hops form the "route" to the destination.
  2. In Routing Table, a "route" refers to the network. A Routing table basically contains "networks" and the "next hop addresses" for those networks. It also contains other info like cost(used generally when multiple next hops are available for a given network).

Answer to Q1: Routes are "written" in the packet forwarding engines(ASICs) of routing devices. It is stored in the form of bits and when a packets comes for routing, the following things happen: a Basic checks of the different checksums and Ethertype are done. b If the DMAC(destination MAC) in the received frame matches the MAC address of the port on which it was received, then the packet is considered for routing. c The forwarding table(it is same as Routing table with only one "next hop" for each "network") is used to decide where to send the packet next. The DIP(destination IP) in the incoming packet is used to perform bit wise AND operation on the "network" entry present in the forwarding table. [For more details, see Answer to Q2]

Answer to Q2: A sample Routing table is shown below:

IPv4 Route Table

Active Routes:

Network Destination        Netmask          Gateway      Metric

       20.0.0.0      255.255.255.0         30.0.0.1      25

This implies that all packets which have their DIP(destination IP) in the network 20.0.0.0/24, will be forwarded(routed) to the router 30.0.0.1.

Suppose an incoming packet arrives with DIP: 20.0.0.2. To "route" this packet, Destination Network is detected:

20.0.0.2 AND Netmask for the first Routing table entry(ie, 255.255.255.0)

0001 0100.0000 0000.0000 0000.0000 0010 AND 1111 1111.1111 1111.1111 1111.0000 0000 = 0001 0100.0000 0000.0000 0000.0000 0000 ie, 20.0.0.0 [This matches the "network" entry in the Routing table and the packet is sent to router with address 30.0.0.1

Answer to Q3: Static routes are used when you explicitly want a particular next hop to be taken instead of leaving it to the configured routing protocol(like, ospf). Moreover, scaling of the network with static routing is difficult as more effort is required. Also, as MaQleod said, it is not fault tolerant.

gsinha

Posted 2011-10-03T19:13:13.523

Reputation: 248