Routing by Routing Table

Purpose:  Keep routing decisions quick and easily computed using only minimal information at each router and host.

How it works:  Each computer on the net keeps a routing table.  This routing table tells, for each network, where to deliver the packets.  For every directly attached network, the table just says "send to the addressee".  For other networks, the table says "deliver to the gateway named XXX".  Finally, there is almost always a default entry.  In the common case, the default entry will match all non-local (not at this university or company) addresses, and point to the gateway to the rest of the internet.

The Algorithm:

  1. Compute the network portion of the destination address, N.
  2. If N matches a directly connected address, deliver the packet to the destination host via the interface to N.
  3. If the table contains a host entry for this address, send it to the destination listed for this entry.
  4. If the table contains a network entry for N, deliver to the host listed for this entry
  5. If the table contains a default route, deliver to the host listed for this entry
  6. Declare a routing failure.
Example Routing Table from the Book:
 
To Reach A Host
On This Network
Send to this Place
20.0.0.0 Delivery directly
30.0.0.0 Deliver directly
10.0.0.0 20.0.0.5
40.0.0.0 30.0.0.7

A Real Routing Table
 
Destination     Gateway     Genmask         Flags   MSS Window  irtt Iface
198.110.193.0   *               255.255.255.0       U      1500     0          0 eth0
127.0.0.0          *               255.0.0.0              U      3584     0          0 lo
default       198.110.193.3   0.0.0.0                UG     1500     0          0 eth0
 
irtt:  Specifies  the  initial  round trip time (irtt) for TCP Connections over this route.
              This is typically only used on AX.25 networks. The number is given in milliseconds  (1-12000).
              If ommited the RFC 1122 default of 300ms is used.
 

MSS:  specifies the TCP Maximum Segment Size in Bytes (MSS) for TCP Connections  over  this
              route. This is normally used only for fine optimisation of routing setups. The default is 536.