- How Can I Read the Route Table?
- How Can I Modify the Route Table?
- How Can I Modify the Route Table to Block Traffic to an Internet Site?
- Recommendations, Caveats, and Other Notes
How Can I Modify the Route Table to Block Traffic to an Internet Site?
First, you need to find the IP address information for that site. In most TCP/IPenabled machines, you can go to a command prompt and type ping -a http://www.blockme.com, where http://www.blockme.com is the site for which you want to learn the IP address structure. That will reveal the IP address reflected by your DNS server.
From a command prompt, use the route add command to modify your route table. The syntax should look like this:
C:\>route -p add 192.168.6.0 mask 255.255.255.0 192.168.100.97
Table 2 gives an explanation of this command.
Table 2 route add Command Explanation
route |
Invokes the command |
-p |
Makes the route persistent across reboots |
add |
Adds the route to the table |
192.168.6.0 |
Points to an entire subnet that you want to block. Notice the 0 in the final octet. That affects every address with the first three octets matching exactly. |
mask |
Indicates that the netmask argument will follow. |
255.255.255.0 |
The netmask argument indicating how closely you need to match the network address to use this route. Notice again the significance of the 0 in the final octet. |
192.168.100.97 |
Indicates the gateway to use to route your packets. |
The "trick" is really in the final argument, the gateway. The gateway must be on the same subnet as the workstation.
The workstation is on the 192.168.100.0 subnet. However, the host 192.168.100.97 does not exist. Therefore, every packet addressed to 192.168.6.0 is routed to 192.168.100.97, a bogus machine.
If you're the network administrator for a small LAN with nonglobally routable IP addresses behind a firewall gateway, such as the Internet Sharing Connection Wizard in Windows 2000, make the changes on the gateway machine following the same instructions.
route delete
The most common use for route delete ought to be to delete your own modifications to the route table. The correct syntax for route delete is as follows:
C:>route delete 192.168.6.0
You would do this if you wanted to undo the changes you made in the example above.
route change
The route change command can be used very similarly to the route add command for an existing route. Using route change is effectively the same as deleting and adding a route with different parameters.