Nuff

Thursday, May 20, 2010

Display default route


Display default route

Following three-command display the current routing table:
# route
Destination Gateway Genmask Flags Metric Ref Use Iface60.49.199.72 * 255.255.255.248 U 0 0 0 eth0172.16.163.0 172.16.160.1 255.255.255.0 UG 0 0 0 eth1172.16.162.0 172.16.160.1 255.255.255.0 UG 0 0 0 eth1172.16.161.0 172.16.160.1 255.255.255.0 UG 0 0 0 eth1172.16.160.0 * 255.255.255.0 U 0 0 0 eth1172.16.167.0 172.16.160.1 255.255.255.0 UG 0 0 0 eth1172.16.165.0 172.16.160.1 255.255.255.0 UG 0 0 0 eth1172.16.164.0 172.16.160.1 255.255.255.0 UG 0 0 0 eth1172.16.170.0 172.16.160.1 255.255.255.0 UG 0 0 0 eth1172.16.169.0 172.16.160.1 255.255.255.0 UG 0 0 0 eth1172.16.168.0 172.16.160.1 255.255.255.0 UG 0 0 0 eth1link-local * 255.255.0.0 U 0 0 0 eth1default home.gateway 0.0.0.0 UG 0 0 0 eth0

1. Display or view routing table.
2. Add or change default route.
3. Add static route.
4. Add permanent (persistent) static routing.

route add default gw 10.10.0.1 eth0

Windows Routing Command

Displays and modifies the entries in the local IP routing table

Syntax

route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]

Examples

To display the entire contents of the IP routing table, type:

route print

To display the routes in the IP routing table that begin with 10., type:

route print 10.*

To add a default route with the default gateway address of 192.168.12.1, type:

route add 0.0.0.0 mask 0.0.0.0 192.168.12.1

To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0 and the next hop address of 10.27.0.1, type:

route add 10.41.0.0 mask 255.255.0.0 10.27.0.1

To add a persistent route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0 and the next hop address of 10.27.0.1, type:

route -p add 10.41.0.0 mask 255.255.0.0 10.27.0.1

To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, the next hop address of 10.27.0.1, and the cost metric of 7, type:

route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7

To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, the next hop address of 10.27.0.1, and using the interface index 0x3, type:

route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 if 0x3

To delete the route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, type:

route delete 10.41.0.0 mask 255.255.0.0

To delete all routes in the IP routing table that begin with 10., type:

route delete 10.*

To change the next hop address of the route with the destination of 10.41.0.0 and the subnet mask of 255.255.0.0 from 10.27.0.1 to 10.27.0.25, type:

route change 10.41.0.0 mask 255.255.0.0 10.27.0.25