Chapter 4. IP Routing

Table of Contents

4.1. Introduction to Linux Routing
4.2. Routing to Locally Connected Networks
4.3. Sending Packets Through a Gateway
4.4. Operating as a Router
4.5. Route Selection
4.5.1. The Common Case
4.5.2. The Whole Story
4.5.3. Summary
4.6. Source Address Selection
4.7. Routing Cache
4.8. Routing Tables
4.8.1. Routing Table Entries (Routes)
4.8.2. The Local Routing Table
4.8.3. The Main Routing Table
4.9. Routing Policy Database (RPDB)
4.10. ICMP and Routing
4.10.1. MTU, MSS, and ICMP
4.10.2. ICMP Redirects and Routing

Routing is fundamental to the design of the Internet Protocol. IP routing has been cleverly designed to minimize the complexity for leaf nodes and networks. Linux can be used as a leaf node, such as a workstation, where setting the IP address, netmask and default gateway suffices for all routing needs. Alternatively, the same routing subsystem can be used in the core of a network connecting multiple public and private networks.

This chapter will begin with the basics of IP routing with linux, routing to locally connected destinations, routing to destinations through the default gateway, and using linux as a router. Subsequent topics will include the kernel's route selection algorithm, the routing cache, routing tables, the routing policy database, and issues with ICMP and routing.

The precinct of this documentation is primarily static routing. Though dynamic routing is important to large networks, Internet service providers, and backbone providers, this documentation is targetted for smaller networks, particularly networks which use static routing. Nonetheless, the concepts governing the manipulation of a packet in the kernel, and how routing decisions are made by the kernel are applicable to dynamic routing environments.

The linux routing subsystem has been designed with large scale networks in mind, without forgetting the need for easy configurability for leaf nodes, such as workstations and servers.