To forward packets, a router maintains a forwarding table which holds routes indicating which neighboring router a packet for a particular destination should be forwarded to. At the minimum, a route then consists of a destination subnet and a nexthop. The destination subnet is usually represented as a base IP address and a prefix-length in bits. For example, the subnet 188.8.131.52/24 has a prefix length of 24 bits, indicating that the first 24 bits of this address identify the network in question, and the last 8 bits identify hosts on this subnet. Thus a route for this subnet would be used to forward packets for addresses 184.108.40.206 to 220.127.116.11 inclusive. The nexthop can be the IP address of a neighboring router, or it might indicate that the route is for a subnet that is directly connected to this router.
IP routers perform longest prefix match forwarding. This means that a router might have more than one route that matches a destination address, and under such circumstances, it will use the route that has the longest prefix. For example, if a router has two routes:
A packet destined for 18.104.22.168 would match the first route only, and so would be forwarded to 10.0.0.1. However a packet destined for 22.214.171.124 would match both routes, and so would be forwarded to 10.0.0.2 because the second route has a longer prefix (24 is longer than 16).
To be useful, a router needs to populate its forwarding table. It does this in three ways:
Many different routing protocols can supply dynamic routes. The dynamic routing protocols that are in most common use are:
Currently, XORP supports RIP, OSPF, OLSR and BGP. In addition, there are also multicast routing protocols.
A router can run multiple routing protocols simultaneously. For example, we may use RIP to distribute routes within our network, and BGP to learn external routes. In some situations this can lead to a router learning the same route from more than one routing protocol. For example, we might learn the two routes:
The longest prefix match rule doesn’t help us because the prefix lengths are the same, and the metric used for RIP is not directly comparable against the AS path length or any other attribute attached to a BGP route. How then do we decide which route to take?
A XORP router uses the concept of administrative distance to determine which route wins. This concept is the same as that used by Cisco routers. Basically each routing protocol has a configured “distance”, and if a route is heard from two protocols, then the version with the smallest distance wins. The built-in table of administrative distances XORP uses is:
Directly connected subnets: 0 Static routes: 1 BGP, heard from external peer: 20 OSPF: 110 IS-IS (when implemented): 115 RIP: 120 BGP, heard from internal peer: 200 FIB2MRIB routes (XORP-specific, in MRIB only): 254
Hence, in the example above, the route learned from BGP will be preferred.
Currently, there is no way to modify these default administrative distances. Write a bug or send a patch if you need this capability.
The administrative distances can be monitored using the operational mode command:
show route admin distance ipv4 unicast: user@hostname> show route admin distance ipv4 unicast Protocol Administrative distance connected 0 static 1 eigrp-summary 5 ebgp 20 eigrp-internal 90 igrp 100 ospf 110 is-is 115 rip 120 eigrp-external 170 ibgp 200 fib2mrib 254 unknown 255
The operational command for monitoring the IPv6 unicast administrative distances is show route admin distance ipv6 unicast. The operational commands for monitoring the multicast administrative distances are:
show route admin distance ipv4 multicast show route admin distance ipv6 multicast
A common requirement is to redistribute routes between routing protocols. Some examples might be:
XORP is capable of performing such route redistribution. This is generally configured using the import and export configuration statements. These terms are relative to the router’s routing table, so if the directive export static is added to the RIP configuration, then this indicates that RIP should export all the static routes to its neighbors via the RIP protocol.
While route redistribution is a powerful tool, it needs to be used carefully. For example, redistributing BGP routes into RIP at one router, and redistributing RIP routes into BGP at another router, would cause all the BGP routes to lose their original AS paths, and hence for much of the Internet to believe your AS is the best way to everywhere. In any event, it is rarely a good idea to distribute a large number of BGP routes into an IGP because most IGPs simply do not cope well with large routing tables.
In XORP route redistribution is implemented as part of the routing policy framework.