Dynamic Routing
Dynamic routing performs the same function as static routing except it is more robust. Static routing allows routing tables in specific routers to be set up in a static manner so network routes for packets are set. If a router on the route goes down the destination may become unreachable. Dynamic routing allows routing tables in routers to change as the possible routes change. There are several protocols used to support dynamic routing including RIP and OSPF.
Routing cost
Counting route cost is based on one of the following calculations:
- Hop count – How many routers the message must go through to reach the recipient.
- Tic count – The time to route in 1/18 seconds (ticks).
Dynamic routing protocols do not change how routing is done. They just allow for dynamic altering of routing tables.
There are two classifications of protocols:
1. IGP – Interior Gateway Protocol. The name used to describe the fact that each system on the internet can choose its own routing protocol. RIP and OSPF are interior gateway protocols.
2. EGP – Exterior Gateway Protocol. Used between routers of different systems. There are two of these, the first having the same name as this protocol description:
1. EGP – Exterior Gateway Protocol
2. BGP – Border Gateway Protocol.
The daemen “routed” uses RIP. The daemon “gated” supports IGP’s and EGP’s.
Route Discovery Methods
- Distance vector – Periodically sends route table to other routers. Works best on LANs, not WANs.
- Link-state – Routing tables are broadcast at startup and then only when they change. OSPF uses link-state.
Routing Information Protocol (RIP)
The RIP RFC is 1058.
The routing daemon daemon adds a routing policy to the system. If there are multiple routes to a destination, it chooses the best one. The RIP message can con contain information on up to 25 routes.
The RIP message contains the following components:
1. Command
2. Version – Normally 1 but set to 2 for RIP version 2.
3. family – Set to 2 for IP addresses.
4. IP address – 32 bit IP address
5. Metrics – Indicate the number of hops to a given network, the hop count.
RIP sends periodically broadcasts its routing table to neighboring routers. The RIP message format contains the following commands:
- 1 – request
- 2 – reply
- 3 & 4 – obsolete
- 5 – poll entry
- 6 – Asks for system to send all or part of routing table
When the daemon “routed” starts, it sends a request out all its interfaces for other router’s routing tables. The request is broadcast if the network supports it. For TCP/IP the address family in the message is normally 2, but the initial request has address family set to 0 with the metric set to 16.
Regular routing updates are sent every 30 seconds with all or part of the route table. As each router sends routing tables (advertises routes to networks its NICs interface to) routes are determined to each network.
Drawbacks of RIP:
- RIP has no knowledge of subnet addressing
- It takes a long time to stabilize after a router or link failure.
- Uses more broadcasting than OSPF requiring more network bandwidth.
RIP Version 2
Defined by RFC 1388. It passes further information in some of the fields that are set to 0 for the RIP protocol. These additional fields include a 32 bit subnet mask and a next hop IP address, a routing domain, and route tag. The routing domain is an identifier of the daemon the packet belongs to. The route tags supports EGPs.
Open Shortest Path First (OSPF)
OSPF (RFC 1257) is a link state protocol rather than a distance vector protocol. It tests the status of its link to each of its neighbors and sends the acquired information to them. It stabilizes after a route or link failure faster than a distance vector protocol based system. OSPF uses IP directly, not relying on TCP or UDP. OSPF can:
- Have routes based on IP type of service (part of IP header message) such as FTP or Telnet.
- Support subnets.
- Assign cost to each interface based on reliability, round trip time, etc.
- Distribute traffic evenly over equal cost routes.
- Uses multicasting.
Costs for specific hops can be set by administrators. Adjacent routers swap information instead of broadcasting to all routers.
Border Gateway Protocol (BGP)
Described by RFC 1267, 1268, and 1497. It uses TCP as a transport protocol. When two systems are using BGP, they establish a TCP connection, then send each other their BGP routing tables. BGP uses distance vectoring. It detects failures by sending periodic keep alive messages to its neighbors every 30 seconds. It exchanges information about reachable networks with other BGP systems including the full path of systems that are between them.