4

I have several computers that are multi-homed, and have different static IP addresses for each of several network connections. How can I tell which of these IP addresses is used when I'm connecting to some other specific domain?

6

The rule is rather simple.

By default, with no NAT rules involved, the IP addresses of the respective networks of interfaces are used when communicating with the very same logical network defined by the pair IP address/netmask ; otherwise when going out by the default gateway, the primary address of the first interface is used.

Be aware that some services can be bind to a specific IP address, and in that case that IP is used.

NAT rules can and will change this behaviour.

The command

ip route get dest_IP

will also tell you which IP address will be used when routing.

Be also aware that IPv6 services take precedence over IPv4 by default.

  • Part of the problem is that I don't know which network the computer I'm connecting to is on. – Dan Dec 17 '15 at 21:08
  • I have expanded the answer. – Rui F Ribeiro Dec 17 '15 at 21:11

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.