networking - Choosing from two IPs on a single machine

07
2014-04
  • Troman

    I have a server running on Windows Web Server 2008 R2. The server has two IPs that can be used to reach this server from the outside of the network. I need to connect to a game from two different IPs (I can explain why if needed) from this server. For this purpose I'm planning to install a second Network Adapter on the server and configuring it using "route" in Windows.

    What I don't know is how do I force outgoing connection to run through the first or the second IP? How do i "switch" them? Right now, with a single Network Adapter, the first IP address is always used.

  • Answers
  • Marcks Thomas

    I know of no browsers that allow the user to select an interface to bind to, although there might be. Most browsers let the operating system decide. The OS then consults the routing table, which you can configure to associate destination IPs with a particular interface. However, it seems like you want to use different interfaces for the same destination, for which the routing table does not suffice.

    Third party software may do the trick though. I've found ForceBindIP to be an invaluable networking tool. It does exactly what it says on the tin: forcing programs to bind to a specific interface, allowing control over which source IP to use per process rather than per destination, even when the program itself does not have this feature.

    As an example, I tried connecting to a web server 'Neon' using a machine with two IP addresses, 192.168.120.32 and 192.128.120.64. The first time, it used the former by default. Afterwards, I launched the browser using forcebindip.exe 192.168.120.64 firefox.exe and visited the same page. The access log below confirms both requests originated from different addresses:

    192.168.120.32 neon - [10/Feb/2014:14:14:03 +0100] "GET / HTTP/1.1" 200 1568 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0"
    192.168.120.64 neon - [10/Feb/2014:14:15:02 +0100] "GET / HTTP/1.1" 200 1568 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0"
    
  • pkSML

    Can't comment yet... But how is your connection set up? What's responsible for giving you an IP address on your network adapter? Is it a DHCP server? You could probably manually switch if you know all the details for the second address (IP address, subnet mask, default gateway, and your DNS servers). I assume all would be the same as your connection now except the IP address.

    To manually set my IP address (I'm using Win7), it goes like this: 
    
    Control Panel -> 
    Network and Sharing Center -> 
    Local Area Connection (click) -> 
    Properties -> 
    Internet Protocol Version 4 (TCP/IPv4) (select) -> 
    Properties (click) -> 
    fill in details of connection
    
  • pkSML

    Your best bet is a proxy server to get a second IP because it can be configured on a per web-browser basis. See http://www.iprivacytools.com/change-ip-address-firefox/ Also check out http://litlurl.net/public_proxies and http://litlurl.net/proxy_list


  • Related Question

    networking - My dyndns domain doesn't point to the right IP from inside my network, how do I correct that?
  • mike23

    I set up a DynDns account to point a domain to my dynamic IP server at home. From any "outside" network, the connection is working and pointing to my server. But when I point my browser to my URL (xxxx.dyndns.org) from within my LAN it goes to the login page of my ADSL modem.

    What am I doing wrong?


  • Related Answers
  • anthonysomerset

    Your not doing anything wrong, this is exactly how dyndns works. Dyndns is returning your public ip for your home internet connection, which the router responds on. Because you are inside the network it is assuming you want to connect to the router itself and not the port forwarding rules because you are already behind the firewall. To be able to use your dyndns url inside your network, your router needs to support NAT reflection (or port reflection) this allows internal users to connect to your public IP and it reflects back to the right internal IP through the routers port forwarding rules.

    If you dont have this you will need to either run dual dns, or use other methods such as overiding your hosts file when internal on the network

  • Casbar

    If your router doesn't support NAT reflection you could use port forwarding, but this would largely depend on what you are hosting.