Configuring routing table running on Linux Machine
How do I examine the routing table on a machine?
Once the network interfaces have been configured, the next part of TCP/IP configuration is configuring routing.
TCP/IP routing may be handled in two ways: static routing or dynamic routing. In static routing, routing information is programmed into the machine at boot time.
In dynamic routing, a program (a route daemon) communicates with other routing daemons to continually update the system's routing information in
response to changing network conditions.
Configure Static Routing
In this course, we will discuss how to configure static routing only, in the simplest case of a machine with only one network interface, on a local network with only one gateway.
Routing is controlled by a table called the routing table, which is maintained by the kernel. To view the routing table, using the route command:
View the routing table, using the route command.
If you are on a laptop or PC, place your mouse over the IP address table below to see information displayed regarding the table.
How does one monitor traffic for network addresses?
On Solaris, use the command netstat -nr to dump the routing table. The output is nearly identical to the output of the route command used on Linux.
The routing table gives a list of potential destinations, and for each destination, the IP address of a gateway.
Information intended for one of the listed destinations is sent to the specified gateway.
We are assuming that this machine is on a local network with only one gateway (this is a typical situation), so any traffic not for the local network should be directed to that gateway.
The only entry in the routing table that needs to be set is the default route, because the local route is set automatically by the ifconfig command. To set the default route, use:
host# /sbin/route add default gw [address]
The route command may also be used to delete a route: