Site Tools


advanced-firewall

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
advanced-firewall [2026/11/10 20:14] – [NAT] hogwildadvanced-firewall [2026/11/10 22:42] (current) – [NAT] -Condense, format NAT loopback table contents hogwild
Line 55: Line 55:
  
 **NAT loopback:** NAT Loopback (Hairpinning) logic is implemented in the firewall subsystem using iptables rules. These rules are applied to the PREROUTING and POSTROUTING NAT table chains. **NAT loopback:** NAT Loopback (Hairpinning) logic is implemented in the firewall subsystem using iptables rules. These rules are applied to the PREROUTING and POSTROUTING NAT table chains.
 +
 +This table explains the options availabe for NAT loopback:
 +
 + \\
 +
 +^  Mode  ^  Behavior  ^  Advantages  ^  Disadvantages  ^
 +| **All** | Any LAN traffic sent to the router’s WAN IP is looped back to the router or LAN destination, regardless of whether a port-forward rule exists. | “Just works” for all services, including UPnP-mapped ports and DMZ hosts.No per-port forwarding needed.The only mode that supports administering the router via its WAN interface from the LAN. | Adds NAT rule-matching overhead for all LAN-to-WAN-IP traffic.Bypasses hardware NAT/cut-through acceleration. Rarely, can cause loops or routing instability in dual-router, wireless bridge, or multi-subnet setups. |
 +| **Forwarded Only** (default) | Loopback translation applies only to LAN traffic targeting WAN-IP ports that have explicit Port Forwarding rules. Other WAN-IP ports are rejected or dropped. | Provides security and control by preventing LAN access to non-forwarded portsLimits loopback processing to only the required ports, improving efficiency. | Does not work for dynamic or non-forwarded services, such as UPnP-opened ports or some DMZ configurations; also cannot access the router admin interface via the WAN IP from the LAN. |
 +| **Disabled** | No loopback NAT rules are added.LAN traffic destined for the router’s public WAN IP or DDNS name is dropped or rejected. | Creates the lowest CPU load and maximum throughput because no extra NAT inspection or packet rewriting occurs.Enforces clearer network-boundary separation. | LAN devices cannot access local servers through the public domain name/public WAN IP, nor reach the router admin interface via the WAN interface. |
  
 \\ \\
  
