how to make CentOS 8 inside LXC container send gratuitous ARP upon link-up

Issues related to configuring your network
Post Reply
totaluser
Posts: 1
Joined: 2021/06/02 10:42:03

how to make CentOS 8 inside LXC container send gratuitous ARP upon link-up

Post by totaluser » 2021/06/04 12:53:20

Good afternoon Everyone,
I am pretty new to Libvirt and LXC containers so please bear with me.
I have CentOS 8 guest system inside an LXC container and I would like to know if there is anything that can be done from a CenOS perspective.

Here is the situation:
- the virtualization server starts the LXC container and through libvirt XML passes it static IP address configuration
- CentOS starts and has connectivity to the network
++> at this point ARP entries are populated on the upstream portion of the L2 network

In case the virtualization server goes down, another server will take its place and will spin up a new LXC container through libvirt XML will assign it the same static IP address
- the new CenOS instance will start with a different MAC address and it is a pretty silent host that does not initiate connections to the outside network
++> this causes the upstream network devices to have ARP cache entries pointing to the IP address of CentOS inside LXC container [same IP for old and new instance] associated with the old MAC address [old and new instance has different MAC addresses] which effectively breaks the connectivity from the outside world into the LXC container


This problem can be solved by having CenOS inside LXC initiate a new ARP resolution that will update the ARP cache within the L2 domain with the appropriate MAC address.
This problem can also be solved by decreasing ARP timeout within the L2 domain so that the entry will expire much earlier [roughly the time it takes for the virtualization server to start and spin up the new instance of the LXC container]

I would like to ask if there is any other solution available.

I can see that ifup-eth script located at /etc/sysconfig/network-scripts/ifup-eth has some provision for arping to update ARP cache on the neighboring devices

Code: Select all

            # update ARP cache of neighboring computers
            if ! is_false "${arpupdate[$idx]}" && [ "${REALDEVICE}" != "lo" ]; then
                /sbin/arping -q -A -c 1 -I ${REALDEVICE} ${ipaddr[$idx]}
                ( sleep 2;
                /sbin/arping -q -U -c 1 -I ${REALDEVICE} ${ipaddr[$idx]} ) > /dev/null 2>&1 < /dev/null &
            fi

This is exactly the functionality I am looking for.
However, it seems that network-scripts have been deprecated in CentOS 8 and thus this solution will not work out-of-the-box.

Is there any way for CentOS to send gratuitous ARP upon bootup [interface bringup] or at least use regular ARP and check connectivity to its default gateway?

Thanks for your comments in advance.

Post Reply