Computer Networking

MikroTik RouterOS - Port Forwarding

Overview

This article is written by Server Management Inc. IT systems administrator Timo Puistaja - 19.04.2017, Tartu, Estonia.

Need help configuring your device? Contact us info@serman.ee

Port forwarding is something IT systems administrators do almost every day. Its very common procedure everywhere, mose of the new PC gamers and IT students face the problem sooner or later. Usually they read a tutorial about "How to setup your own dedicated CS:GO or webserver?!" and one part of it is port forwarding to your server.

Prerequisities

  1. Recommended to have Static Public IP from your ISP. When you have Dynamic IP from ISP that means it can change any time and your port forward rule wont work after the change of IP.
  2. Firewall rule to allow traffic from the port you are going to forward - my article about firewall: MikroTik RouterOS - Best practice firewall.
  3. You know how PORTS in computer networking work. Or if you dont know port forwarding itself gives you some clue how it works.

How Port Forwarding works and how to do it in MikroTik Router OS

To make everything clear im going to make up a simple real life situation. Your old gaming PC is standing in the corner and you want to make something out of it - webserver or CS:GO server or whatever server. You have installed the software and done the setup, everything works in your LAN (Local Area Network). The server local IP is 192.168.0.10 for example.

Lets assume you want your server to be accesible for the whole world and you have static public IP from your ISP: 88.99.100.200

This means your router is accesible from the whole world from address (it´s not if you have done some Geoblocking or whitelisting in MikroTik) 88.99.100.200.

Now you need to somehow connect the Public IP(88.99.100.200) and your server (192.168.0.10). This is where port forwarding comes in.

You can connect you public IP and server port-by-port doing it in MikroTik NAT menu.

To visualise how Port Forwarding works I made a little picture:


So heres how you do it:

Just navigate to the menu IP - Firewall - NAT - ADD

General Tab: Chain: dstnat: Dst. Address: 99.88.100.200; Protocol: 6 (tcp) or 17 (udp) depending on your needs; Dst. Port: 80

Action Tab: Action: dst-nat; To Addresses: 192.168.0.10; To Ports: 80

SAVE

OR from terminal:

/ip firewall nat

add action=dst-nat chain=dstnat comment="Webserver HTTP" dst-address=88.99.100.200 dst-port=80 protocol=tcp to-addresses=192.168.0.10 to-ports=80


Need help configuring your device? Contact us info@serman.ee


Was this article helpful?
0 0 (Login to rate)
Download PDF

Password Reset

Enter your email address below, and we'll send you a new password.

×