-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix nat table by getting the fitting device for an address #9552
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
base: 4.19
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 4.19 #9552 +/- ##
============================================
- Coverage 15.08% 15.08% -0.01%
- Complexity 11184 11185 +1
============================================
Files 5406 5406
Lines 472889 472915 +26
Branches 57738 57661 -77
============================================
+ Hits 71352 71354 +2
- Misses 393593 393617 +24
Partials 7944 7944
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@DaanHoogland Assume there are two public IPs in the VPC VR (and isolated network VR):
I think the expected behaviour should be
currently the rules are
seems better to change to
or
to be discussed |
elif cmdline.get_source_nat_ip() and not self.is_private_gateway(): | ||
self.fw.append( | ||
["nat", "", "-A POSTROUTING -j SNAT -o %s --to-source %s" % (self.dev, cmdline.get_source_nat_ip())]) | ||
self.fw.append( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there are multiple public ips (in multiple ranges), will there be same amount of rules ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I understand the question. I checked this in a lab env and the resulting nat table was exactly as described in the issue, with only the last line being different. Ar you considdering another configuration here @weizhouapache ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for each public ip (and private gateway), there will be a rule below, right ?
-A POSTROUTING -j SNAT -o ethX --to-source xx.yy.zz.xx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DaanHoogland
to be clear, we need a rule for each public NIC, for example
-A POSTROUTING -j SNAT -o eth1 --to-source <source nat IP> # this is for source nat NIC
-A POSTROUTING -j SNAT -o eth5 --to-source <first public IP on eth5> # this is for additional public NIC
If I understand correctly, for the current changes , the rules are for example,
-A POSTROUTING -j SNAT -o eth1 --to-source <source nat IP> # this is for source nat NIC
-A POSTROUTING -j SNAT -o eth1 --to-source <second IP on source nat NIC> # this is for source nat NIC
-A POSTROUTING -j SNAT -o eth1 --to-source <third IP on source nat NIC> # this is for source nat NIC
-A POSTROUTING -j SNAT -o eth5 --to-source <first public IP on eth5> # this is for additional public NIC
-A POSTROUTING -j SNAT -o eth5 --to-source <second public IP on eth5> # this is for additional public NIC
-A POSTROUTING -j SNAT -o eth5 --to-source <third public IP on eth5> # this is for additional public NIC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll verify that. Do you happen to know what condition to test for? I don't think the self.address
object contains information on whether it is the first IP, does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the original issue does not exist in our lab (I can verify with infra).
we can only verify the iptables rules in the VR
- create 2 public ip ranges with different vlan
- acquire 3 public ips on each public ip and use them for static/pf/lb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I'll give it a try
minor issue, moving forward |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12440 |
@DaanHoogland any update on this one? |
@Pearl1594 , no priority and no definite proof it works yet. I will revisit later. cc @weizhouapache |
tested this PR with a VPC
main difference with iptables
the issue #8562 fixed by #8599 will come back |
@weizhouapache , sounds like it is impossible (both put snat for the secondary ip on its own interface and on the primary interface) So how about making the heath check script accept this situation somehow? |
Description
This PR...
Fixes: #9473
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?