I am wondering why when I set a DHCP server on a specific port, then block all incoming traffic with
ip firewall filter add chain=input action=drop
I am still able to recive an Ip address from DHCP server
first I think that there is an invisible rule which accepts that traffic .. but when I add a passthrough rule in a mangle table
ip firewall mangle add chain=input protocol=udp dst-port=67 action=passthrough
and do some dhcp traffic (ipconfig /renew (WinXP)) I noticed that that rule “cautches” this traffic so it means that there is no ACCEPT rule before my added rule.
So .. how could that be? and how I can filter certain DHCP requests (generaly traffic) from some IPs using built in firewall?
blocking in /ip firewall doesnt work .. in example above I block ALL all traffic which goes to INPUT chain .. and even after doing it I was still able to recive IP from DHCP server
DHCP client is contacting router and data is passing trough chain=input,
DHCP server[router] replies to client and data is passing trough chain=output.
Make sure you have used correct rule to block access to router, just curious how do you get back access to the router, f’ilter add chain=input action=drop disabled=no’ denies all data destined to the router (MAC-Winbox is the last opportunity, if MAC-Winbox server is enabled).
ermm, what he is saying is that the input chain is not filtering input. Plain and simple. I will see if I can test this on our test box today to see if its truly bypassing the firewall (which sounds fishy to me).
I placed rules to block UDP 67 and 68 used for DHCP. These were on the input chain, not the output chain. I have not tested placing them on output chain as that’s not considered in this scenario.
dhcp,info,debug 0-inside assigned 10.40.1.202 to 00:0B:82:05:52:6B
firewall,info DHCP input: in:0-inside out:(none), src-mac 00:0b:82:05:52:6b, proto UDP, 0.0.0.0:68->255.255.255.255:67, len 424
firewall,info DHCP input: in:0-inside out:(none), src-mac 00:0b:82:05:52:6b, proto UDP, 0.0.0.0:68->255.255.255.255:67, len 424
I see that DHCP bypasses the firewall filter. The logging shows it assigned an address, and then blocked the packets. This definately should not be happening.
I’m guesing RouterOS has hacked something to make DHCP work in prerouting or something … possibly to make hotspot / universal client work ? Just seems odd that something to the router would bypass the input chain.
I think it is not just DHCP. I am seeing the same thing with WinBox access when accessing a MAC address. It appears to me that all MAC level traffic may bypass input and output
Uhm, are you trying to block traffic going through the router, in the input chain?
You don’t specify if the DHCP server is on the mikrotik router itself or is a different unit all together.
EDIT: I guess i needed to reread it all
If DHCP service on router is using BPF (Berkley Packet Filter) internally then it would be intercepted by BPF before hitting the firewall.
Perhaps adding the interface to bridge and move the local ip’s and dhcp-server to the bridge interface (i know, extra overhead). This way you could use bridge filter to handle it. It’s not ideal, i know, seeing as routing over bridged interfaces means re-queuing internally and that adds latency.
I think the line of defense is what interface your set the DHCP-server on. I see the dilemma though.
What would be a good solution for this problem anyway?