Forcing an application to use a specific network card

Forcing an application to use a specific network card

Forcing an application to use a specific network card in Windows is something that may end up being super handy at times. For instance, if you’re connected to your company’s corporate [restricted] network via the Ethernet cable and also connected to the Guest [open] network via the wireless network card, you may decide to route an application through of one the two. Note that Windows uses the “metric” of a network card to choose which NIC have priority over the other, and if you want to keep that unchanged, then forcing an application to use a specific network card is what you need.

In order to achieve this, we will use a 3rd party application called ForceBindIP, available at this link http://www.r1ch.net/stuff/forcebindip/.

The nice thing of ForceBindIP, is that it comes as a portable application (or you can choose the installer version). If you go ahead with the portable version, make sure you keep the files (.dll and .exe) together.

Extract the zipped folder and you will find 4 files, 2 DLLs and 2 EXEs:

forcebindip

As you can see, two files (DLL and EXE) are for 64bit systems/applications and the other two are for 32 bit systems/applications. If you are using a 64bit OS, keep both versions. In fact, you will need to use both, depending on the application you’re going to launch. For instance, Firefox on a 64 bit OS, will still run as a 32 bit application, and for that you will need to use ForceBindIP. Instead, the Microsoft Remote Desktop tool (mstsc.exe), on a 64bit OS, must be ran with ForceBindIP64.

Let’s make an example on how ot use this application:

  • I have 2 NICs, one connected to the corporate network that has this IP address: 10.1.1.55. The second NIC, is connected to the guest network and has this IP address: 192.168.50.20.
  • I want firefox to use the guest network.
  • 64bit OS

Open the command prompt and type:

ForceBindIP.exe 192.168.50.20 "c:\Program Files (x86)\Mozilla Firefox\firefox.exe"

That’s it! It’s that simple, really. Firefox will launch and will be using the guest network.
Here’s an example if you want to run mstsc.exe (on a 64bit system) with the guest network:

ForceBindIP64.exe 192.168.50.20 c:\Windows\System32\mstsc.exe

Or, if you have a .rdp file saved:

ForceBindIP64.exe 192.168.50.20 c:\Windows\System32\mstsc.exe C\Temp\external_server.rdp

Have fun! 🙂

 

IT Droplets

IT Droplets