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

More generic NAT and TCP #4

Open
4t0m1k opened this issue Mar 26, 2018 · 2 comments
Open

More generic NAT and TCP #4

4t0m1k opened this issue Mar 26, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@4t0m1k
Copy link

4t0m1k commented Mar 26, 2018

Hello and thank you for this awesome extension!

Why do not make this extension more generic, for example naming it "TNAT" (for Typed NAT) and with this syntax:

iptables -t nat -A POSTROUTING -o eth0 -j TNAT --type [ full | port_restricted | address_restricted | symmetric ]
iptables -t nat -A PREROUTING -i eth0 -j TNAT (not needed to repeat type param as it is saved in context)

So, for full cone nat, you just have to do:

iptables -t nat -A POSTROUTING -o eth0 -j TNAT --type full
iptables -t nat -A PREROUTING -i eth0 -j TNAT

you do not have to change the mapping structure, only to check by ext port, then check the type and reject the packet in the hook if:

  • prerouting source port different from postrouting dest port && type == port_restricted || symmetric
  • prerouting source addr different from postrouting dest addr && type == addr_restricted || symmetric

What do you think about this?

Another question : When do you think TCP full cone NAT will be available? How much work to do?

Thank you!

@Chion82 Chion82 added the enhancement New feature or request label Mar 28, 2018
@Chion82
Copy link
Owner

Chion82 commented Mar 28, 2018

Hi, thanks for your advices.

Extending this module to support various NAT types and TCP sounds great and actually it's part of my plan. Maybe I will create a new module in another repository to do that in the future.

For now let's just focus on this particular extension module. As you can see there are still many potential issues for this module whose implementation is actually a dirty hack. When this module becomes more stable and well tested, we will start working on the TNAT stuff.

@4t0m1k
Copy link
Author

4t0m1k commented Mar 28, 2018

Thanks for your response !

You're right there will be another time for that. Keep up the good work !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants