I have setup a MikroTik hEX Refresh device with the default firewall rules.
I then added a few additional rules. The first 2 rules I added were to drop “everything else” on the input and forward chains. I added these rules at the end, with lowest precedence.
Further to this, I disabled all optional services. I have now only dhcp and winbox services active. These use ports 67 and 8291 respectively.
It would seem reasonable to want to block these services on WAN interfaces, of which I have 2. WAN and WAN2.
In addition, I have two further interfaces, PUBLIC_LAN and DMZ. It would also seem sensible to block winbox on these interfaces as well.
I added 2 rules to block DHCP:
add action=drop chain=input comment="block DHCP 67 from WAN" dst-port=67 in-interface-list=WAN protocol=udp
add action=drop chain=input comment="block DHCP 67 from WAN2" dst-port=67 in-interface-list=WAN2 protocol=udp
I then added a further 4 rules to block WINBOX:
add action=drop chain=input comment="block winbox 8291 from WAN" dst-port=8291 in-interface-list=WAN protocol=tcp
add action=drop chain=input comment="block winbox 8291 from WAN2" dst-port=8291 in-interface-list=WAN2 protocol=tcp
add action=drop chain=input comment="block winbox 8291 from DMZ" dst-port=8291 in-interface-list=DMZ protocol=tcp
add action=drop chain=input comment="block winbox 8291 from PUBLIC_LAN" dst-port=8291 in-interface-list=PUBLIC_LAN protocol=tcp
These rules appear with highest precedence.
I then did a google search and found that WINBOX uses both TCP and UDP.
I wasn’t able to add a rule which says “block traffic destined for this port number”. I had to choose a protocol to be able to add a port number. I guess this might be because some protocols do not use port numbers? I’m not sure about that.
I could add a further 4 rules to block WINBOX on UDP. Or I could create another interface list which includes WAN, WAN2, DMZ and PUBLIC_LAN.
Is there any way just to block the port regardless of whether the connection is TCP, UDP, or something else?
Then additionally, while I assume what I am trying to do here is reasonably sensible, it might not be. There might be something I have overlooked here. Please let me know if this is not a good idea!