How to determine/control which source IP address is used having multiple IPs on the same subnet?

Latest response

Hello folks,
I have assigned an alias IP address from the same subnet as the original one to my nic. So my ifcfg-eth0 and ifcfg-eth0:1 looks as follows:

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
NAME=eth0
GATEWAY=192.168.1.1
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
NETMASK=255.255.255.0
IPADDR=192.168.1.40

# cat /etc/sysconfig/network-scripts/ifcfg-eth0\:1 
DEVICE=eth0:1
ONPARENT=yes
IPADDR=192.168.1.70
PREFIX=24
  • What IP address would be used as source IP for (initiating) outgoing traffic by default?
  • How could I control which IP should be used as source IP for outgoing traffic?

In Solaris one could mark a logical IP as deprecated. Is there a similar concept for Linux?

Best regards,
Joerg K.

Responses