Monday, June 25, 2007

Add, Change, Delete, Monitor, and Flush the Routing Table

Awhile ago, I posted a post regarding adding a route, but it only covered a static route. Why? For that particular day's post, I was dealing with a static route issue.

Here's a quick and dirty guide to adding (nets, default route), deleting, changing, flushing, and monitoring the routing table.

Add a route to the routing table
# route add net 192.168.X.0 esofthub 1
add net 192.168.X.0: gateway esofthub

Change destination in the routing table
# route change net 192.168.X.0 router-1
change net 192.168.X.0: gateway router-1

Add default route
# route add default esofthub 1
add net default: gateway esofthub

Delete route from the routing table
# route delete net 192.168.X.0 esofthub
delete net 192.168.X.0: gateway esofthub

Determine which interface will be used to contact the URL/hostname
# route get esofthub.com
route to: xxxxx0.xxx.mud.yahoo.com
destination: default
mask: default
gateway: router-1
interface: hme0
flags:
recvpipe sendpipe ssthresh rtt,ms rttvar,ms hopcount mtu expire
0 0 0 0 0 0 1500 0

Monitor routing requests
# route monitor

Remove all entries from the routing table
# route flush

No comments: