Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT
Hi Andrija, >From what I recall this was not an issue for us on 4.9.x. The problem started >after we've upgraded. We do have a few networks that does require a static >nat, so it is not really an option for us. Its a shame that such an artefact hasn't been identified during the automated / manual testing prior to the release and the fix hasn't been included in the latest point release despite having fixes for over 100 issues, some of which are far less serious. Not too sure what to think of it to be honest. Seems like one step forward, two steps backwards with the new releases ( Andrei - Original Message - > From: "Andrija Panic" > To: "dev" > Sent: Monday, 9 July, 2018 22:39:06 > Subject: Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT > Andrei, if not mistaken I believe I saw same behavior even on 4.8 - in our > case, what I vaguely remember was, that we configure Port Forwarding > instead of Static NAT - it did solve our use case (for some customer), but > maybe it's not acceptable for you... > > Cheers > > On Mon, 9 Jul 2018 at 18:27, Andrei Mikhailovsky > wrote: > >> Hi Rohit, >> >> I would like to send you a quick update on this issue. I have recently >> upgraded to 4.11.1.0 with the new system vm templates. The issue that I've >> described is still present in the latest release. Hasn't it been included >> in the latest 4.11 maintenance release? I thought that it would be as it >> breaks the major function of the VPC. >> >> Cheers. >> >> Andrei >> >> ----- Original Message - >> > From: "Andrei Mikhailovsky" >> > To: "dev" >> > Sent: Friday, 20 April, 2018 11:52:30 >> > Subject: Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT >> >> > Thanks >> > >> > >> > >> > - Original Message - >> >> From: "Rohit Yadav" >> >> To: "dev" , "dev" > > >> >> Sent: Friday, 20 April, 2018 10:35:55 >> >> Subject: Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT >> > >> >> Hi Andrei, >> >> >> >> I've fixed this recently, please see >> >> https://github.com/apache/cloudstack/pull/2579 >> >> >> >> As a workaround you can add routing rules manually. On the PR, there is >> a link >> >> to a comment that explains the issue and suggests manual workaround. >> Let me >> >> know if that works for you. >> >> >> >> Regards. >> >> >> >> >> >> From: Andrei Mikhailovsky >> >> Sent: Friday, 20 April, 2:21 PM >> >> Subject: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT >> >> To: dev >> >> >> >> >> >> Hello, I have been posting to the users thread about this issue. here >> is a quick >> >> summary in case if people contributing to the source nat code on the >> VPC side >> >> would like to fix this issue. Problem summary: no connectivity between >> virtual >> >> machines behind two Static NAT networks. Problem case: When one virtual >> machine >> >> sends a packet to the external address of the another virtual machine >> that are >> >> handled by the same router and both are behind the Static NAT the >> traffic does >> >> not work. 10.1.10.100 10.1.10.1:eth2 eth3:10.1.20.1 10.1.20.100 virt1 >> router >> >> virt2 178.248.108.77:eth1:178.248.108.113 a single packet is send from >> virt1 to >> >> virt2. stage1: it arrives to the router on eth2 and enters >> "nat_PREROUTING" >> >> IN=eth2 OUT= SRC=10.1.10.100 DST=178.248.108.113) goes through the "10 >> 1K DNAT >> >> all -- * * 0.0.0.0/0 178.248.108.113 to:10.1.20.100 " rule and has the >> DST >> >> DNATED to the internal IP of the virt2 stage2: Enters the FORWARDING >> chain and >> >> is being DROPPED by the default policy. DROPPED:IN=eth2 OUT=eth1 >> >> SRC=10.1.10.100 DST=10.1.20.100 The reason being is that the OUT >> interface is >> >> not correctly changed from eth1 to eth3 during the nat_PREROUTING so >> the packet >> >> is not intercepted by the FORWARD rule and thus not accepted. "24 14K >> >> ACL_INBOUND_eth3 all -- * eth3 0.0.0.0/0 10.1.20.0/24" stage3: manually >> >> inserted rule to accept this packet for FORWARDING. the packet enters >> the >> >> "nat_POS
Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT
Andrei, if not mistaken I believe I saw same behavior even on 4.8 - in our case, what I vaguely remember was, that we configure Port Forwarding instead of Static NAT - it did solve our use case (for some customer), but maybe it's not acceptable for you... Cheers On Mon, 9 Jul 2018 at 18:27, Andrei Mikhailovsky wrote: > Hi Rohit, > > I would like to send you a quick update on this issue. I have recently > upgraded to 4.11.1.0 with the new system vm templates. The issue that I've > described is still present in the latest release. Hasn't it been included > in the latest 4.11 maintenance release? I thought that it would be as it > breaks the major function of the VPC. > > Cheers. > > Andrei > > - Original Message - > > From: "Andrei Mikhailovsky" > > To: "dev" > > Sent: Friday, 20 April, 2018 11:52:30 > > Subject: Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT > > > Thanks > > > > > > > > - Original Message ----- > >> From: "Rohit Yadav" > >> To: "dev" , "dev" > > >> Sent: Friday, 20 April, 2018 10:35:55 > >> Subject: Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT > > > >> Hi Andrei, > >> > >> I've fixed this recently, please see > >> https://github.com/apache/cloudstack/pull/2579 > >> > >> As a workaround you can add routing rules manually. On the PR, there is > a link > >> to a comment that explains the issue and suggests manual workaround. > Let me > >> know if that works for you. > >> > >> Regards. > >> > >> > >> From: Andrei Mikhailovsky > >> Sent: Friday, 20 April, 2:21 PM > >> Subject: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT > >> To: dev > >> > >> > >> Hello, I have been posting to the users thread about this issue. here > is a quick > >> summary in case if people contributing to the source nat code on the > VPC side > >> would like to fix this issue. Problem summary: no connectivity between > virtual > >> machines behind two Static NAT networks. Problem case: When one virtual > machine > >> sends a packet to the external address of the another virtual machine > that are > >> handled by the same router and both are behind the Static NAT the > traffic does > >> not work. 10.1.10.100 10.1.10.1:eth2 eth3:10.1.20.1 10.1.20.100 virt1 > router > >> virt2 178.248.108.77:eth1:178.248.108.113 a single packet is send from > virt1 to > >> virt2. stage1: it arrives to the router on eth2 and enters > "nat_PREROUTING" > >> IN=eth2 OUT= SRC=10.1.10.100 DST=178.248.108.113) goes through the "10 > 1K DNAT > >> all -- * * 0.0.0.0/0 178.248.108.113 to:10.1.20.100 " rule and has the > DST > >> DNATED to the internal IP of the virt2 stage2: Enters the FORWARDING > chain and > >> is being DROPPED by the default policy. DROPPED:IN=eth2 OUT=eth1 > >> SRC=10.1.10.100 DST=10.1.20.100 The reason being is that the OUT > interface is > >> not correctly changed from eth1 to eth3 during the nat_PREROUTING so > the packet > >> is not intercepted by the FORWARD rule and thus not accepted. "24 14K > >> ACL_INBOUND_eth3 all -- * eth3 0.0.0.0/0 10.1.20.0/24" stage3: manually > >> inserted rule to accept this packet for FORWARDING. the packet enters > the > >> "nat_POSTROUTING" chain IN= OUT=eth1 SRC=10.1.10.100 DST=10.1.20.100 > and has > >> the SRC changed to the external IP 16 1320 SNAT all -- * eth1 > 10.1.10.100 > >> 0.0.0.0/0 to:178.248.108.77 and is sent to the external network on > eth1. > >> 13:37:44.834341 IP 178.248.108.77 > 10.1.20.100: ICMP echo request, id > 2644, > >> seq 2, length 64 For some reason, during the nat_PREROUTING stage the > DST_IP is > >> changed, but the OUT interface still reflects the interface associated > with the > >> old DST_IP. Here is the routing table # ip route list default via > 178.248.108.1 > >> dev eth1 10.1.10.0/24 dev eth2 proto kernel scope link src 10.1.10.1 > >> 10.1.20.0/24 dev eth3 proto kernel scope link src 10.1.20.1 > 169.254.0.0/16 dev > >> eth0 proto kernel scope link src 169.254.0.5 178.248.108.0/25 dev eth1 > proto > >> kernel scope link src 178.248.108.101 # ip rule list 0: from all lookup > local > >> 32761: from all fwmark 0x3 lookup Table_eth3 32762: from all fwmark 0x2 > lookup > >> Table_eth2 32763: from all fwmark 0x1 lookup Table_eth1 32764: from >
Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT
Hi Rohit, I would like to send you a quick update on this issue. I have recently upgraded to 4.11.1.0 with the new system vm templates. The issue that I've described is still present in the latest release. Hasn't it been included in the latest 4.11 maintenance release? I thought that it would be as it breaks the major function of the VPC. Cheers. Andrei - Original Message - > From: "Andrei Mikhailovsky" > To: "dev" > Sent: Friday, 20 April, 2018 11:52:30 > Subject: Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT > Thanks > > > > - Original Message - >> From: "Rohit Yadav" >> To: "dev" , "dev" >> Sent: Friday, 20 April, 2018 10:35:55 >> Subject: Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT > >> Hi Andrei, >> >> I've fixed this recently, please see >> https://github.com/apache/cloudstack/pull/2579 >> >> As a workaround you can add routing rules manually. On the PR, there is a >> link >> to a comment that explains the issue and suggests manual workaround. Let me >> know if that works for you. >> >> Regards. >> >> >> From: Andrei Mikhailovsky >> Sent: Friday, 20 April, 2:21 PM >> Subject: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT >> To: dev >> >> >> Hello, I have been posting to the users thread about this issue. here is a >> quick >> summary in case if people contributing to the source nat code on the VPC side >> would like to fix this issue. Problem summary: no connectivity between >> virtual >> machines behind two Static NAT networks. Problem case: When one virtual >> machine >> sends a packet to the external address of the another virtual machine that >> are >> handled by the same router and both are behind the Static NAT the traffic >> does >> not work. 10.1.10.100 10.1.10.1:eth2 eth3:10.1.20.1 10.1.20.100 virt1 router >> virt2 178.248.108.77:eth1:178.248.108.113 a single packet is send from virt1 >> to >> virt2. stage1: it arrives to the router on eth2 and enters "nat_PREROUTING" >> IN=eth2 OUT= SRC=10.1.10.100 DST=178.248.108.113) goes through the "10 1K >> DNAT >> all -- * * 0.0.0.0/0 178.248.108.113 to:10.1.20.100 " rule and has the DST >> DNATED to the internal IP of the virt2 stage2: Enters the FORWARDING chain >> and >> is being DROPPED by the default policy. DROPPED:IN=eth2 OUT=eth1 >> SRC=10.1.10.100 DST=10.1.20.100 The reason being is that the OUT interface is >> not correctly changed from eth1 to eth3 during the nat_PREROUTING so the >> packet >> is not intercepted by the FORWARD rule and thus not accepted. "24 14K >> ACL_INBOUND_eth3 all -- * eth3 0.0.0.0/0 10.1.20.0/24" stage3: manually >> inserted rule to accept this packet for FORWARDING. the packet enters the >> "nat_POSTROUTING" chain IN= OUT=eth1 SRC=10.1.10.100 DST=10.1.20.100 and has >> the SRC changed to the external IP 16 1320 SNAT all -- * eth1 10.1.10.100 >> 0.0.0.0/0 to:178.248.108.77 and is sent to the external network on eth1. >> 13:37:44.834341 IP 178.248.108.77 > 10.1.20.100: ICMP echo request, id 2644, >> seq 2, length 64 For some reason, during the nat_PREROUTING stage the DST_IP >> is >> changed, but the OUT interface still reflects the interface associated with >> the >> old DST_IP. Here is the routing table # ip route list default via >> 178.248.108.1 >> dev eth1 10.1.10.0/24 dev eth2 proto kernel scope link src 10.1.10.1 >> 10.1.20.0/24 dev eth3 proto kernel scope link src 10.1.20.1 169.254.0.0/16 >> dev >> eth0 proto kernel scope link src 169.254.0.5 178.248.108.0/25 dev eth1 proto >> kernel scope link src 178.248.108.101 # ip rule list 0: from all lookup local >> 32761: from all fwmark 0x3 lookup Table_eth3 32762: from all fwmark 0x2 >> lookup >> Table_eth2 32763: from all fwmark 0x1 lookup Table_eth1 32764: from >> 10.1.0.0/16 >> lookup static_route_back 32765: from 10.1.0.0/16 lookup static_route 32766: >> from all lookup main 32767: from all lookup default Further into the >> investigation, the problem was pinned down to those rules. All the traffic >> from >> internal IP on the static NATed connection were forced to go to the outside >> interface (eth1), by setting the mark 0x1 and then using the matching # ip >> rule >> to direct it. #iptables -t mangle -L PREROUTING -vn Chain PREROUTING (policy >> ACCEPT 97 packets, 11395 bytes) pkts bytes target prot opt in out source >> destination 49 3644 CONNMARK all -- * * 1
Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT
Thanks - Original Message - > From: "Rohit Yadav" > To: "dev" , "dev" > Sent: Friday, 20 April, 2018 10:35:55 > Subject: Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT > Hi Andrei, > > I've fixed this recently, please see > https://github.com/apache/cloudstack/pull/2579 > > As a workaround you can add routing rules manually. On the PR, there is a link > to a comment that explains the issue and suggests manual workaround. Let me > know if that works for you. > > Regards. > > > From: Andrei Mikhailovsky > Sent: Friday, 20 April, 2:21 PM > Subject: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT > To: dev > > > Hello, I have been posting to the users thread about this issue. here is a > quick > summary in case if people contributing to the source nat code on the VPC side > would like to fix this issue. Problem summary: no connectivity between virtual > machines behind two Static NAT networks. Problem case: When one virtual > machine > sends a packet to the external address of the another virtual machine that are > handled by the same router and both are behind the Static NAT the traffic does > not work. 10.1.10.100 10.1.10.1:eth2 eth3:10.1.20.1 10.1.20.100 virt1 router > virt2 178.248.108.77:eth1:178.248.108.113 a single packet is send from virt1 > to > virt2. stage1: it arrives to the router on eth2 and enters "nat_PREROUTING" > IN=eth2 OUT= SRC=10.1.10.100 DST=178.248.108.113) goes through the "10 1K DNAT > all -- * * 0.0.0.0/0 178.248.108.113 to:10.1.20.100 " rule and has the DST > DNATED to the internal IP of the virt2 stage2: Enters the FORWARDING chain and > is being DROPPED by the default policy. DROPPED:IN=eth2 OUT=eth1 > SRC=10.1.10.100 DST=10.1.20.100 The reason being is that the OUT interface is > not correctly changed from eth1 to eth3 during the nat_PREROUTING so the > packet > is not intercepted by the FORWARD rule and thus not accepted. "24 14K > ACL_INBOUND_eth3 all -- * eth3 0.0.0.0/0 10.1.20.0/24" stage3: manually > inserted rule to accept this packet for FORWARDING. the packet enters the > "nat_POSTROUTING" chain IN= OUT=eth1 SRC=10.1.10.100 DST=10.1.20.100 and has > the SRC changed to the external IP 16 1320 SNAT all -- * eth1 10.1.10.100 > 0.0.0.0/0 to:178.248.108.77 and is sent to the external network on eth1. > 13:37:44.834341 IP 178.248.108.77 > 10.1.20.100: ICMP echo request, id 2644, > seq 2, length 64 For some reason, during the nat_PREROUTING stage the DST_IP > is > changed, but the OUT interface still reflects the interface associated with > the > old DST_IP. Here is the routing table # ip route list default via > 178.248.108.1 > dev eth1 10.1.10.0/24 dev eth2 proto kernel scope link src 10.1.10.1 > 10.1.20.0/24 dev eth3 proto kernel scope link src 10.1.20.1 169.254.0.0/16 dev > eth0 proto kernel scope link src 169.254.0.5 178.248.108.0/25 dev eth1 proto > kernel scope link src 178.248.108.101 # ip rule list 0: from all lookup local > 32761: from all fwmark 0x3 lookup Table_eth3 32762: from all fwmark 0x2 lookup > Table_eth2 32763: from all fwmark 0x1 lookup Table_eth1 32764: from > 10.1.0.0/16 > lookup static_route_back 32765: from 10.1.0.0/16 lookup static_route 32766: > from all lookup main 32767: from all lookup default Further into the > investigation, the problem was pinned down to those rules. All the traffic > from > internal IP on the static NATed connection were forced to go to the outside > interface (eth1), by setting the mark 0x1 and then using the matching # ip > rule > to direct it. #iptables -t mangle -L PREROUTING -vn Chain PREROUTING (policy > ACCEPT 97 packets, 11395 bytes) pkts bytes target prot opt in out source > destination 49 3644 CONNMARK all -- * * 10.1.10.100 0.0.0.0/0 state NEW > CONNMARK save 37 2720 MARK all -- * * 10.1.20.100 0.0.0.0/0 state NEW MARK set > 0x1 37 2720 CONNMARK all -- * * 10.1.20.100 0.0.0.0/0 state NEW CONNMARK save > 114 8472 MARK all -- * * 10.1.10.100 0.0.0.0/0 state NEW MARK set 0x1 114 8472 > CONNMARK all -- * * 10.1.10.100 0.0.0.0/0 state NEW CONNMARK save # ip rule 0: > from all lookup local 32761: from all fwmark 0x3 lookup Table_eth3 32762: from > all fwmark 0x2 lookup Table_eth2 32763: from all fwmark 0x1 lookup Table_eth1 > 32764: from 10.1.0.0/16 lookup static_route_back 32765: from 10.1.0.0/16 > lookup > static_route 32766: from all lookup main 32767: from all lookup default The > acceptable solution is to delete those rules all together.? The problem with > such approach is that the inter VPC traffic will use the internal IP > addresses, > so the packets going from 178.248.108.77 to 178.248.108.113 would be seen as > communication between 1
Re: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT
Hi Andrei, I've fixed this recently, please see https://github.com/apache/cloudstack/pull/2579 As a workaround you can add routing rules manually. On the PR, there is a link to a comment that explains the issue and suggests manual workaround. Let me know if that works for you. Regards. From: Andrei Mikhailovsky Sent: Friday, 20 April, 2:21 PM Subject: Upgrade from ACS 4.9.X to 4.11.0 broke VPC source NAT To: dev Hello, I have been posting to the users thread about this issue. here is a quick summary in case if people contributing to the source nat code on the VPC side would like to fix this issue. Problem summary: no connectivity between virtual machines behind two Static NAT networks. Problem case: When one virtual machine sends a packet to the external address of the another virtual machine that are handled by the same router and both are behind the Static NAT the traffic does not work. 10.1.10.100 10.1.10.1:eth2 eth3:10.1.20.1 10.1.20.100 virt1 router virt2 178.248.108.77:eth1:178.248.108.113 a single packet is send from virt1 to virt2. stage1: it arrives to the router on eth2 and enters "nat_PREROUTING" IN=eth2 OUT= SRC=10.1.10.100 DST=178.248.108.113) goes through the "10 1K DNAT all -- * * 0.0.0.0/0 178.248.108.113 to:10.1.20.100 " rule and has the DST DNATED to the internal IP of the virt2 stage2: Enters the FORWARDING chain and is being DROPPED by the default policy. DROPPED:IN=eth2 OUT=eth1 SRC=10.1.10.100 DST=10.1.20.100 The reason being is that the OUT interface is not correctly changed from eth1 to eth3 during the nat_PREROUTING so the packet is not intercepted by the FORWARD rule and thus not accepted. "24 14K ACL_INBOUND_eth3 all -- * eth3 0.0.0.0/0 10.1.20.0/24" stage3: manually inserted rule to accept this packet for FORWARDING. the packet enters the "nat_POSTROUTING" chain IN= OUT=eth1 SRC=10.1.10.100 DST=10.1.20.100 and has the SRC changed to the external IP 16 1320 SNAT all -- * eth1 10.1.10.100 0.0.0.0/0 to:178.248.108.77 and is sent to the external network on eth1. 13:37:44.834341 IP 178.248.108.77 > 10.1.20.100: ICMP echo request, id 2644, seq 2, length 64 For some reason, during the nat_PREROUTING stage the DST_IP is changed, but the OUT interface still reflects the interface associated with the old DST_IP. Here is the routing table # ip route list default via 178.248.108.1 dev eth1 10.1.10.0/24 dev eth2 proto kernel scope link src 10.1.10.1 10.1.20.0/24 dev eth3 proto kernel scope link src 10.1.20.1 169.254.0.0/16 dev eth0 proto kernel scope link src 169.254.0.5 178.248.108.0/25 dev eth1 proto kernel scope link src 178.248.108.101 # ip rule list 0: from all lookup local 32761: from all fwmark 0x3 lookup Table_eth3 32762: from all fwmark 0x2 lookup Table_eth2 32763: from all fwmark 0x1 lookup Table_eth1 32764: from 10.1.0.0/16 lookup static_route_back 32765: from 10.1.0.0/16 lookup static_route 32766: from all lookup main 32767: from all lookup default Further into the investigation, the problem was pinned down to those rules. All the traffic from internal IP on the static NATed connection were forced to go to the outside interface (eth1), by setting the mark 0x1 and then using the matching # ip rule to direct it. #iptables -t mangle -L PREROUTING -vn Chain PREROUTING (policy ACCEPT 97 packets, 11395 bytes) pkts bytes target prot opt in out source destination 49 3644 CONNMARK all -- * * 10.1.10.100 0.0.0.0/0 state NEW CONNMARK save 37 2720 MARK all -- * * 10.1.20.100 0.0.0.0/0 state NEW MARK set 0x1 37 2720 CONNMARK all -- * * 10.1.20.100 0.0.0.0/0 state NEW CONNMARK save 114 8472 MARK all -- * * 10.1.10.100 0.0.0.0/0 state NEW MARK set 0x1 114 8472 CONNMARK all -- * * 10.1.10.100 0.0.0.0/0 state NEW CONNMARK save # ip rule 0: from all lookup local 32761: from all fwmark 0x3 lookup Table_eth3 32762: from all fwmark 0x2 lookup Table_eth2 32763: from all fwmark 0x1 lookup Table_eth1 32764: from 10.1.0.0/16 lookup static_route_back 32765: from 10.1.0.0/16 lookup static_route 32766: from all lookup main 32767: from all lookup default The acceptable solution is to delete those rules all together.? The problem with such approach is that the inter VPC traffic will use the internal IP addresses, so the packets going from 178.248.108.77 to 178.248.108.113 would be seen as communication between 10.1.10.100 and 10.1.20.100 thus we need to apply further two rules # iptables -t nat -I POSTROUTING -o eth3 -s 10.1.10.0/24 -d 10.1.20.0/24 -j SNAT --to-source 178.248.108.77 # iptables -t nat -I POSTROUTING -o eth2 -s 10.1.20.0/24 -d 10.1.10.0/24 -j SNAT --to-source 178.248.108.113 in order to make sure that the packets leaving the router would have correct source IP. This way it is possible to have static NAT on all of the IPS within the VPC and ensure a successful communication between them. So, for a quick and dirty fix, we ran this command on the VR: for i in iptables -t mangle -L PREROUTING -vn | awk '/0x1/ && !/eth1/ {print $8}';