MikroTik Port Forwarding Generator
Generate a narrow dst-nat rule, the matching forward-chain allow rule, and an optional Hairpin NAT rule. The page also checks whether the WAN address looks like provider CGNAT.
1. Forwarding inputs
The interface receiving the public request.
Used for optional Hairpin NAT.
A single port or range such as 5000-5010.
Restrict exposure when only one office, VPN, or monitoring source needs access.
If it is in 100.64.0.0/10, the tool warns that inbound forwarding will not work directly through provider CGNAT.
What the generated rules do
The dst-nat rule changes the destination from the router's public address and external port to the private server and internal port. The filter rule is separate: NAT chooses the destination, while the forward chain decides whether the packet may cross the router. Keeping both rules visible makes the change easier to review and roll back.
/ip firewall nat
add chain=dstnat in-interface=ether1 protocol=tcp dst-port=443 action=dst-nat to-addresses=192.168.88.10 to-ports=443
/ip firewall filter
add chain=forward in-interface=ether1 connection-nat-state=dstnat protocol=tcp dst-address=192.168.88.10 dst-port=443 action=acceptHairpin NAT explained
Hairpin NAT, also called NAT loopback, is needed when a client on the same LAN reaches an internal server through the router's public address. The destination is translated correctly, but without a matching source translation the server may reply directly to the LAN client. The client then sees a reply from the private address instead of the public address it requested and drops it.
CGNAT check
When the WAN address is inside 100.64.0.0/10, the provider is usually sharing a public address through Carrier-Grade NAT. A dst-nat rule on your router cannot receive an unsolicited connection that never reaches your router. Use a public IPv4 address, a provider port-forwarding service, or a WireGuard tunnel to a reachable VPS instead.
Safe test sequence
- Confirm the internal service works from the LAN using its private address.
- Apply the generated rules with a local or out-of-band management path available.
- Test from a mobile network or another independent ISP, not from the same LAN.
- Check rule counters and the server logs. A zero counter means the request did not reach the rule.
- Remove the rule when the service is no longer needed and restrict source addresses whenever possible.
References and related tools
MikroTik's NAT documentation covers dst-nat, src-nat, and Hairpin NAT. Use the WireGuard generator when the real goal is remote administration, and the deployment checklist before applying firewall changes.