@@ -351,6 +351,33 @@ def set_master(self):
351351
352352 interfaces = [interface for interface in self .address .get_interfaces () if interface .is_public ()]
353353 CsHelper .reconfigure_interfaces (self .cl , interfaces )
354+
355+ public_devices = list (set ([interface .get_device () for interface in interfaces ]))
356+ if len (public_devices ) > 1 :
357+ # Handle specific failures when multiple public interfaces
358+
359+ public_devices .sort ()
360+
361+ # Ensure the default route is added, or outgoing traffic from VMs with static NAT on
362+ # the subsequent interfaces will go from he wrong IP
363+ route = CsRoute ()
364+ dev = ''
365+ for interface in interfaces :
366+ if dev == interface .get_device ():
367+ continue
368+ dev = interface .get_device ()
369+ gateway = interface .get_gateway ()
370+ if gateway :
371+ route .add_route (dev , gateway )
372+
373+ # The first public interface has a static MAC address between VRs. Subsequent ones don't,
374+ # so an ARP announcement is needed on failover
375+ for device in public_devices [1 :]:
376+ logging .info ("Sending garp messages for IPs on %s" % device )
377+ for interface in interfaces :
378+ if interface .get_device () == device :
379+ CsHelper .execute ("arping -I %s -U %s -c 1" % (device , interface .get_ip ()))
380+
354381 logging .info ("Router switched to master mode" )
355382
356383 def _collect_ignore_ips (self ):
0 commit comments