The Routing table dictates where all packets go when they leave your system. On most environments, all packets that leave your system will be forwarded over to your router or hub, and from there out to the internet.
In some circumstances, you may have a testing network configured to duplicate another environment, or you may be configuring a more complex network topology that requires the use of additional routes. Adding routes to your machine is a useful testing tool for some of these situations.
route ADD xxx.xxx.xxx.xxx MASK xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx
route ADD “network” MASK “subnet mask” “gateway ip”
For example, if you were on the 192.168.1.0 network, and you had a gateway on 192.168.1.12 configured to access the 10.10.10.0/24 network, you would use a route add statement like this:
route ADD 10.10.10.0 MASK 255.255.255.0 192.168.1.12
Your routing table should now reflect that change, and all traffic to the 10.10.10.x range will now be sent over to the gateway machine.
The route add change will only stick across reboots if you add it with the -p flag, as in the following:
route -p ADD 10.10.10.0 MASK 255.255.255.0 192.168.1.12
Programmer by day, geek by night, The Geek, also known as Lowell Heddings, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on Google+ if you'd like.
- Published 09/13/06