In an Internet Protocol network, routing is the process of deciding which node a packet should next be sent to en route to its ultimate destination. The main input to the routing decision is the destination IP address; outputs are the IP address of the next hop and the interface to which it is connected. All hosts need the ability to perform routing in order to forward locally-generated traffic, even if they do not forward traffic on behalf of other hosts.

Routes are normally chosen by consulting a routing table, each entry of which specifies the next hop for destinations that begin with a given prefix. If more than one entry matches a given destination then the one with the longest prefix is chosen. It is common practice to include a routing table entry with a prefix length of zero. This is called the default route and matches any destination address, but only in the absence of a more specific routing table entry.

The routing table can be managed either statically (with routes set explicitly by the administrator) or dynamically (using a routing protocol such as OSFP to communicate with other routers). On most GNU/Linux distributions, static routes are managed using either the route command (the traditional method) or the ip route command (part of iproute2, which provides additional features such as policy-based routing using multiple tables). Dynamic routing is implemented by packages such as Quagga (a fork of Zebra) or Bird.


Troubleshooting guides

Further reading