When a computer needs to transmit information, it must determine the appropriate route. Usually, you send everything to the gateway to contact sites outside of your subnet, but some computers need more extensive routing information; for instance, if your gateway must route information between your subnet and other subnets, you need more detailed routing information.
Setting your Default Gateway
In practice, when you configure a network connection to an existing network, you use the route command to set the default gateway. For example, if your IP address was 220.127.116.11 and your subnet's gateway was set at 18.104.22.168, you might use route to set your interface's default route to point to the gateway; the MouseOver below explains each part of the route command line.
Question: How do I setup default gateway with a route command? Answer. route command show and/or manipulate the IP routing table under Linux and UNIX oses.
Route manipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig program. When the add or del options are used, route modifies the routing tables. Without these options, route displays the current contents of the routing tables.
Display default route
Following three-command display the current routing table:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 ra0
default dsl-router 0.0.0.0 UG 0 0 0 ra0
Check default route
Check that the default route is set using the route −n command.
This shows that the gateway was set to the remote PPP server (22.214.171.124), as well as showing the other interfaces running on a computer.
There are two ppp0 entries. The first shows the destination as a host (UH). The second shows the destination as a gateway (UG).
All addresses that cannot be resolved on the local LAN are directed to the gateway address.
Check that the name servers are set
If you are able to ping a remote computer by IP address, but are not able to resolve any addresses, your DNS
servers may not be set correctly. As root user from a Terminal window, open the /etc/resolv.conf file and
check that there are lines identifying one or more DNS servers in this file. These should be supplied to you by
your ISP. Here are some examples (the numbers are fictitious):
The next lesson shows you how to configure a modem to create a new PPP connection
Red Hat Reference