NAT port in Mikrotik

With Mikrotik you have multiple options when you want to nat some external ports to an internal address.

You could open winbox and go to IP > Firewall > NAT > Press the + and then put the ports and such in there.

or

You could go to “New Terminal” and write a line there that would do the same as the above.

or

You could make a script that would set all your ports up in no time.
Go to System > Scripts > Press the + and give the script a name.

In that script you put something like this in. “ether1” is the wan port on my router and should be changed to what your wan port is named.

:ip firewall nat add chain=dstnat protocol=tcp dst-port=21 in-interface=ether1 action=dst-nat to-addresses=192.168.1.25 comment="FTP"
:ip firewall nat add chain=dstnat protocol=tcp dst-port=10500-10550 in-interface=ether1 action=dst-nat to-addresses=192.168.1.25 comment="FTP passive port range"

When started, this will set routing from port 21 and 10500 to 10500, to internal ip 192.168.1.25

Leave a Reply