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

I have an interface eth1 on host A with two different IP addresses (let's say 10.0.0.1 and 10.0.0.3). The .1 is the standard IP of the host and .3 is the failover IP that can be switched over to another server (host B, 10.0.0.2) for HA purposes. 10.0.0.1 is set via /etc/network/interfaces, 10.0.0.3 is managed via Pacemaker and added via ip addr add.

My problem is that when I try to connect to a (local) service provided on 10.0.0.3 from host A, it also uses 10.0.0.3 as the source address for the connection. This obviously wouldn't work if the failover IP was switched over to the secondary node (host B). The question is now if I can somehow specify 10.0.0.1 as the source IP for connections to 10.0.0.3?

ip route get 10.0.0.3 shows 10.0.0.3 as source address which is probably the reason for this behavior.

share|improve this question

1 Answer 1

If the IP gets switched to another machine, it should be removed from the first one, so the routing table will adjust. However if you do want to set source IP (or force routes), use following syntax: ip r a dev eth1 10.0.0.3 src 10.0.0.1

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.