How does XP determine which NIC card to use?

I am running XP Pro and have multiple active NIC cards.  How does XP determine which NIC card it wil use for each network request?
SAbboushiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fatal_ExceptionSystems EngineerCommented:
Since the idea of multiple NICs is that each will be on a different subnet, that will be the determining factor when accessing a network resource.  To find a resource your system looks at its ARP table.  If the MAC address of the resource is not found, it broadcasts a request (ARP) for the MAC address of the IP Address which is being sought.  The resource will send back its MAC address so your system can then send the packets to that resource, and map the MAC to its IP Address for placement in the ARP cache.  If no resources respond to that ARP request, then it will send it to the Default Gateway, and let it find the resource....

FE
adamdrayerCommented:
Excellent explanation, FE.

Also, if you type "route print" at a command prompt, you will see a list of IP address ranges and it will specify which particular interface is being used when communicating with that range.  FE is correct, though, and you should not have multiple NICs on the same subnet, so it should be relatively easy to figure out which card is being used.  Especially since only one should have a default gateway.
Fatal_ExceptionSystems EngineerCommented:
ThankQ Adam!  :)
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

meverestCommented:
>> If no resources respond to that ARP request, then it will send it to the Default Gateway, and let it find the resource....

I think you might find that if the arp does not resolve on the subnet that the ip layer dicates it should, then it will immediately return as host not found (!H) - the router module will only forward to the gateway if the IP layer caculations dictate that the destination is on a non-local subnet.

Cheers!
Fatal_ExceptionSystems EngineerCommented:
True, I was trying to keep it simple..  :)  We could, of course, go through the entire OSI model and explain in detail how this works, but I don't think any of us has time for that, eh?...   :)
meverestCommented:
of course!  ;-)

I thought it was probably that, but i am a stickler for detail - even when simplified :-}
Fatal_ExceptionSystems EngineerCommented:
:)  detail is good!
SAbboushiAuthor Commented:
Thanks for your posts - I actually have 2 NIC cards on the same subnet in my laptop (wired and wireless).  I don't disable the wireless when I am "plugged in" and haven't noticed any problems.  I get the impression thought that XP uses the wired nic card when both are available because as soon as I "plug in", I have a ton more bandwidth (files copy faster between my laptop and other machines on my LAN).  I'm just trying to understand how this works - and I agree that detail is good!
Fatal_ExceptionSystems EngineerCommented:
Your Cable LAN NIC is probably running 100 Mbps full duplex, so that would certainly deliver more speed to your internal network...  And if you are running both Wifi and Hardwired, then the Hardwired NIC will take over when plugged in...
meverestCommented:
>> I get the impression thought that XP uses the wired nic card when both are available because...

I suspect that you may be right.  normally, having two interfaces on the same subnet will spell touble with a capital T.  Intuitively, I would have told you that it would probably not work at all, or at least be problematic.  Just goes to show how theory and practice are often very different! ;-)

XP must resolve that problem somehow by applying preferential treatment of one card or the other.

cheers!
Fatal_ExceptionSystems EngineerCommented:
Yes, WIFI is just about the only exception to the rule in multi-homed systems... There is always that 'exception' we have to deal with, eh?  :)
Fatal_ExceptionSystems EngineerCommented:
:)
meverestCommented:
suggest accept Fatal Exc.
SAbboushiAuthor Commented:
I appreciate the posts - I've seen recommendations that 2 NIC cards should not be used on the same subnet - but without any explanations as to why.  I have been doing it for years and am not aware of any problems... so I am eager for the supporting details.  



My original question remains: How does XP determine which NIC card it will use for each network request?

Fatal Exception - you said "if you are running both Wifi and Hardwired, then the Hardwired NIC will take over when plugged in..."   This is the behavior that I described and the conclusion that I've reached - but I am looking for the details  ; )
meverestCommented:
The question has been answered in fact.

in more detail, you need to understand the idea of ip address and netmask as a way to define a 'local subnet'

you may be aware that the address 192.168.1.1 mask 255.255.255.0 is on the same subnet as 192.168.1.20 mask 255.255.255.0

look atthe mask values - where there is a '255' (which happens to be binary '11111111') means that the corresponding part of the ip address determines the 'subnet'.

Mathematically, you take the ip address, byte by byte, and executa a logical AND with the mask, the result is the subnet.

so, the subnet for 192.168.1.1 mask 255.255.255.0 is 192.168.1.0.  That means that 192.168.1.x (where x = anything from 1 to 254) is the same subnet.

Now lets assume that one interface has an address 192.168.2.1 mask 255.255.255.0 and another interface has 192.168.1.1 mask 255.255.255.0

