TCP/IP Routing


Introduction.  We discussed routers in general in an earlier section.  We also focused on the TCP/IP protocol suite and how it operates on a LAN.  We also talked about some particular implementations in network protocols.  Now we will focus more on how TCP/IP actually operates on the Internet or global WAN in fairly broad terms.  I will also have a couple extra web pages over and above what Littlejohn Shinder covers.

We talked previously about the advantages of subnetting, particularly due to reducing broadcast traffic.  IP forwarding is a phrase that describes how messages addressed to devices on separate subnets reach their destination.  The following steps broadly outline what happens.

  • IP looks at the packet's source and destination IP addresses.
  • It determines whether they are in the same subnet by doing an logical ANDing calculation.
    • this determines whether the destination computer is on the same subnet
  • Depending on whether it is on the same subnet
    • it forwards it directly to the destination computer if it is on the same subnet
    • it forwards it to the default gateway if the destination computer is on a different subnet
  • If the destination computer is on a different subnet the packet might travel through many different routers to reach its destination.

Again, a router must have an interface on more than one network.  These networks can be LANs or WANs.  A WAN interface can be a modem, an ISDN adapter or maybe even another WAN device.

Routers make use of routing tables to keep track of the IP addresses of other networks, including other routers and servers.  Static routing requires the sys admin to manually enter the IP addresses for desired network addresses into the routing table.  This can be done with the route command that comes with TCP/IP.  This command line utility allows the sys admin to both add and delete routing table entries.  You can also print out the routing table using a variant of this command.

Static routing gives a lot more control over the routes that can be used.  But it also requires a huge amount of continually ongoing effort to maintain the table.  In larger networks, this can easily become unmanageable.

Dynamic routing uses protocols to build and change routing tables automatically.  These protocols allow routers to interact and exchange their routing table information.  This offers several advantages including the following.

  • less administrative overhead
  • more fault tolerance
    • if a link or router goes down others are informed and packets can take different routes as required
  • decreases chances for entries errors in routing tables

Dynamic routing almost always proves to be better for all but the smallest networks.

Routing Protocols.  Almost all routing protocols can be lumped into one of two categories.

  • Distance Vector
    • routes are selected primarily based on some sort of distance measure
      • number of hops
      • amount of time
  • Link State
    • routes depend on the state of the links
      • maintain information on the status of links

When using dynamic routing protocols, problems can arise such as the following.

  • databases of routes and information can grow very large
  • due to the nature of how router information is sometimes shared, without added measures routing loops can arise

Cisco's most common protocols are the following.

  • RIP - Routing Information Protocol
  • OSPF - Open Shortest Path First

RIP - Routing Information Protocol is a distance vector protocol with specifications given in RFC 1058.  RIP routers announce their routing table information to other routers at periodic intervals.  RIP version 1 uses broadcast messages.  RIP version 2 adds the capability for multicast messages.

One of the potential difficulties in these approaches is described in the following sequence of steps.

  1. Router B receives information that Router C is down and sends that information to Router A.
  2. Router A updates its routing table to show that Router C is unavailable.
  3. Router B receives information from Router C that it is back up, but before it can send its update to Router A, Router A sends its information back to Router B that Router C is down.
  4. Router B updates its information about Router C based on the information it just received from Router A, so it countermands the actual information and enters Router C is unavailable in its routing table.

This sort of looping can arise unless certain countermeasures are put into effect so that router tables can converge to correct information.  To do this Cisco adds in three methods to process routing information from other sources.

  • Split Horizon
    • helps insure that when a router receives update information it doesn't send the same information back to the same router it received it from
  • Poison Reverse
    • Since RIP has a maximum hop distance of 15, routers that send information to a router are given a distance of 16.
  • Triggered Updates
    • Updates are sent based on particular trigger events.  Thus some information is sent on immediately.  There are no delays in relaying certain types of  information which can cause looping.

RIP works well for small or medium sized networks, but something more sophisticated has turned out to be necessary for larger networks.  OSPF - Open Shortest Path First standards can be found in RFC 1247 and RFC 1583.  The algorithm used to determine routes is not prone to the looping problems of RIP and is more efficient even though larger databases of information arise.

OSPF works by dividing the network into areas.  This provides a hierarchical structure to OSPF routing tables.  Each OSPF router belongs to an area and maintains a database only on the gateways in its area.  A special router called an ABR - Area Border Router connects every area to a special backbone area.  Whenever a packet needs to travel from one area to another it goes through this backbone area.  This sort of hierarchy reduces the size of routing tables and reduces the time spent recalculating routes when changes are made.