Validate Floating IPs with OVS

Image by John Reed / Unsplash

If you’ve got a bare metal host provided by some cloud provider, there’s a chance you’ll also have been provided with a range of floating IPs that you can use for various services or things like OSP guests. Normally, if you wanted to test these IP address(es), you’d simply assign the IP to the external interface and ensure you can ping the machine:

$ sudo ip addr add 10.1.241.101/32 dev eno1

However, this doesn’t work if you’re using OVS. As noted in the OVS FAQs:

A physical Ethernet device that is part of an Open vSwitch bridge should not have an IP address. If one does, then that IP address will not be fully functional.

The solution, as pointed out in the FAQ, is to instead assign the IP address to the external bridge. For example:

$ sudo ip addr add 10.1.241.101/32 dev br-ex

Once this is done, you can attempt to ping the machine from another host on the same network and see the response:

$ ping 10.1.241.101 -c 1
PING 10.1.241.101 (10.1.241.101) 56(84) bytes of data.
64 bytes from 10.1.241.101: icmp_seq=1 ttl=53 time=154 ms

--- 10.1.241.101 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 154.431/154.431/154.431/0.000 ms

Don’t forget to remove the IP address once you’re finished!

$ sudo ip addr del 10.1.241.101/32 dev br-ex