Suppose I have multiple network cards connected to my PC, how can I know which card is used for communication. For example, if I use

ping 192.168.x.xxx

I would like to know which card (and which IP address) used for communication.

The command


will tell us about the active connections. I am not interested in active connections, but I would like to know which card will be used for next connection. That is, if we use ping which card (or IP address) will be used ?

  • Which OS are you using? – Flimzy Jun 30 '11 at 8:20
  • @Flimzy: Was there any misleading words in my question ? – Muhammed Rauf K Jun 30 '11 at 8:41
  • Are you asking about my edit? Your title was too vague... "communication with multiple cards" could refer to many things, including routing, bridging, or bonding. – Flimzy Jun 30 '11 at 8:44
  • Ohk. Thanks. I will take this in mind for next questions and answers – Muhammed Rauf K Jun 30 '11 at 8:48

Try route print; it'll show you the OS's table of networks and which network interface it'll use for each, or where there's multiple cards on the one network the weighting it'll use in distributing the traffic. I've only got one card in this machine so this isn't very interesting:

Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 12 34 56 78 9a ...... Intel(R) 82566DM Gigabit Network Connection
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
       10       1       20       10       10       10       10       1
    Default Gateway:
Persistent Routes:

so e.g. from the second line traffic to 127.x.x.x will use the loopback interface but traffic to multicast and everything else will use the network card. I'm not sure how to read this programattically, though, sorry.


netstat would tell you - the local address listed in netstat would be the ip address of the network card you are using

Lets take a snippet of my own netstat output on windows - i'm connected to my lan over, and a crossover lan connection over

 Proto  Local Address          Foreign Address        State
  TCP         ARTEMIS:ms-wbt-server  ESTABLISHED
  TCP        Athena:49172           ESTABLISHED
  TCP    stackoverflow:http     ESTABLISHED is the adaptor on the local crossover, connected to ARTEMIS, which is running a RDP server, is talking to my router, which is, and stackoverflow. Note also that local connections on are represented.

on linux you may need to use

netstat -n

i only have one port active in my linux box, but it'll look something like - for an ip address

   tcp        0     52      ESTABLISHED

The card used is determined by the IP address configured on that card. It is worth noting that it is not generally valid to configure IP addresses on the same subnet to different physical interfaces. (Yes there are exceptions to this, but they are generally very specific, and unlikely to be useful to you at this level).

Which physical card is associated with which logical name within your operating system is a thornier issue. The easiest way to determine this is unplug all but one of the network cables and see which IP address you can still communicate on.

What operating system are you using, for certain OS types there are sometimes easier ways of determining which card has been unplugged - Windows, for example, provides visual feedback via the system tray icons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.