Natter icon indicating copy to clipboard operation
Natter copied to clipboard

Fix problem when rules missing in PREROUTING

Open wydy opened this issue 5 months ago • 0 comments

Sometimes the rules in PREROUTING and POSTROUTING are broken by another program. To solve this problem, the existence of a NATTER chain is no longer checked. Now Natter will always try to create all rules to be used.

Add the InputRule.iptables / InputRule.nftables method to prevent duplicate rules from being created.

Also fix the chain used with DNAT and SNAT according to the document of iptables and nftables. See the schematic below, DNAT has been tested on system with iptables and nftables. However, it is not certain that SNAT will work correctly, and further testing is needed. image

There are also problems that need to be solved when the nftables of many systems do not create chains such as ip nat prerouting by default, and running natter on these systems will result in errors. But I'm not sure if I should let natter create these chains, or write the relevant content into a readme and leave it up to the user to create them.

Finally, a one-second pause was added before port testing (line 1786) to wait for external software to start the port when port forwarding is enabled, preventing the test from showing the port as closed.

wydy avatar Sep 22 '24 20:09 wydy