-  - <All>\\ Under the Hood, in iptables, FreshTomato inserts a blanket PREROUTING NAT rule matching all traffic from the LAN aimed at the WAN IP address. This happens whether or not a port forwarding rule exists. \\ \\ Behavior: Any LAN connection sent to the WAN IP (only to the WAN IP, not the Internet) is looped back to the router or LAN destination. \\ \\ Advantages:  "It just works". This applies to UPnP mapped ports, DMZ hosts, and all services. No individual ports need to be forwarded. \\ Only this mode supports administering the router on the WAN interface from the LAN. \\ \\ Disadvantages:  Minor performance Bottlenecks. Every single piece of LAN-to-"WAN-IP" traffic runs through blanket SNAT/DNAT rule-matching cycles. It bypasses hardware NAT/Cut-Through Forwarding) acceleration. NOTE: this is to the WAN-IP **not** the Internet! \\ \\ Disadvantages: Unintended Loops/Routing Anomalies (rare): Can cause severe instability or packet loops when using dual routers, wireless bridges, or complex multi-subnets. \\ \\  +  * <All>\\ Under the Hood, in iptables, FreshTomato inserts a blanket PREROUTING NAT rule matching all traffic from the LAN aimed at the WAN IP address. This happens whether or not a port forwarding rule exists. \\ \\ Behavior: Any LAN connection sent to the WAN IP (only to the WAN IP, not the Internet) is looped back to the router or LAN destination. \\ \\ Advantages:  "It just works". This applies to UPnP mapped ports, DMZ hosts, and all services. No individual ports need to be forwarded. \\ Only this mode supports administering the router on the WAN interface from the LAN. \\ \\ Disadvantages:  Minor performance Bottlenecks. Every single piece of LAN-to-"WAN-IP" traffic runs through blanket SNAT/DNAT rule-matching cycles. It bypasses hardware NAT/Cut-Through Forwarding) acceleration. Note that this is to the WAN-IP **not** the Internet! \\ \\ Disadvantages: Unintended Loops/Routing Anomalies (rare): Can cause severe instability or packet loops when using dual routers, wireless bridges, or complex multi-subnets.\\ \\ 
-  - <Forwarded Only> (default)  \\ \\ Under the Hood (in iptables), FreshTomato's rules apply loopback translation only to traffic aimed at ports explicitly defined in Port Forwarding rules. This setting matches LAN traffic destined for WAN_IP:PORT only if PORT exists in NAT PREROUTING / port-forwarding tables. Essentially, these are ports defined in the Port Forwarding menu. \\ \\ Behavior: If you forward port 8443 to an internal server at 192.168.1.10:443, a LAN device reaching out to "()" gets rewritten and looped back to the LAN. However, if you try to reach "()" [a port with no active forward rule], it is rejected/dropped. \\ \\ Advantages: Security & Control. This option prevents local LAN traffic from hitting closed or non-forwarded router ports via the external WAN identity.\\  Performance: Limits loopback processing overhead to explicitly required ports only. \\ \\ Disadvantages: This option won't work for dynamic/non-forwarded services (such as UPnP-opened ports or some DMZ configurations). It also won't work for the administration web interface when called on the WAN from a LAN device. \\  \\  + 
-  - <Disabled> \\ Under the Hood (in iptables), FreshTomato omits loopback rules in the NAT chains. \\ \\ Behavior: When a LAN client sends traffic destined for the router’s public WAN IP (or DDNS domain), the router receives it, sees there's no active rule translating LAN traffic back into the LAN, then drops or rejects the traffic. \\ \\ Pros: This option has the lowest router CPU load and maximum throughput. This is because LAN traffic undergoes zero extra NAT inspection or packet rewriting. \\ This option also forces proper network boundary segregation. \\ Cons: - LAN devices cannot access local servers using public domain names or public IP addresses nor the router admin interface on the WAN. \\ \\ \\+  * <Forwarded Only>\\ \\ Under the Hood (in iptables), FreshTomato's rules apply loopback translation only to traffic aimed at ports explicitly defined in Port Forwarding rules. This setting matches LAN traffic destined for WAN_IP:PORT only if PORT exists in NAT PREROUTING / port-forwarding tables. Essentially, these are ports defined in the Port Forwarding menu. \\ \\ Behavior: If you forward port 8443 to an internal server at 192.168.1.10:443, a LAN device reaching out to "()" gets rewritten and looped back to the LAN. However, if you try to reach "()" [a port with no active forward rule], it is rejected/dropped. \\ \\ Advantages: \\ Security & Control. This option prevents local LAN traffic from hitting closed or non-forwarded router ports via the external WAN identity. \\  
 +  * Performance: Limits loopback processing overhead to explicitly required ports only. \\ \\ Disadvantages: This option won't work for dynamic/non-forwarded services (such as UPnP-opened ports or some DMZ configurations). It also won't work for the administration web interface when called on the WAN from a LAN device. \\  \\  
 +  * <Disabled> (default)\\ Under the Hood (in iptables), FreshTomato omits loopback rules in the NAT chains. \\ \\ Behavior: When a LAN client sends traffic destined for the router’s public WAN IP (or DDNS domain), the router receives it, sees there's no active rule translating LAN traffic back into the LAN, then drops or rejects the traffic. \\ \\ Pros: This option has the lowest router CPU load and maximum throughput. This is because LAN traffic undergoes zero extra NAT inspection or packet rewriting. \\ This option also forces proper network boundary segregation. \\ \\ Cons: LAN devices cannot access local servers using public domain names or public IP addresses nor the router admin interface on the WAN. \\ \\ \\
  
 {{::advanced-firewall-nat-2024.1.png?361}} {{::advanced-firewall-nat-2024.1.png?361}}
advanced-firewall.1794341696.txt.gz · Last modified: by hogwild