One of my friends was having an issue passing specific traffic on a network he was using and came to me for assistance (all web traffic was allowed, but certain ports were blocked to specific hosts). I couldn’t duplicate the problem on my home network so we went over the various options that were successful in passing the traffic as desired. Connecting via an Open Wireless network in the area allows him to bypass the issue entirely. Being that this was non-sensitive information, this could provide the path to creating a happy environment for his applications. I’m being purposefully vague here. The gist is that while connected to one network he couldn’t access non-standard port services, but while on the open wifi connection he was unable to access LAN services. He wants to be able to access both at the same time, and doesn’t want to bother the firewall administrator every time there’s a new port change he needs to make to continue using the corporate network.
We first attempted a metric change to the wireless adapter to have higher priority, thinking that it would fall back to the wired interface for anything inaccessible by the wireless adapter (similar to a load balancer – of sorts). That didn’t work as I expected so we were back to square one.
The solution I am cooking up is an attempt to remedy that.
Windows computers have long been able to create static routes that define IP rules for traffic to be handled in a specific way. Thankfully you can also specify which adapter can take user specified routes out of the box.
First of all, we need to know some information about the interfaces available on your computer. To do that, open a command prompt (in administrator mode on Vista and Win7) and type “ipconfig /all”, press Enter and you should be presented with something similar to what’s below.
Take note of the IP address and Gateway of your Wireless Network Connection. In my case above, the Wireless IP is 192.168.100.100 and the Gateway is 192.168.100.1, whereas the Wired IP is 192.168.100.102 and has the same gateway. If your wireless connects to a different AP than what is on your wired network, you will probably be on a different gateway for each adapter.
Next, we need a bit of information from the current routing table. To see your current routing table, open a command prompt (in administrator mode on Vista and Win7) and type “route print”, press Enter and you should be presented with something similar to what’s below.
The first section printed out will be your Interface List. You need to take note of the Interface Number your intended forced traffic will be going over (in this case, the WLAN adapter is #10). You should also look below the Interface List to the IPv4 Route Table. Take note of the Gateway for your WLAN card. You’ll need to know what IP address your WLAN card is using to determine that information, which is why we looked that up previously.
Lastly, You’ll need to determine the IP addresses of the services you are trying to access. If it’s a DNS name, you can resolve it by pinging the canonical name. For demonstration purposes we’ll use the IP address and subnet of my ISP, Dalton Utilities. Their subnet is 184.108.40.206/20, or expanded for use in the command we’re going to use a host of 220.127.116.11 with a subnet mask of 255.255.240.0.
Now we can get into the actual static routing!
The information needed for the ROUTE command, is DESTINATION (use the host address), SUBNETMASK (255.255.255.255 if just a single IP address), GATEWAY (from the adapter you are using), METRIC (we’re not going to specify one), and INTERFACE (for our example, it’s “10” from the WLAN adapter using the route print command above). We will also add a -p switch at the end to make this persistent (to add it to the Windows registry so it can be enabled on a restart).
The command we will be executing for our example follows:
route add 18.104.22.168 mask 255.255.240.0 192.168.100.1 if 10 -p
Type “route print” again to verify the route is in the list under persistent routes, and begin utilizing your new static route over your secondary interface!
How are you using this information? Tell me below.