Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have multiple network interfaces on a Windows client machine. I would like for some IP traffic to go through one card and other traffic to go through the other card based upon the IP (actually, I would prefer domain names) of the destination server.

I see no way to configure this using the Windows GUI.

Can I do this in WinXP+?

If it's complicated, then some pointers to good articles would be sufficient as my Googling skillz seems to fail here.

share|improve this question

2 Answers 2

You would use the 'route' command. Essentially you can tell you machine to send traffic to different gateways based on the destination IP range. Type "route" from cmd.exe to see usage behaviours.

Here's the output from "route print" on my local machine. You can see that since I have a VPN connection with split tunneling turned on, some networks (as defined by the VPN server) are destined to the VPN (172.16.143.151) and some are destined to my local network interface (192.168.0.16)

C:\Documents and Settings\jj33>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x3 ...00 1f e1 3d 61 06 ...... Dell Wireless 1395 WLAN Mini-Card - Packet Scheduler Miniport
0x10005 ...00 1e 37 fc ca c8 ...... Bluetooth Personal Area Network - Packet Scheduler Miniport
0x100006 ...00 05 9a 3c 78 00 ...... Cisco Systems VPN Adapter - Packet Scheduler Miniport
0x120002 ...00 1d 09 d7 78 65 ...... Broadcom NetXtreme 57xx Gigabit Controller- Packet Scheduler Miniport
===========================================================================
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.0.1    192.168.0.16       25
         10.0.0.0        255.0.0.0   172.16.143.151  172.16.143.151       1
      69.8.143.78  255.255.255.255   172.16.143.151  172.16.143.151       1
     69.8.147.133  255.255.255.255      192.168.0.1    192.168.0.16       1
        72.4.16.0  255.255.255.248   172.16.143.151  172.16.143.151       1
      72.4.78.130  255.255.255.255   172.16.143.151  172.16.143.151       1
      89.101.16.0    255.255.255.0   172.16.143.151  172.16.143.151       1
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1
      169.254.0.0      255.255.0.0     192.168.0.16    192.168.0.16       20
       172.16.0.0      255.240.0.0   172.16.143.151  172.16.143.151       1
     172.16.143.0    255.255.255.0   172.16.143.151  172.16.143.151       25
   172.16.143.151  255.255.255.255        127.0.0.1       127.0.0.1       25
   172.16.255.255  255.255.255.255   172.16.143.151  172.16.143.151       25
      192.168.0.0    255.255.255.0     192.168.0.16    192.168.0.16       25
      192.168.0.4  255.255.255.255     192.168.0.16    192.168.0.16       1
     192.168.0.16  255.255.255.255        127.0.0.1       127.0.0.1       25
    192.168.0.255  255.255.255.255     192.168.0.16    192.168.0.16       25
    192.168.100.0    255.255.255.0   172.16.143.151  172.16.143.151       1
    206.220.212.0    255.255.252.0   172.16.143.151  172.16.143.151       1
      216.135.0.0    255.255.252.0   172.16.143.151  172.16.143.151       1
        224.0.0.0        240.0.0.0   172.16.143.151  172.16.143.151       25
        224.0.0.0        240.0.0.0     192.168.0.16    192.168.0.16       25
  255.255.255.255  255.255.255.255   172.16.143.151  172.16.143.151       1
  255.255.255.255  255.255.255.255     192.168.0.16    192.168.0.16       1
  255.255.255.255  255.255.255.255     192.168.0.16          120002       1
  255.255.255.255  255.255.255.255     192.168.0.16           10005       1
Default Gateway:       192.168.0.1
===========================================================================
Persistent Routes:
  None

Now, all of those are dynamic routes. You could use the route command to replicate something similar though. Try Googling "adding static routes to windows" for more details

share|improve this answer

This question is similar, no matter what platform you're on. First, I'm going to make the assumption that you have two network adapters, and they are both connected to the same subnet. If they are connected to different subnets, the answer is similar.

An approach to the problem illustrated with an example:

Routing traffic based on IP

Adapters:

  • A1: 10.20.100.101/24
  • A2: 10.20.100.102/24
  • Default gateway on both: 10.20.100.1

Target addresses/networks and how you want to reach them:

  • 10.20.100.201 via A1
  • 10.20.100.202 via A2
  • 10.20.101.0/24 via A1
  • 10.20.102.0/24 via A2

This means that you want to set up the following direct and gateway routes. I'm using notation similar to what you would see using ip routes on Linux, for simplicity:

10.20.100.201/32 dev A1
10.20.100.202/32 dev A2
10.20.101.0/24 via 10.20.100.1 dev A1
10.20.102.0/24 via 10.20.100.1 dev A2

The way to make these routes exist, how to reference the appropriate adapter, and how to make them persistent is dependent upon the OS you're using. I'll describe how to do this in XP.

First, you have to identify the interface number for each interface. As described by the previous answer, use route print. Suppose the first few lines show:

C:\>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x120002 ...00 1d 09 d7 78 65 ...... Broadcom NetXtreme 57xx Gigabit Controller
0x120003 ...00 1d 09 d7 78 66 ...... Broadcom NetXtreme 57xx Gigabit Controller

Assuming that you determined that 0x120002 was the adapter A1, and 0x120003 was adapter A2, you could then type the commands:

C:\> route -p add 10.20.100.201 mask 255.255.255.255 10.20.100.101 IF 0x120002
C:\> route -p add 10.20.100.202 mask 255.255.255.255 10.20.100.102 IF 0x120003
C:\> route -p add 10.20.101.0 mask 255.255.255.0 10.20.100.1 IF 0x120002
C:\> route -p add 10.20.102.0 mask 255.255.255.0 10.20.100.1 IF 0x120003

Using the -p option makes the routes persistent, which means that they will still be available after reboot.

Routing traffic based on domain name

For this, I would use the same approach, but segment the domain names into different subnets to make the route entries easier. For instance, using the data above:

  • mynetwork1.company.localnet = 10.20.101.0/24
  • mynetwork2.company.localnet = 10.20.102.0/24
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.