Thursday, January 5, 2012

Add static route to linux

add a remote host

remote host
local gateway
route add -host gw

add a remote network

route add -net netmask gw
check the route 
route -n
Delete a route
route del -net netmask gw
route add -net netmask dev eth0
adds a route to the network 192.56.76.x via "eth0". The Class C netmask modifier is not really necessary here because 192.* is a Class C IP address. The word "dev" can be omitted here.
To make the routing information persistent, add the “route add” line as seen above into the /etc/rc.local file.
Sample /etc/rc.local file.
or /etc/rc.d/rc.local

touch /var/lock/subsys/local
route add -net netmask gw



No comments:

Post a Comment