Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nat table by getting the fitting device for an address #9552

Open
wants to merge 2 commits into
base: 4.19
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion systemvm/debian/opt/cloud/bin/cs/CsAddress.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line applies only when private gateway is source nat.

it seems we need to change line 698-700

https://github.com/apache/cloudstack/pull/9552/files#diff-3c470eee70094a82ad3ed790deed16a991e75ed18901cfb82d82a80cd71228a7L698-R700

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'll try and find if we have data on the second IF at that point.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaanHoogland
have you checked the new iptables rules ? do they look good ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try changes on line 698-700
@DaanHoogland

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have a look at those @weizhouapache , they work in my test.

Copy link
Member

@weizhouapache weizhouapache Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like this code snippet (line 554 to 557) can be removed.
It has been covered by line 696-697 (new code)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please ignore my previous comment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to check, for private gateway , is self.dev same as self.address['device'] ?

if self.get_gateway() == self.get_ip_address():
for inf, addresses in self.config.address().dbag.iteritems():
if not inf.startswith("eth"):
Expand Down
Loading