Friday, December 7, 2007

Checking the route table in Linux

Mirrored from: http://www.cpqlinux.com/routes.html

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 host in Linux

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 GW in Linux

route add default gw 192.168.0.1
route del default gw 192.168.0.1

Note: The old gw 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 NT

route print

Adding and Removing a network in Windows NT

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 in Windows NT

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

prev next index

0 comments:

Post a Comment