• ARTICLES
SEARCH

How-To Geek

How to Force an Application to Use a Specific Network Card

image

Have you ever been connected to a network, and plugged in a 3G card and wished you could make only a certain program use your 3G connection ? Well you can, read on to find out how.

Installing ForceBindIP

Head over to the ForceBindIP download page, and grab a copy of the zipped version.

image

Once it has downloaded, extract the contents of the zip file.

image
You will need to copy both files.

image

Then paste them in:

C:\Windows\System32

image

Now press the Win + R keyboard combination and type cmd into the run box, then press enter.

image

When the command prompt opens, run the following:

cd C:\Windows\System32

image

Now we can bind an application to a network adapter, to do this type:

ForceBindIP %NetworkCardsIP% %PathToProgram%

For example:

ForceBindIP 127.0.0.1 “C:\Program Files (x86)\Mozilla Firefox\firefox.exe”

This assumes:

  • The network card you want to bind the application to has an IP of 127.0.0.1
  • The program you want to bind to that network card is Firefox.

image

Just a few things to remember:

  • You have to give the full path to your program.
  • If the path contains spaces, enclose it in quotes.
  • You will have to launch the program via this method every time you want to bind it to that network card.

That’s all there is to it.

Taylor Gibb is a Microsoft MVP and all round geek, he loves everything from Windows 8 to Windows Server 2012 and even C# and PowerShell. You can also follow him on Google+

  • Published 07/10/12

Comments (12)

  1. Dave

    If you are putting it in your system32 folder you should not have to browse to that folder to run the software

    So in theory you should be able to create a shortcut with the command you mentioned.

  2. Carlos

    I assume this configuration is not persistent, so it lasts until next reboot, isn’t it?

  3. Kodess

    Dave’s right.

    @Carlos, everytime you want to start Firefox and force it to a certain NIC, you will have to use the command.

  4. Fuuny Man

    Does this mean I can torrent on my neighbor’s open wifi AND browse the internet using my wired LAN connection, thereby maximizing the “available bandwidth” in my area?

    Thanks Taylor, I’ve always wanted to do this, and didn’t know it was possible.

  5. Alex Thorp

    Thank you, this is extremely useful.

  6. snap

    any easy nice way to do similar in ubuntu?

  7. CNP

    How to remove this Setting ……

  8. mike

    will this work if i have multiple vpn connections? can i force apps to use certain connections?

  9. me

    “bind the application to has an IP of 127.0.0.1″

    Can I has IP?

  10. Saurabh

    how do i find that specific ip address????

    pls help,i really wanted this trick.

  11. Chris

    In theory this gets the IP of your network card and then uses that to run forcebindIP.
    I know it works for certain applications, but it seems that IE and FireFox seem reluctant to work as intended.
    I made a batch file which I run instead of the application I want to run. This way it will always use wifi rather than the wired ethernet.

    The name I’m wanting to use is “Wireless Network Connection”.
    If your wireless name is different it should be just a matter of changing it on line 3. The names of the device’s can be found using ipconfig.

    This batch file is for a Win7 64bit machine. If you want to use it in a 32bit machine, change the last line to system32 rather than syswow64.

    Batch file follows (save this as a “.bat” file):

    ===============
    @echo off

    netsh interface ip show addresses “Wireless Network Connection” > tmp.txt

    rem that gets the info on the Wireless card. There’s a bunch of stuff included…

    findstr /i “ip Address: ” tmp.txt > tmp1.txt

    rem Get just the line that says IP address.

    @echo off > tmp2.txt & setLocal enableDELAYedeXpansion

    for /f “tokens=* delims= ” %%a in (tmp1.txt) do (
    set S=%%a
    set S=!S:I=!
    set S=!S:P=!
    set S=!S:A=!
    set S=!S:D=!
    set S=!S:R=!
    set S=!S:E=!
    set S=!S:S=!
    set S=!S::=!
    set S=!S: =!
    >> tmp2.txt echo.!S!
    )

    rem get just the ip address number.

    FOR /F “tokens=*” %%R IN (‘type tmp2.txt’) DO SET VAR=%%R

    del tmp.txt
    del tmp1.txt
    del tmp2.txt

    c:\windows\syswow64\ForceBindIP %VAR% “C:\Program Files (x86)\Mozilla Firefox\firefox.exe”

    =============

    How it works:
    It uses the netsh command to get all sorts of information, including the IP address, of the device you have specified.
    It saves this information to a temp text file.
    It then opens this temp text file and removes everything apart from the ipaddress (in two steps).
    This IP address is saved to another temp file.
    Finally it gets the number from the temp file, stores it as a variable, deletes the three temp files it makes, and runs the forceBindIP program using the relevant IP address.
    There is almost certainly a better way of doing this, but this works. If you can do better, please do so.

  12. caumad70

    Is it possible to force certain program to use different MAC ADDRESS instead of the IP ADDRESS, like this software allows?

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!