Sunday, July 20, 2014

Add and Change default gateway / route in Linux

Routing information is very important in network for the connectivity. This defines path to next network.Mostly we are using this for getting internet connection.


If there any network which we wants to route there should be a router. Mostly a gateway system will have capability to work as a router.Either it will contain proxy software or else it will forward the traffic to desired network.


In linux we can define the routing information with "route" command. To display current routing information following command can use.

             route -n 

For adding new route the following command will help.Here assumes 192.168.0.0 is the network and 192.168.0.254 is the gateway system.

            route add default gw 192.168.0.254
                          or
            ip route add default via 192.168.0.254

Here is the command for  changing default route.

        ip route change default via 192.168.0.1  
            

1 comment:

  1. Very good site for Linux and Unix programmers and system admins.

    ReplyDelete

Which operating system you like most?