When my firewall rules on my testing router with ROS 6.40 dropped the whole WAN traffic, it was not possible that the WAN port got an IP address from the ISP. In ROS 6.42.9 and 6.43 for example I also tested it and there the WAN port can assign an IP address although my firewall rules block the whole traffic on this interface. I noticed this strange behavior because I have rules for the WAN port which also counts the DHCP renews. And in ROS 6.42 I noticed that the counter stays on zero but the IP could be assigned. The UDP connections were also shown on the connections list.
How can this happen that the WAN port can assign an IP from ISP although the whole traffic is blocked (will be firewall service be loaded too late while starting)?
Are there hidden rules or even more hidden rules implemented on newer firmware releases?
Well, the firewall is L3, DHCP happens on L2 until the lease is ack’ed by the DHCP server.
dhcp discover goes from your WAN-facing MACaddress to ff:ff:ff:ff:ff:ff, that’s a L2 broadcast.
dhcp offer is L2 unicast from DHCP-server’s MAC to your WAN-facing MAC
dhcp request is L2 unicast from your WAN-facing MAC to DHCP-server’s MAC
dhcp ack is still L2 unicast, from DHCP-server’s MAC to your WAN-facing MAC.
And here’s the point your firewall starts to work.
In context of the original question, MT allows initial dhcp request from port 68 to 67 on UDP, and “allow established / related” takes care of the response.
Unfortunately you are correct.
And I say “unfortunately” because it doesn’t make any sense, and goes against logic, as the protocol is using UDP on top of IP, both normally handled by IP firewall.
Further, in the past it had to be explicitly allowed. I run into it in ROS 2, 3 and still (I think) 4. Later on I just took standard config over and so don’t know when the change occurred.
Hi,
I have come across your conservation as MikroTik has DHCP rule in its Advanced Firewall Tutorial and I wondered why but came to the conclusion that they forget to define the use case of this tutorial.
Reading this thread I feel that the use-cases should be clearly defined.
DHCP Server is not in the same broadcast domain
So DHCP queries leave the broadcast domain and are routed, are on L3.
IP-Firewall can block it (and only then).
In practical terms this often comes up because people are surprized that they can ping and get a response from interfaces that are blocked by firewall rules.
Case in point VLANX can ping the IP address of VLANY and vice versa and the sky is falling… NO.
Just expected behaviour for interfaces on the MT device. The VLAN L2 structure prevents any ACTUAL DATA passing between the vlans so not to worry on that front.
In addition blocking vlanx to vlany traffic by drop all rules or explicit rules also stops cold any data passing between the vlans at L3, is the sky falling… NO
Thus in conclusion, funny things do happen, for reasons explained by others, but who cares, at the end of the day, no data is passing between them which is the goal.