Configuring a Default Gateway

In the previous section, you saw how to manually configure an Ethernet network interface with a particular address and mask. You can connect to networks outside your subnet by adding a default gateway to your kernel's IP routing table with this command:

route add default gw gw-address

The gw-address parameter is the IP address of your default gateway; it must be an address in a locally connected subnet defined by the address and mask settings of your network interface (as described in the previous section). If you have a static IP address, a default route setting usually goes along with an ifconfig command in your boot sequence. For other kinds of connections, other programs usually set the default route.

To view the ...

Get How Linux Works now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.