using the previous rule, the first interface is on the subnet 192.168.2.0 and the other is on the subnet 192.168.1.0

So, assume that a computer wants to send data to a computer at address 192.168.2.25 mask 255.255.255.0 - one guess which interface will be used (answer - obviously the interface on that same subnet)

so, you may ask, what if the computer wants to communicate with a device with an ip address that is on NEITHER of those subnets?

The answer: this is what a routing table is for.  do "route print" at a dos shell to see the routing table.

The idea of this is that the table is a list of subnets and the 'next hop' address on the path to that computer.  The next hop address in the routing table MUST be on a subnet that is local to one of the network interfaces installed.

If there are no specific route entries in the routing table for any given destination,  then the 'default route' will be used.  The default route is seen in the routing table with subnet and mask something like 0.0.0.0 mask 0.0.0.0, and is what you set up on the default network adapter as the "gateway address" or default gateway.

Hope that clarifies things.

Cheers.


Fatal_ExceptionSystems EngineerCommented:
The reason why you should not have 2 NICs in the same subnet is that it causes what we refer to as NIC Contention.  Basically, when a NIC sends out packets, all return packets must come back through that NIC, and visa versa...  If the NIC does not receive the return packets, timeouts are the result, and can cause havoc with your system.

With wifi, the developers knew that this could be a problem, and setup the systems to automatically make the wired connection the 'chosen' connection if it detected a wired LAN signal, therefore making it the dominant connection.  This prevents NIC Contention on your system.

Now, is that better?   :)

FE

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SAbboushiAuthor Commented:
Sorry for the delay - I've been out of town since last week - just returned last night.

meverest - here's my route print below.  Not sure what this is telling me though re: how XP decides which NIC card to use if both are in the same subnet...
Here's my scenario:  I want to copy a 3GB file to another computer on my subnet.  I also want to download a 50MB backup file from an internet site.
Since both of my NIC cards are configured for the same subnet, how does XP determine which NIC to use for each of these operations?

Fatal Exception - you've said that XP will automatically chooses a wired over a wireless connection - OK- but still not sure of the specifics.  How about this scenario:

I start my 3GB file copy and 50MB download as described above over my wirelesss NIC.  A few minutes later, I connect the cable to my wired NIC card.
What happens?  Will XP switch / continue the transfer & download over the wired NIC?  Suppose the situation is reversed: I start the transfer over the wired NIC by disabling the wireless NIC - then I turn on the wireless NIC and after getting my IP address, unplug the wired NIC in the middle of the transfer/download.  What happens?

Thanks for your posts - you've given me information to gain a little more understanding here.  Would appreciate hearing back if you have answers to my questions (although I have already assigned points).


------------------------------------------------------------------------------------------------------------------------------------------------------------
C:\Documents and Settings\Samir>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 c0 9f a0 93 f9 ...... Realtek RTL8139 Family PCI Fast Ethernet NIC - P
acket Scheduler Miniport
0x3 ...00 90 4b f1 e9 2b ...... Broadcom 802.11b/g WLAN - Packet Scheduler Minip
ort
===========================================================================
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0  192.168.186.187  192.168.186.18       25
          0.0.0.0          0.0.0.0  192.168.186.187  192.168.186.17       20
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1
    192.168.186.0    255.255.255.0   192.168.186.17  192.168.186.17       20
    192.168.186.0    255.255.255.0   192.168.186.18  192.168.186.18       25
   192.168.186.17  255.255.255.255        127.0.0.1       127.0.0.1       20
   192.168.186.18  255.255.255.255        127.0.0.1       127.0.0.1       25
  192.168.186.255  255.255.255.255   192.168.186.17  192.168.186.17       20
  192.168.186.255  255.255.255.255   192.168.186.18  192.168.186.18       25
        224.0.0.0        240.0.0.0   192.168.186.17  192.168.186.17       20
        224.0.0.0        240.0.0.0   192.168.186.18  192.168.186.18       25
  255.255.255.255  255.255.255.255   192.168.186.17  192.168.186.17       1
  255.255.255.255  255.255.255.255   192.168.186.18  192.168.186.18       1
Default Gateway:   192.168.186.187
===========================================================================
Persistent Routes:
  None

C:\Documents and Settings\Samir>
Fatal_ExceptionSystems EngineerCommented:
Good question.  Because packets are actually sent via MAC address, and if the MAC address (the NIC) is no longer present, I believe that you will loose the download..  (The MAC address is in the Frame Header, and if that MAC is not found the packets will be dropped)  But, try it and see.  :)

Hope this helps..  

and thanks!

FE
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Networking

From novice to tech pro — start learning today.