Defining the Default Route

Thus far, all of the routes from the sample routing table have been discussed, except for the default route. The sample table contains a default route that specifies as the default router:

Enter the following command to define that route:

route add default gw

This command looks similar to the previous route command, except that the keyword default is used in place of the destination network. It is the presence of this keyword that defines the default route.

Most Linux systems connected to a TCP/IP internet have a static default route. Because it is so common, it is unlikely that you need to enter a route command to define it. All Linux installations that I have worked with ask you for the address of the default router during the initial installation. Provide it at that time. The system stores the value and then uses it to define the default route during the boot. For example, Red Hat stores the default gateway address in the /etc/sysconfig/ network file.

For most Linux servers, all you need to do is define the default route because most servers are hosts that depend on a single external router for routing service. On occasion, however, a Linux server may be used as the router for a small network. When it is, you may need to run a routing protocol, as discussed next.

Was this article helpful?

0 0

Post a comment