Is it possible to configure in the same NIC a VIP and a private IP (different) and both be enabled/accesible?
If yes, is there a guarantee that the communication path for these 2 IPs will be exactly the same?
Update: If this is possible, if I e.g. do a ping
(or traceroute
) from a specific machine will I always have the same route for both these 2 IPs?
You can have as many virtual IPs on the same physical device. On Linux you can create virtual interfaces for an IP (mostly) like this:
or via
/etc/network/interfaces
The route for every IP can be determined independently. Every IP can have a different default route. But you can ping in and out from every of this IPs
Having multiple IPs on a NIC is not an issue at all. You can use regular tools like
ip addr add 1.2.3.4/24 dev eth0
and a configuration file would be distribution dependent.The switch where your nic is connected will broadcast a "who has IP a.b.c.d" and your NIC will respond if it is one of the IPs it has. Receiving packets is not an issue.
The outgoing packets, however, are a different story. In response to a ping, the outgoing packet's source IP will be determined from the routing table (
ip route show
). This will be most likely based on the destination IP, and depending on which IP got pinged, you could have problems.