Defining Static Routes

Static routes are defined on every Linux system that connects to a TCP/IP network. A minimal routing table has a route for the loopback address and a route for the network interface. Every Linux system on a TCP/IP network has at least these two static routes. These two routes from the sample routing table shown in Listing 7.3 are

172.16.55.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo

Under Linux kernel 2.4, these routes are created by the ifconfig commands that configure the network interfaces. Systems that use older kernels create these routes with specific route commands. For example:

route add -net 172.16.55.0 netmask 255.255.255.0 dev eth0

route add -net 127.0.0.0 netmask 255.0.0.0 dev lo0

Even on old systems, you do not need to enter these commands yourself. They are stored in one of the startup scripts that come with those systems.

Was this article helpful?

0 0

Post a comment