I have some questions about ICMP (IPv4 only) and the RouterOS configuration.
Blocking ICMP traffic could break core networking techniques (like Path MTU Discovery).
The default RouterOS configuration has a default firewall rule to allow ICMP traffic on the Input chain.
But there is no allow ICMP rule on the Forward chain.
Is ICMP traffic from LAN to WAN connections (like browsing the web) always seen as RELATED traffic? Is that the reason why there is no ICMP rule on the Forward chain?
If the above is true, is the ICMP rule on the input chain only for traffic originating from the internet to the router itself? Or other traffic as well? What are some examples of this kind of traffic, as I don't have any services (server, VPN, ...) exposed to WAN side of the router.
Just trying to improve my understanding of how things work.
No, it's not "related" traffic per se. Rather, it's "NAT'ed" just like TCP traffic would be from LAN.
It confusing since the defconf firewall defaults uses interface-list filters works later in the firewall that indirectly allow ICMP (and LAN origin traffic), since there is not simple drop at end, you don't have "allow" ICMP to WAN. Instead, RouterOS structures it as:
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN
So WAN inbound is blocked on forward, but LAN outbound does NOT hit any filter,.. so it passes to /ip/firewall/nat, which srcnat the ICMP from LAN, and then it's add to connection tracking.
You can test yourself, by disabling fasttrack (if enabled) then add ICMP coming from WAN logging rules for both the input and forward chain at the top of the filter table. As example:
Green: When a client in LAN ping some remote address, NAT applies and the ICMP echo reply packets are tracked as established and are allowed through by the normal "accept established, related" rule of the forward chain.
Orange: When a client makes outgoing connection (non ICMP), NAT still applied, and some error condition needs to be reported back via ICMP, that ICMP packet is tracked as related, and is also affected by the "accept established, related" rule of the forward chain.
Purple: When the router itself tries to ping something, the response ICMP echo reply packets have the established connection state and are caught by the "accept established, related" rule of the input chain.
Blue: When the router make outgoing connections (non ICMP) and some error condition needs to be reported back via ICMP, the ICMP packet has connection state related, and is also caught by the "accept established, related" rule of the input chain.
Which means for IPv4, with the default defconf firewall rules, the "defconf: accept ICMP" rule (which sits below "defconf: accept established,related,untracked" of input) mostly only catches incoming ping requests (ICMP echo request) or bogus ICMP packets. And is not needed for handling errors of connections originated from LAN or from the router itself.
Hello everyone,
Based on the description above, is the following setup feasible—would it be correct, and would it actually work?
For the inbound chain, I would allow ICMP traffic only from an address list containing specific addresses I’ve defined. For outbound requests, I would create a similar rule, but apply a filter based on specific source addresses from the router's LAN side (using a source address list). Regarding the LAN side, should this rule be applied to the OUTPUT or INPUT chain? Has anyone experimented with an idea like this? I’m curious about the implementation. I have a test environment available, which is why I’m bringing this up. Does such a setup make sense?
Thanks
I guess we're missing what the problem you're having? The default firewall is pretty well-designed for a common LAN/WAN split without modifications. If you add interfaces like VLANs, if those go to the LAN interface-list, firewall works same. It only when you want to block IPv4/IPv6 between local interfaces (*really, "subnets"), do you need to change the firewall.
Fair enough But the idea crossed my mind to control who can ping from the WAN side and who cannot. Similarly, to manage this from the LAN side of the router as well. I’m referring to a standard router configuration—no VLANs, etc. It never hurts to experiment
If you want to dig into ICMP and firewall, I'd suggest looking some of @Kentzo's firewall examples, since he takes a very sophisticated approach to handling ICMP. e.g. using tcp-reset instead of dumb drop, among others.