Chapter 8. Advanced Networking with Kernel 2.2

Table of Contents
8.1. The Basics
8.2. Adding a route with the new ip tools
8.3. Using NAT with Kernel 2.2

Kernel 2.2 has advanced the routing capabilities of Linux quite a bit. Unfortunately the documentation for using these new capabilities is almost impossible to find, even if it does exist.

I have put some time into it and have been able to do a little with it. I will add more as I have time and help to figure out what it all means.

In kernel 2.0 and below Linux used the standard route command to place routes in a single routing table. If you were to type netstat -rn at the Linux prompt you could see and example.

In the newer kernels (2.1 and above) you have another option. This option is rule based and allows you to have multiple routing tables. The new rules allow a great deal of flexibility in deciding how a packet is handled. You can choose between routes based not only on the destination address, but the source address, TOS, or incoming device.

8.1. The Basics

Listing the Routing Table:

ip route

Now on my machine this equates to the following output:

207.149.43.62 dev eth0  scope link
207.149.43.0/24 dev eth0  proto kernel  scope link  src 207.149.43.62
default via 207.149.43.1 dev eth0

The first line:

207.149.43.62 dev eth0 scope link is the route for the interface

The second line:

207.149.43.0/24 dev eth0 proto kernel scope link src 207.149.43.62 Is the route that says everything that goes to 207.149.43.0 needs to go out 207.149.43.62.

The third line:

default via 207.149.43.1 dev eth0 is the default route.

8.1.1. Using the information

Now that we have walked through a basic routing table. Lets see how we use it. First read the Policy routing text. If you get confused, don't worry -- it is a confusing text. It will give you the run down on everything that the new routing code can do.