Skip to content

Commit 70f2420

Browse files
raveningRakesh Venkatesh
andauthored
router: Use source IP from subnet for snat (#5376)
When snat is configured on a vm in a subnet then the source ip should be taken from the same subnet rather than from random other subnet. Co-authored-by: Rakesh Venkatesh <rakeshv@apache.org>
1 parent 989a468 commit 70f2420

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

systemvm/debian/opt/cloud/bin/configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ def processStaticNatRule(self, rule):
10081008

10091009
# Configure the hairpin snat
10101010
self.fw.append(["nat", "front", "-A POSTROUTING -s %s -d %s -j SNAT -o %s --to-source %s" %
1011-
(self.getNetworkByIp(rule['internal_ip']), rule["internal_ip"], self.getDeviceByIp(rule["internal_ip"]), self.getGuestIp())])
1011+
(self.getNetworkByIp(rule['internal_ip']), rule["internal_ip"], self.getDeviceByIp(rule["internal_ip"]), self.getGuestIpByIp(rule["internal_ip"]))])
10121012

10131013

10141014
class IpTablesExecutor:

0 commit comments

Comments
 (0)