If I have a network interface with multiple IP addresses bound to it can I set which IP address on the interface my server uses? It sees to be set to use the first IP address I added to it.
Info: Ubuntu on OpenVZ
Various software will let you specify which interface to use. But globaly, the interface used is controlled by your routing rules.
You can view the routing rules with: netstat -nr
Are both interface in the same subnet? You can make sure your routing rules direct all the traffic to the interface you want.
The correct term is Multihome device. Your one network interface card has multiple IP address, in other words, your network interface card as 1 ethernet RJ45 jack with one ethernet cable connected to it. However, your it has 4 IP addresses. Yes, you can do that, the first IP address is the main one, the rest of them are called Aliases.
you should see something like this:
eth1 is my interface with 10.100.8.31 as my ipaddress, however, there are 4 alias ip addresses assigned to this nick and they show up as eth1:1, eth1:2 ...
They have corresponding ifcfg-eth1:x files. For example
So, when the system starts up, these scripts are loaded.
If that is Linux, then it is probably uses "weak host model" by default, therefore: In the weak host model, an IP host (either IPv4 or IPv6) can send packets on an interface that is not assigned the source IP address of the packet being sent. This is known as weak host send behavior. An IP host can also receive packets on an interface that is not assigned the destination IP address of the packet being received. This is known as weak host receive behavior.