Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
what do you mean by vip? An IP is an IP. you can assign as many as you like. The path selected depends on the routing table. –  Zoredache Dec 12 '12 at 21:40
    
Virtual IP I mean.So I can have both a public virtual IP and a public IP?Also the routing table could be different even if the MAC destined is the same? –  user76678 Dec 12 '12 at 21:43
    
You're question isn't very clear and I'm not sure how you imagine it is that you'd assign a "VIP" to the NIC, but certain load balancing technologies (such as NLB in Windows) create a virtual ip address and bind it to the NIC of the load balanced members. Is this what you're referring to? –  joeqwerty Dec 12 '12 at 21:47
    
@joeqwerty:Correct –  user76678 Dec 12 '12 at 21:48
    
@joeqwerty:Updated OP –  user76678 Dec 12 '12 at 22:08

2 Answers 2

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:

ifconfig eth0:0 10.10.10.42 netmask 255.255.255.0 up

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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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