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 [2024/11/10 20:23] – [Firewall] -Define Smart MTU Black Hole Detection, and add link hogwildadvanced-firewall [2026/09/30 12:59] (current) – [NAT] rs232
Line 2: Line 2:
  
 The Firewall page allows you to configure options to protect or facilitate various types of network communications. The Firewall page allows you to configure options to protect or facilitate various types of network communications.
- 
  
 ===== Firewall ===== ===== Firewall =====
  
-{{:pasted:20220118-182859.png}} \\+{{::advanced-firewall-1.jpg?364}} \\
  
- \\ **WAN interfaces respond to ping and traceroute:  **lets your device reply to ping/traceroute request packets from Internet hosts. This is needed for //ping //and //traceroute to //work via the Internet. Enabling this also may be needed for proper functioning of some VPN and IPv6 protocols.+ \\ **WAN interfaces respond to ping and traceroute:  **lets your device reply to ping/traceroute request packets from Internet hosts. 
 + 
 +This is needed for //ping //and //traceroute to //work via the Internet. It also may be needed for proper functioning of some VPN or IPv6 protocols.
  
  \\  \\
  
-**Limit communication to: **specifies the maximum number of requests per second to which the Firewall replies. Setting a limit is recommended to prevent DDoS attacks.\\   \\   \\ {{:pasted:20220118-183317.png}}\\+**Limit communication to: **specifies the maximum number of requests per second to which the Firewall replies.
  
- \\+Setting a limit is recommended to prevent DDoS attacks.\\   \\   \\
  
-**Enable TCP SYN cookies:  **uses "SYN cookies" to protect the router from SYN Flood attacks. It encodes information from the SYN packet into the (SYN/ACK) response. It is a standard method for preventing SYN floods. However, it has limitations that may cause issues with some old TCP/IP stacks.+{{::advanced-firewall-2.jpg?545}} \\ 
 + 
 + \\ **Enable TCP SYN cookies:  **uses "SYN cookies" to protect the router from SYN Flood attacks. 
 + 
 +This uses a standard method for preventing SYN floods. It encodes information from the SYN packet into the (SYN/ACK) response. Its limitations may cause issues with some old TCP/IP stacks. \\ 
  
  \\  \\
Line 26: Line 31:
 **Allow DHCP Spoofing: **makes FreshTomato accept/process packets from DHCP servers with different IP than the one it advertises. **Allow DHCP Spoofing: **makes FreshTomato accept/process packets from DHCP servers with different IP than the one it advertises.
  
-Such behaviour is often categorized as a DHCP spoofing attack, but rarely, could be legitimate behaviour. Enabling this lowers network security.\\  \\+Such behaviour is often categorized as a DHCP spoofing attack, but rarely, might be legitimate. Using this lowers security.
  
-**Smart MTU black hole detection:** enables a feature to detect ICMP black holes and intelligently try to adjust the path MTU.+ \\ 
  
