You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
4.11.2 HA VRs with Second Public NIC get different routes between Startup and Failover #3353
When a network has public IPs from multiple ranges and a VM has a Static NAT rule from the second IP range (different range from the Source NAT IP), the outbound IP changes when a VR fails over. This is because default routes for each interface are not restored when a failover occurs, but are added correctly when the VR is built.
STEPS TO REPRODUCE
Create zone with 2 or more public IP ranges
Create an advanced network, allocate IPs until you get IPs from both networks (or use the database to assign a specific IP)
Create a VM and assign a Static NAT IP to the IP from the second range
Reboot both VRs at the same time to get a "clean" situation
Log into Master VR
Run ip route table list all > /root/route.1
Run systemctl restart keepalived to force a failover without rebuilding VR
Log into the new VR and fail back using systemctl restart keepalived
Run ip route table list all > /root/route.2
Compare routing tables with diff /root/route.1 /root/route.2
EXPECTED RESULTS
Routing table should be identical between first build and failover
ACTUAL RESULTS
Default routes for each interface were missing, resulting in the outgoing traffic from the VM with static NAT originating from the Source NAT IP
# diff /root/route.1 /root/route.2
2d1
< default via X.X.X.X dev eth2 table Table_eth2 proto static
6d4
< default via X.X.X.X dev eth3 table Table_eth3 proto static
We are able to fix this manually by re-adding the route:
ip route add default via X.X.X.X table Table_eth3 proto static
NB - the eth2 route doesn't seem to be necessary, but adding the eth3 route fixes the originating IPs.
This is one of the issues that happen on network/vpc with public IPs in mutiple subnets.
We have seen many issues in this scenario from 4.7. Some have already been fixed. Some issue still exist
I've found some additional cases where routes aren't added properly, leading to two additional problems with static NAT VMs with multiple public subnets:
VMs with static NAT IPs on range corresponding to eth3 cannot ping other IPs from another network on the same range
VMs cannot always ping each other using their external IP address. This one I know has been fixed before, so this is either a regression or a missed test case.
I traced the cause of these to be here. The intention of the code is that it runs when the first IP address is added, however in practice this means it only runs when there is one IP assigned to the interface - if you start the VR with multiple IPs present then the route is added correctly.
The route table of a "broken" router looks like this:
# ip route show table Table_eth3
default via X.X.X.X dev eth3 proto static
throw X.X.X.X/Y proto static
The fixed version is:
# ip route show table Table_eth3
default via X.X.X.X dev eth3 proto static
throw X.X.X.X/Y proto static
throw 10.1.1.0/24 proto static
throw 169.254.0.0/16 proto static
My current working code is by changing the affected block to:
if self.get_type() in ["public"]:
route.set_route("table %s throw %s proto static" % (tableName, self.config.address().dbag['eth0'][0]['network']))
route.set_route("table %s throw %s proto static" % (tableName, self.config.address().dbag['eth1'][0]['network']))
Once we're done rolling this out, I'm happy to put together a PR, but I'm very aware that the VR code contains quite a few different scenarios, and I'm not yet familiar with how to write tests for this functionality.
Activity
ustcweizhou commentedon May 24, 2019
This is one of the issues that happen on network/vpc with public IPs in mutiple subnets.
We have seen many issues in this scenario from 4.7. Some have already been fixed. Some issue still exist
richardlawley commentedon May 24, 2019
These routes also get restored when a new static NAT association is made.
richardlawley commentedon May 28, 2019
I've found some additional cases where routes aren't added properly, leading to two additional problems with static NAT VMs with multiple public subnets:
I traced the cause of these to be here. The intention of the code is that it runs when the first IP address is added, however in practice this means it only runs when there is one IP assigned to the interface - if you start the VR with multiple IPs present then the route is added correctly.
The route table of a "broken" router looks like this:
The fixed version is:
My current working code is by changing the affected block to:
Once we're done rolling this out, I'm happy to put together a PR, but I'm very aware that the VR code contains quite a few different scenarios, and I'm not yet familiar with how to write tests for this functionality.
systemvm: fix VR issues with Multiple Public Subnets (#3361)
systemvm: fix VR issues with Multiple Public Subnets (apache#3361)