You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "weizhouapache (via GitHub)" <gi...@apache.org> on 2025/04/16 11:24:51 UTC

Re: [PR] fix nat table by getting the fitting device for an address [cloudstack]

weizhouapache commented on code in PR #9552:
URL: https://github.com/apache/cloudstack/pull/9552#discussion_r2046715093


##########
systemvm/debian/opt/cloud/bin/cs/CsAddress.py:
##########
@@ -554,7 +554,7 @@ def fw_vpcrouter(self):
             if self.address["source_nat"]:
                 self.fw.append(["nat", "front",
                                 "-A POSTROUTING -o %s -j SNAT --to-source %s" %
-                                (self.dev, self.address['public_ip'])])
+                                (self.address['device'], self.address['public_ip'])])

Review Comment:
   I created a private gateway, checked the /etc/cloudstack/ips.json
   
   the device name and "device" of ip address are the same (both are "eth3" in my example below). 
   it is good to use `self.address['device']`
   
   ```
     "eth3": [
       {
         "add": true,
         "broadcast": "10.200.1.255",
         "cidr": "10.200.1.1/24",
         "device": "eth3",
         "first_i_p": false,
         "gateway": "10.200.1.1",
         "is_private_gateway": true,
         "netmask": "255.255.255.0",
         "network": "10.200.1.0/24",
         "new_nic": false,
         "nic_dev_id": 3,
         "nw_type": "public",
         "one_to_one_nat": false,
         "public_ip": "10.200.1.1",
         "size": "24",
         "source_nat": true,
         "vif_mac_address": "1e:00:2a:00:03:c1"
       }
     ],
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org