$ /sbin/route -n

Output:

Kernel IP routing table
Destination           Gateway              Genmask                 Flags       Metric        Ref       Use         Iface
191.255.255.0     0.0.0.0                  255.255.255.0       U             0                0           0            eth0
169.254.0.0         0.0.0.0                  255.255.0.0           U             0                0           0            eth0
0.0.0.0                 191.255.255.1     0.0.0.0                    UG           0                0           0            eth0

Please note that a destination entry 0.0.0.0 (or default) is the default gateway.
In above example 191.255.255.1 is a default gateway.

Add / setup a new route

The syntax is as follows:

route add default gw {IP-ADDRESS} {INTERFACE-NAME}

Where,

IP-ADDRESS: Specify router IP address
INTERFACE-NAME: Specify interface name such as eth0

For example if your router IP address is 192.168.1.254 type the following command as the root user:

# route add default gw 192.168.1.254 eth0

If you have an older router ip address, please delete this line with following example command.

route delete -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.1.1

Loading

Leave a reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.