mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	Fix Policy Based Routing for private gateway static routes (#3604)
* Fix for routing table issue with NAT interfaces * Mark only packets with the public ip as destination
This commit is contained in:
		
							parent
							
								
									7a25e40d5a
								
							
						
					
					
						commit
						82d94a87c5
					
				@ -941,11 +941,11 @@ class CsForwardingRules(CsDataBag):
 | 
			
		||||
            raise Exception("Ip address %s has no device in the ips databag" % rule["public_ip"])
 | 
			
		||||
 | 
			
		||||
        self.fw.append(["mangle", "front",
 | 
			
		||||
                        "-A PREROUTING -s %s/32 -m state --state NEW -j CONNMARK --save-mark --nfmask 0xffffffff --ctmask 0xffffffff" %
 | 
			
		||||
                        rule["internal_ip"]])
 | 
			
		||||
                        "-A PREROUTING -d %s/32 -m state --state NEW -j CONNMARK --save-mark --nfmask 0xffffffff --ctmask 0xffffffff" %
 | 
			
		||||
                        rule["public_ip"]])
 | 
			
		||||
        self.fw.append(["mangle", "front",
 | 
			
		||||
                        "-A PREROUTING -s %s/32 -m state --state NEW -j MARK --set-xmark %s/0xffffffff" %
 | 
			
		||||
                        (rule["internal_ip"], hex(100 + int(device[len("eth"):])))])
 | 
			
		||||
                        "-A PREROUTING -d %s/32 -m state --state NEW -j MARK --set-xmark %s/0xffffffff" %
 | 
			
		||||
                        (rule["public_ip"], hex(100 + int(device[len("eth"):])))])
 | 
			
		||||
        self.fw.append(["nat", "front",
 | 
			
		||||
                        "-A PREROUTING -d %s/32 -j DNAT --to-destination %s" % (rule["public_ip"], rule["internal_ip"])])
 | 
			
		||||
        self.fw.append(["nat", "front",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user