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
netstat
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 ?
Best Answer
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: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.