So, how does Windows transmit an IP?
November 23, 2008 11:45 PM   Subscribe

I've two wireless connections on the same box. So, how does windows choose which one to use? Sort of related: I've a dotnet client/server application which is IP specific for its database (MYSQL) and two LAN connections on the same server (one for local, one for the internet). How do I force that application or database to use the right one (the local)?
posted by converge to Computers & Internet (10 answers total)
 
Please clarify: Are you talking about listening sockets or outgoing connections?
posted by themel at 12:11 AM on November 24, 2008


If they each show up as separate network devices I believe there's a dialog somewhere where you can set the binding order of the devices. I've had to do this because I use VMWare and I don't want it fruitlessly broadcasting on four different VMWare networks looking for a response before it tries the actual internet.
posted by XMLicious at 12:34 AM on November 24, 2008


themel: on the app, they are listening on the server. Its a POS system in which the terminals draw from the server. Also, if I name the server in windows, I can just use that instead of the IP. Unfortunately, for various reasons, that's not really a long term solution. Also, I'm very curious on this point.

XMLicious: really? Do you have an idea where this might be? That function (dialogue or no) would be extremely useful. Perhaps its a BIOS setting?

Do you guys know what the defaults would be? Why would it like one instead of the other?
posted by converge at 1:03 AM on November 24, 2008


Sorry, the terminals don't so much "draw" as "call". Bad choice of word.
posted by converge at 1:03 AM on November 24, 2008


I thought it was somewhere down in the properties of an individual network connection? As I recall it was a single, common setting but it could be reached separately through each network connection. (In Windows XP under Start -> Programs -> Accessories -> Communications -> Network Connections)

But on the other hand this Microsoft Help article has you open some control panel directly...
posted by XMLicious at 1:45 AM on November 24, 2008


Other than changing the binding order you'll probably also need to add some routes.
posted by damn dirty ape at 6:40 AM on November 24, 2008


But he would only need to add routes if the database is actually unreachable on one of the networks, right? (Which may be the case, but if that's not true - if he's just doing this to try and make sure the fastest connection is the one used - messing with the routes could actually make everything dependent on a particular network device when it shouldn't be, I think.)
posted by XMLicious at 7:38 AM on November 24, 2008


Yep, thats right. I misunderstood the issue. Im guessing whats really going on is that his application is binding to the wrong interface. Its not a routing issue at all, especially if the clients are on the same subnet.
posted by damn dirty ape at 8:00 AM on November 24, 2008


Do you have any specific problem or are you just curious how this works? Your questions uses slightly confused terminology. I'm simplifying to the classical understanding here, but it's quite likely that this describes your situation adequately.

When you send an IP datagram to establish a TCP session, Windows consults the routing table to see how it should reach the destination address. The routing table is a list of {destination address, mask, next hop} items, where next hop is either an interface to use for sending (for hosts you have a direct connection to) or a gateway address (for hosts that you reach via a router). When the (destination address & mask) == (route entry & mask), the packet is sent out via the specified method. Additionally, there are one or more 'default routes', which catch anything not matched via a specific route.

In a normal local network/internet setup, you'd have a specific route to the local network, saying something like 'send everything to 192.168.1.* out via the Ethernet device, while everything else goes to a gateway at 192.168.1.254'.

The easy standard interface to the routing table is the 'route' command, see Google for details. You shouldn't need to worry about this, but you might encounter problems if your LAN connection relies on the default route to reach your server, while the default route is replaced when you connect directly to the Internet. In that case, you just need to add a direct route to your MySQL server using whatever nexthop specification the default route of the LAN used.

If your question was about how the source addresses for packets that you send are selected, that's a whole 'nother can of worms (but usually it's the address of the interface over which the packet is finally out).
posted by themel at 12:20 PM on November 24, 2008


Re: Binding - if you create a server socket, it will usually (sans firewall!) listen on ALL the adresses of the system. Applications can call bind() to limit which addresses to bind to, in which case it's a matter of application configuration to get this right.
posted by themel at 12:24 PM on November 24, 2008


« Older Spare your wrath about 80s music, please, this is...   |   Plain Text Password in Welcome Email Newer »
This thread is closed to new comments.