Network Computing   «Prev 

Static Routes and the Default Gateway

Static routes are for traffic that must not, or should not, go through the default gateway. Routing is often handled by devices on the network dedicated to routing (although any device can be configured to perform routing). Therefore, it is often not necessary to configure static routes on Red Hat Enterprise Linux servers or clients.
Exceptions include traffic that must pass through an encrypted VPN tunnel or traffic that should take a specific route for reasons of cost or security. The default gateway is for any and all traffic which is not destined for the local network and for which no preferred route is specified in the routing table. The default gateway is traditionally a dedicated network router.

Configuring Static Routes Using the Command Line

If static routes are required, they can be added to the routing table by means of the ip route add command and removed using the ip route del command. The more frequently used ip route commands take the following form:

ip route [ add | del | change | append | replace ] destination-address

Redhat Linux Route Display Command

route add default gw 195.77.4.1 dev eth0

  1. add tells route what action to take
  2. default tells route to send all packets with unknown destinations to this interface
  3. gw means that you are going through a gateway and is followed by its IP address
  4. The last part of the line says that the gateway is on the same subnet as the device, eth0