Setting Up Your Routes

When your interface has been configured, you usually need to configure at least a default route to talk to machines external to your network.

By default, when you configure a network address for an interface, the kernel routing table contains an entry for that interface. The reason for this entry is that even though you may not be communicating to machines on another network, the kernel still needs to know where to send traffic for machines on your local network.

Let's consider the address 192.168.0.1/24 as an example: If you want to communicate with another machine on your network with an IP address of 192.168.0.233, the kernel needs to know that traffic for the 192.168.0.0/24 network needs to be sent through the eth0 device. This ensures that the machine 192.168.0.233 can physically (through Ethernet and IP) listen for traffic that has been sent to it over the same media as the sending host's Ethernet adaptor.

The route command is used to manipulate the routing table of the Linux kernel. The most common entry is the default interface/network route we just talked about. The other very important route for external communication is the default route. The default route is used as a catchall for all IP traffic that your machine cannot reach based on its routing table.

On the machine with address 192.168.0.1, if you look at your default routing table, you can see you are able to access the 192.168.0.0/24 network (see Listing 15-2).

Was this article helpful?

0 0

Post a comment