Hairpin NAT example

Here is an example config to configure a hairpin NAT on Mikrotik.

In this example I have a webserver on and my Mikrotik router is on After adding these rules I can access my webserver via my public IP from inside the LAN. Which is a nice feature.

/ip firewall nat
add action=masquerade chain=srcnat comment="default configuration" out-interface=ether01-WAN to-addresses=
add action=masquerade chain=srcnat comment="hairpin nat" dst-address=! src-address=
... other NAT rules
add action=dst-nat chain=dstnat comment="Forward port 80 to webserver on" dst-address=! dst-address-type=local dst-port=80 protocol=tcp \
to-addresses= to-ports=80

More information can be found here.

Lämna ett svar

Din e-postadress kommer inte publiceras. Obligatoriska fält är märkta *