Thursday, April 4, 2013

Linux setup default gateway with route command

Route command show and/or manipulate the IP routing table under Linux.

Display default route

# route

Add / setup a new route

The syntax is as follows:
route add default gw {IP-ADDRESS} {INTERFACE-NAME}


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 


OR use hostname such as dsl-router

# route add default gw dsl-router eth0



also you can configure ip address and mask using command line
#ifconfig eht0 x.x.x.x netmask x.x.x.x 

No comments:

Post a Comment