IP Address Routing

Learning Route.exe


Let us note that as a result our previous configuration steps our computer now has two IP addresses as shown by the output of ipconfig.exe in the screen below. Similar information can be viewed with winipcfg.exe

0 Ethernet adapter displays our Internet IP address.
1 Ethernet adapter displays our local adapter address and it's this address we will be routing to.

MS-DOS Prompt

C:\>ipconfig

Windows 98 IP Configuration

0 Ethernet adapter :

        IP Address. . . . . . . . . : 209.204.33.177
        Subnet Mask . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . : 209.204.33.177

1 Ethernet adapter :

        IP Address. . . . . . . . . : 192.168.0.1
        Subnet Mask . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . :
C:\>

Learning how to route...

Windows has an MS-DOS executable called route.exe and it's this program that offers us the ability to block direct IP connections with our operating system by adding IP addresses to the routing table.

Like the hosts file our route file is also an ASCII text list that can be shared with others. Once a list is made we don't need to enter IP addresses by hand again. The list is portable from one computer to another and all that need be done is use the text editor's search and replace feature to insert the correct IP address. Like the hosts file, the route file we are about to create offers system wide protection and is not program particular. IP routing doesn't require the need to run concurrent software because it's part of Windows networking and operating system.

For the purpose of this demonstration we're going to block access to three of my favorite sites.

www.pyrenean.com 208.223.9.44
www.grc.com 207.71.92.193
www.pacificnet.net 207.171.0.253

We are going to create a text file and I'll show you the syntax and procedures necessary for you to create your own text files. For the purpose of this demonstration let's call this file doroute.bat. We will create it with our text editor.

Text Editor c:\fun\doroute.bat
route add 207.71.92.193 192.168.0.1
route add 208.223.9.44 192.168.0.1
route add 207.171.0.253 192.168.0.1




Now for an explanation of the above file.

  • This is an MS-DOS batch file and each command will execute consecutively from the top of the file to the bottom of the file.
  • Route is the name of the executable
  • Add is the command given to route.exe
  • The first column of IP address are the ones we want to block
  • The second column of IP addresses is your IP. If your IP address is different you need to substitute the numbers 192.168.0.1 with your actual IP address.

After you've created and saved your file you can run this batch file at the command prompt or run it by double-clicking on it.

After you've run doroute.bat you can verify that the entries were added to the routing table. To view the routing table open an MS-DOS window and type route print at the command prompt. Hit the enter key and MS-DOS will display the routing table for you. Notice in the screen below that the IP addresses we entered in our file are displayed in the routing table.

MS-DOS Prompt

C:\>route print

Active Routes:

  Network Address          Netmask  Gateway Address        Interface  Metric

        127.0.0.0        255.0.0.0        127.0.0.1        127.0.0.1       1
      192.168.0.0    255.255.255.0      192.168.0.1      192.168.0.1       1
      192.168.0.1  255.255.255.255        127.0.0.1        127.0.0.1       1
    192.168.0.155  255.255.255.255      192.168.0.1      192.168.0.1       1
    207.71.92.193  255.255.255.255      192.168.0.0      192.168.0.1       1
    207.171.0.253  255.255.255.255      192.168.0.0      192.168.0.1       1
        224.0.0.0        224.0.0.0      192.168.0.1      192.168.0.1       1
  255.255.255.255  255.255.255.255      192.168.0.1          0.0.0.0       1

C:\>

Now it will be impossible for our computer to establish a connection with www.pyrenean.com, www.grc.com or www.pacificnet.net.

Suppose we wish remove these entries from our routing table in order that we can access the above sites. This is as easy as it was to add the entries all we need do is create a batch file to remove the entries. See sample file below.

Text Editor c:\fun\noroute.bat
route delete 207.71.92.193
route delete 208.223.9.44
route delete 207.171.0.253




When we double-click on noroute.bat the entries will be removed from the Routing Table. Let's go to the MS-DOS prompt and see if it actually worked.

MS-DOS Prompt

C:\>route print

Active Routes:

  Network Address          Netmask  Gateway Address        Interface  Metric

        127.0.0.0        255.0.0.0        127.0.0.1        127.0.0.1       1
      192.168.0.1    255.255.255.0      192.168.0.1      192.168.0.1       1
      192.168.0.1  255.255.255.255        127.0.0.1        127.0.0.1       1
    192.168.0.255  255.255.255.255      192.168.0.1      192.168.0.1       1
        224.0.0.0        224.0.0.0      192.168.0.1      192.168.0.1       1
  255.255.255.255  255.255.255.255      192.168.0.1          0.0.0.0       1

C:\>

It worked! As  you can see by the routing table the blocks have been removed. We can now access the previously blocked sites.


proceed to the Next Chapter
or return to Table of Contents