-For details on MTU and black holes, see this blog post: [[https://blog.cloudflare.com/path-mtu-discovery-in-practice/|The CloudFlare Blog: Path MTU Discovery in Practice]]+**Smart MTU black hole detection:** detects ICMP black holes and smartly tries to adjust the path MTU. 
 + 
 +For details on MTU and black holes, see this blog post: [[https://blog.cloudflare.com/path-mtu-discovery-in-practice/|The CloudFlare Blog: Path MTU Discovery in Practice]] \\  
 + 
 +\\  
 + 
 +**TCP MSS Clamping:** 
 + 
 +This adjusts the Maximum Segment Size of forwarded TCP connections on WAN and VPN interfaces to match the discovered path MTU. 
 + 
 +This helps avoid MTU-related connection problems, especially on PPPoE links, VPN tunnels, IPv6 tunnels, or networks with blocked ICMP fragmentation-needed messages. 
 + 
 +Disabling this option reduces the number of firewall rules and may slightly improve performance on low-end routers, but can cause connection stalls or TLS handshake timeouts on links with reduced MTU. 
 + 
 +Recommended setting: enabled, unless MTU/MSS is handled manually or the network works reliably without MSS clamping.
  
  
 ===== NAT ===== ===== NAT =====
  
-**NAT loopback:** lets LAN devices access each other via the router's WAN interface. Also known as "Hairpinning", it's often used when connecting to the DDNS domain of your router via the LAN. These days, this setting is almost never needed. Also, it can create speed bottlenecks.+**NAT loopback:** The NAT Loopback (Hairpinning) logic is implemented in the firewall subsystem (firewall.c) using iptables rules applied to the PREROUTING and POSTROUTING chains of the nat table.
  
- \\+\\
  
-  * All +1. Disabled \\ 
-  * Forwarded Only +Under the Hood (iptables): FreshTomato omits loopback rules in the NAT chains.
-  * Disabled+
  
- \\+\\
  
-{{::advanced-firewall-nat-2024.1.png?361}}+Behavior: When a local LAN client sends traffic destined for the router’s public WAN IP address (or DDNS domain name), the router receives it, sees that there is no active rule translating internal LAN traffic back into the LAN, and simply drops or rejects the traffic.
  
 \\ \\
  
-**NAT target: **defines how NAT is implemented in loopback situations. Masquerade is the default, but involves an additional lookup, and the mapping is done towards an interface. SNAT is minutely faster, as its NAT mapping points directly to the destination IP and thus bypasses the lookup stage. However, SNAT is less reliable than Masquerade.+Pros: 
 +- Lowest router CPU load and max throughput (zero extra NAT inspection or packet rewriting for LAN traffic). 
 +- 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. 
 + 
 +\\ 
 +\\ 
 + 
 +2. Forwarded Only (default) \\ 
 + 
 +Under the Hood (iptables): FreshTomato generates rules that apply loopback translation only to traffic aimed at ports that are explicitly defined in the Port Forwarding rules. 
 + 
 +\\ 
 + 
 +Matches LAN traffic destined for WAN_IP:PORT only if PORT exists in nat PREROUTING / port-forward tables. These are essentially ports you find defined under Port Forwarding. 
 + 
 +\\ 
 + 
 +Behavior: If you forward port 8443 to an internal server at 192.168.1.10:443, a LAN device reaching out to [https://yourdomain.com:8443](https://yourdomain.com:8443) gets rewritten and looped back inside the LAN. However, if you try to reach [https://yourdomain.com:443](https://yourdomain.com:443) (a port with no active forward rule), it is rejected/dropped. 
 + 
 +\\ 
 + 
 +Pros: 
 +- Security & Control: Prevents local LAN traffic from hitting closed or un-forwarded router ports via the external WAN identity. 
 +- Performance: Limits loopback processing overhead to explicitly required ports only. 
 + 
 +\\ 
 + 
 +Cons: 
 +- Will not work for dynamic or non-forwarded services (e.g., UPnP-opened ports or DMZ configurations depending on implementation). It will not work for the router administration GUI called on its WAN interface from a LAN device. 
 + 
 +\\ 
 +\\ 
 + 
 +3. All \\ 
 + 
 +Under the Hood (iptables): FreshTomato inserts a blanket PREROUTING NAT rule matching all traffic coming from the LAN interface aimed at the WAN interface IP address, regardless of whether a port forward 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. 
 + 
 +\\ 
 + 
 +Pros: 
 +- "It just works" convenience—applies to UPnP mapped ports, DMZ hosts, and all services without needing individual port forward rules. This is the only mode supporting the WAN router administration called from the LAN. 
 + 
 +\\ 
 + 
 +Cons: 
 +- Performance Bottlenecks (minor): Every single piece of LAN-to-"WAN-IP" traffic runs through blanket SNAT/DNAT rule-matching cycles, bypassing hardware NAT/CTF (Cut-Through Forwarding) acceleration on supported chipsets. NOTE: this is to the WAN-IP not the Internet! 
 +- Unintended Loops/Routing Anomalies (rare): Can cause severe instability or packet loops when using dual routers, wireless bridges, or complex multi-subnets.
  
  \\  \\
  
 +{{::advanced-firewall-nat-2024.1.png?361}}
 +
 +\\
 +
 +**NAT target: **defines how NAT is implemented in loopback situations.
 +
 +Masquerade is the default, but involves an additional lookup, and the mapping is done towards an interface. SNAT is minutely faster, as its NAT mapping points directly to the destination IP, thus bypassing the lookup stage. However, SNAT is less reliable than Masquerade.\\
  
 ===== Multicast ===== ===== Multicast =====
  
- \\ \\ {{:pasted:20220118-185509.png?742}}\\  \\+ \\ {{:pasted:20220118-185509.png?742}}\\  \\
  
 **Enable IGMP proxy: **enables the Internet Group Management Protocol service. **Enable IGMP proxy: **enables the Internet Group Management Protocol service.
Line 71: Line 151:
  \\  \\
  
-**Enable quick leave:** this IGMPv2 feature lets the router stop multicasting to an IP when the device sends a "quick leave" packet.+**Enable quick leave:** this IGMPv2 feature lets the router stop multicasting to an IP that has sent it a "quick leave" packet.
  
  \\  \\
  
-**Custom Configuration:** lets you set advanced parameters for the IGMP proxy daemon. Consult official documentation first.\\   \\+**Custom Configuration:** lets you configure advanced settings for the IGMP proxy daemon. Consult official documentation.\\   \\
  
  \\ {{:pasted:20220118-190050.png}}\\  \\  \\ {{:pasted:20220118-190050.png}}\\  \\
  
-**Enable Udpxy: **like IGMP proxy, Udpxy lets devices on different VLANs to do multicast communications. Since they are similar, use one or the other, but not both at once.+**Enable Udpxy: **like IGMP proxy, this lets devices on different VLANs do multicast communications. 
 + 
 +Since they are similar, use one or the other, but not both at the same time.
  
  \\  \\
  
-**Upstream interface** - here, enter the expected stream source location. (Default: blank).+**Upstream interface: **here, enter the expected stream source location. 
 + 
 +(Default: blank).
  
  \\  \\
  
-**LAN0/LAN1/LAN2/LAN3** - specifies the location streaming clients are expected to be found.+**LAN0/LAN1/LAN2/LAN3** - specifies the location streaming clients should be found.
  
  \\  \\
  
-**Enable client statistics** -causes FreshTomato to collect statistics about Udpxy clients.+**Enable client statistics:** causes FreshTomato to collect statistics about Udpxy clients.
  
  \\  \\
  
-**Max clients: **the maximum number of simultaneous Udpxy clients. Since Udpxy is is a lightweight protocol, it works well for a limited number of clients. Therefore, you might want to impose a maximum limit.+**Max clients: **the maximum number of simultaneous Udpxy clients. 
 + 
 +Udpxy is is a lightweight protocol, so it works well for a limited number of clients. You might want to set a maximum limit.
  
  \\  \\
  
 **Udpxy port: **specifies the port on which to receive Udpxy information from your router.\\  \\   \\  {{:pasted:20220118-190844.png}}\\  \\ **Udpxy port: **specifies the port on which to receive Udpxy information from your router.\\  \\   \\  {{:pasted:20220118-190844.png}}\\  \\
- 
- \\ 
  
 **Efficient Multicast Forwarding (IGMP Snooping): **IGMP snooping makes the router's switch facilitate discovery of Multicast IGMP clients. This helps to send multicast traffic only towards ports with at least one multicast subscriber, reducing overall multicast traffic. **Efficient Multicast Forwarding (IGMP Snooping): **IGMP snooping makes the router's switch facilitate discovery of Multicast IGMP clients. This helps to send multicast traffic only towards ports with at least one multicast subscriber, reducing overall multicast traffic.
Line 111: Line 195:
  \\  \\
  
-**Force IGMPv2** - IGMPv2 enhances IGMP with additional messages/behavior to optimize end-to-end client-server communication. Probably the most important one is the "Leave Group" message. When a host wants to stop listening to a multicast group address, it reports to the router that it has stopped listening. In v1, the host simply stopped listening, without informing the router.+**Force IGMPv2: **forces IGMPv2 to be used on the network. 
 + 
 +IGMPv2 enhances IGMP with additional messages/behavior to optimize end-to-end client-server communication. Probably the most important one is the "Leave Group" message. When a host wants to stop listening to a multicast group address, it reports to the router that it has stopped listening. In v1, the host simply stopped listening, without informing the router.
  
  \\  \\
advanced-firewall.1731270196.txt.gz · Last modified: by hogwild