Vrrpd icon indicating copy to clipboard operation
Vrrpd copied to clipboard

Learn IP address from a physical interface

Open dschultzca opened this issue 3 years ago • 0 comments

Currently vrrpd looks to the interface specified (-i) on the command line to be able to learn its IP address to be used in VRRP multicast packet transmissions. Can vrrpd be enhanced to learn the IP from a physical interface on which a virtual interface is created for VRRP? For example: Starting with a physical interface of ens33:

2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 00:0c:29:5e:0d:a1 brd ff:ff:ff:ff:ff:ff
    inet 144.137.226.17/28 scope global ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe5e:da1/64 scope link
       valid_lft forever preferred_lft forever

Create a virtual interface specifically for VRRP:

ip link add vrrp.4 link ens33 addrgenmode random type macvlan mode bridge
ip link set vrrp.4 up

3: vrrp.4@ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether ca:2b:98:2d:f8:74 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::c82b:98ff:fe2d:f874/64 scope link tentative
       valid_lft forever preferred_lft forever

Create VRRP instance:

vrrpd -i vrrp.4 -v 4 -p 101 144.137.226.30/28

3: vrrp.4@ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:00:5e:00:01:04 brd ff:ff:ff:ff:ff:ff
    inet 144.137.226.30/28 scope global vrrp.4
       valid_lft forever preferred_lft forever
    inet6 fe80::200:5eff:fe00:104/64 scope link tentative
       valid_lft forever preferred_lft forever

The end result would be a dedicated virtual interface with a VIP, sending multicast with the physical interface IP address as the source. Example tcpdump: 05:47:55.248587 00:00:5e:00:01:04 > 01:00:5e:00:00:12, ethertype IPv4 (0x0800), length 54: 144.137.226.17 > 224.0.0.18: VRRPv2, Advertisement, vrid 4, prio 101, authtype none, intvl 1s, length 20

This would allow the real IP and VIP to both be reachable on their respective interface with different MAC addresses.

Thanks for your consideration.

dschultzca avatar Dec 16 '21 17:12 dschultzca