Home arrow Debian arrow Add a static route in Debian Linux
Add a static route in Debian Linux  
Digg Reddit Ma.gnolia Stumble Upon Facebook Twitter Google Yahoo! MyWeb Furl" BlinkList Technorati Mixx Bookmark
To add a static route you can use route command:

route add -net 192.168.0.1/24 netmask 255.255.255.0 gw 192.168.10.1  dev eth1

Also You can use ip command. In that case you must have installed iproute package.

apt-get install iproute

ip route show

ip route add 192.168.1.0/24 via 192.168.10.1 dev eth1


Put th following line in /etc/network/interfaces if you want to make change permanent after reboot:

up route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.10.1
to delete route:
down route del -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.10.1


To setup network using  settings from /etc/network/interfaces file without reboot:
/etc/init.d networking restart

 
< Prev   Next >

Misc

Linux Tips

Polls

What is your favorite Linux Distribution ?