Setting Routes

From INIwiki
Jump to: navigation, search

These methods of changing the route table don't last across reboots. Listed below are methods to make any of these changes permanent.

[edit] Linux

Checking the route table

netstat -rn
route

Adding and Removing a Network in Linux

route add -net 10.10.10.0/24 gw 192.168.0.1
 
route del -net 10.10.10.0/24 gw 192.168.0.1


Adding and Removing a specific route

route add -host 10.10.10.45 gw 192.168.0.1

route del -host 10.10.10.45 gw 192.168.0.1

Adding a default gateway

route add default gw 192.168.0.1

Remove default default Gateway

route del default gw 192.168.0.1

Note: The old gateway will still remain and may need to be taken out for the system to function properly.

Routes are made permanent in Red Hat Linux by adding routes to /etc/sysconfig/static-routes Checking the route table in Windows


[edit] Windows Routes

Show route table

route print

Adding and Removing a network

route add 10.10.10.0 mask 255.255.255.0 192.168.0.1
route delete 10.10.10.0 mask 255.255.255.0 192.168.0.1

Adding and Removing a specific host

route add 10.10.10.45 192.168.0.1
route delete 10.10.10.45 192.168.0.1

Adding a Default GW in Windows NT

route add 0.0.0.0 mask 255.255.255.255 192.168.0.1
or
route add 0.0.0.0 192.168.0.1
or
route -p add 0.0.0.0 192.168.0.1
route delete 0.0.0.0
or
route delete 0.0.0.0 mask 255.255.255.255
or
route delete 0.0.0.0 mask 255.255.255.255 192.168.0.1

Routes are made permanent in Windows NT by using "-p" with the route add command. Here is an example:

route -p add 10.10.10.45 192.168.0.1


[edit] Source:

http://www.cpqlinux.com/routes.html
Personal tools