Thursday, 17 November 2011

How to route network traffic with two or more network adapters

Use route /? from a command line to discover the answer...

  1. Get the destination ip address from comparing the tcp receive port number from a PROCMON filter on operation begins with TCP, and the name of the process that you're running e.g. chrome.exe
  2. netstat -n | findstr /i "port number here" - this will give you the destination ip address
  3. route print - to get the interface card number
  4. route add destination.ip.address.here MASK 255.255.255.255 default.gateway.ip.here IF interfacecardnumber

e.g.

> route ADD 157.0.0.0 MASK 255.0.0.0  157.55.80.1 METRIC 3 IF 2
         destination^      ^mask      ^gateway     metric^    ^
                                                     Interface^
  If IF is not given, it tries to find the best interface for a given
  gateway.

Your computer might already be using both connections. It really depends on the topology of the networks, and where the various services lie.
If you are on windows and go to the command line and run "route print" you'll see a table that the operating system uses to decide which interface to send packets out on to a given destination IP address.

If you run "netstat -n" it will show open TCP connections on your computer. The left hand column will show the local IP addressed being used. If you see more than one local address used (besides 127.0.0.1) then your computer is probably already using both connections.
There are similar commands on the Mac, but I'm not sure what they are.

What you'd do, I think, is figure out the outbound IP addresses that matter to you what subnet they're routed through. Route those that way and have the default routing set the other way. Obviously you can route ranges of IP addresses. Whichever is easiest to specify is what you'll specify.

No comments:

Post a Comment

Android mediaserver process killing battery life

If this happens to you, then do the following Force stop on Settings, Applications, All, Media Storage. Clear Cache and Clear Data, fo...