Title: IP Source Address issues with PaceMaker Virtual IP
Tags: networking;network-interface;pacemaker;high-availability;floating-ip
Question: I am having trouble setting up a Virtual/Floating IP. In this specific circumstance I am using Pacemaker+Corosync to manage 2 Virtual IP's. One is internal and the other is external to our SIP Trunk. VOIP Asterisk/FreePBX.
The issue seems to be that our SIP Trunk is seeing the packets coming from the IP that is registered directly onto the NIC, not from the Virtual_IP that is tied to the NIC.
Is this possible? Any thoughts on how to troubleshoot/fix this?
Cluster Virtual IP Commands used to create Virtual IP's :
pcs resource create www_virtual_ip ocf:heartbeat:IPaddr2 ip=151.154.11.224 cidr_netmask=32 nic=eth0 op monitor interval=30s
pcs resource create sip_virtual_ip ocf:heartbeat:IPaddr2 ip=151.154.11.224 cidr_netmask=32 nic=eth1 op monito
I am using Asterisk 11 + FreePBX 2.12 on CentOS 7. I read this might be an asterisk 11 issue with the 2 IP's on one nic, but vs try to configure Asterisk, I'd like to get this working at the PaceMaker level.

Here is the accepted answer: I had a similar issue with an IAX2 trunk in a Pacemaker HA setup. The solution is not to disable the primary IP address of the NIC, but rather to source all traffic from the virtual IP address. There is even a pacemaker resource agent just for this. The ocf:heartbeat:IPsrcaddr.
For example I have a virtual (secondary) IP of 151.154.11.224. This IP floats between nodes A &amp; B. Nodes A &amp; B have IP addresses of 151.154.11.224 and 151.154.11.224 respectively. The gateway for this network erinmccarthy@example.com.
I want all traffic to appear as if it coming from the virtual IP address of 151.154.11.224 which currently is hosted by nodeA. To do so we can simply add a default route with a specific source address set.
ip route add default via 151.154.11.224 src 151.154.11.224
You may then want to delete the old default route. You can try this to test initially and see if it resolves your issues.
If that works for you then simply configure the ocf:heartbeat:IPsrcaddr resource agent in your pacemaker cib to set this default source route automatically should the virtual 151.154.11.224 address ever failover. In my cib I have it like so:
primitive asterisk_srcaddr IPsrcaddr \
params ipaddress=151.154.11.224 cidr_netmask=24
Just make certain that this asterisk_srcaddr resource starts after the 151.154.11.224 IPaddr2 resource.
Comment for this answer: Man I am driving to work to try this right now! Very promising! Looks like what I need!
Comment for this answer: I have 2 NIC's, but the ipsrcaddr doesn't take the nic= param, any ideas if I have two nics, how I can specify the srcaddr for each nic/gateway?
Comment for this answer: If they're on separate networks simply define two routes. If it's two NIC's on the same subnet then I'm not too sure then. The IPsrcaddr resource agent merely creates and deletes routes. It has no concept of interfaces.


{'source': 'StackExchangeDataset', 'subset': 'unix.stackexchange.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:07/27/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<networking><network-interface><pacemaker><high-availability><floating-ip>', 'Title': 'IP Source Address issues with PaceMaker Virtual IP', 'ViewCount': 8255, 'id': 298697, 'user_AboutMe': '<p>Check out <a href="http://freesoftwareservers.com" rel="nofollow">FreeSoftwareServers.com</a> for more information</p>\n', 'user_AccountId': 6090510.0, 'user_DisplayName': 'FreeSoftwareServers', 'user_Reputation': 2272.0, 'user_Views': 547.0, 'user_id': 130767.0}}