Unfortunally you can’t just DSTNAT 5001 to 8291 and then DROP traffic to 8291, as the DSTNATing will be done before going trough the input filter list, so it will filter your nat:ed traffic as well.
An ugly workaround is to DSTNAT 8219 to anunused port like:
[admin@R1] /ip firewall nat> pri
Flags: X - disabled, I - invalid, D - dynamic
0 chain=dstnat action=dst-nat to-ports=8291 protocol=tcp dst-port=5001
1 chain=dstnat action=dst-nat to-ports=1234 protocol=tcp dst-port=8291
With those two rules, I’m only able to connect with winbox using port 5001.
That rule means: whatever comes to tcp port 5001 should be redirected to port 8219. Right?
Dstnat’ing would be done before filter input list, so traffic redirected from port 5001 to 8219 would be droped. Maybe I need additional rule in /ip firewall filter:
That won’t work. scr-port is not the original dst-port before NAT:ing, it’s the src-port that was originally used by the winbox application, so you can’t use it to differentiate between traffic going to 8291 or 5001 from the beginning.
I don’t know the diffrence between action. redirect and dstnat. Dstnat works atleast.