Port forwarding with MikroTik router

Say, the router has IP 192.168.0.9 on the WAN side, on the LAN side there is a PC connected to it by patch cable as 192.168.88.249 with a web server listening on port 8080. We want to access the web server on router’s WAN interface as 192.168.0.9:88.

The following enables access to the port on the WAN side first and then sets up forwarding of traffic to the PC on LAN:

  • ip firewall filter add action=accept chain=input disabled=no dst-port=88 protocol=tcp place-before=0
  • ip firewall nat add action=dst-nat chain=dstnat disabled=no dst-port=88 in-interface=ether1-gateway protocol=tcp to-addresses=192.168.88.249 to-ports=8080

In the web interface that would be respectively IP / Firewall / Filter Rules and then IP /  Firewall / NAT.

Alternatively, a typical way to grant access from Internet to your web server on LAN. This will block the port 80 where the MikroTik’s HTTP web interface is by default:

  • ip firewall filter add action=accept chain=input disabled=no dst-port=80 protocol=tcp place-before=0
  • ip firewall nat add action=dst-nat chain=dstnat disabled=no dst-port=80 in-interface=ether1-gateway protocol=tcp to-addresses=192.168.88.249 to-ports=80

 

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s