Hi, I have “just” installed a new RB router, upgraded OS to 6.5 and tried to set up some port mapping with a help of http://wiki.mikrotik.com/wiki/Manual:IP/Firewall/NAT. Unfortunately, the connection to the “outside” port could not be established.
WAN has a public IP address set by an outer DNS. Everything after the router is in a local 192.168.3.x NAT where the local DNS server is running on the router.
I would like to [public ip]:4089 points to 192.168.3.40:3389. The [public ip]:4089 should work from the world as well as from the local NAT. Currently, the 192.168.3.40:3389 works but [public ip]:4089 does not (no response). The public ip is reachable (pingable) from NAT.
Thank you for any tips how to fix it.
[@MikroTik] /ip> route print detail
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
0 ADS dst-address=0.0.0.0/0 gateway=[public prefix].1
gateway-status=[public prefix].1 reachable via ether1-gateway distance=1 scope=30 target-scope=10
vrf-interface=ether1-gateway
1 ADC dst-address=[public prefix].0/24 pref-src=[public prefix].234 gateway=ether1-gateway
gateway-status=ether1-gateway reachable distance=0 scope=10
2 ADC dst-address=192.168.3.0/24 pref-src=192.168.3.1 gateway=bridge-local
gateway-status=bridge-local reachable distance=0 scope=10
[@MikroTik] /ip> address print detail
Flags: X - disabled, I - invalid, D - dynamic
0 ;;; default configuration
address=192.168.3.1/24 network=192.168.3.0 interface=bridge-local actual-interface=bridge-local
1 D address=[public prefix].234/24 network=[public prefix].0 interface=ether1-gateway
actual-interface=ether1-gateway
[@MikroTik] /ip> firewall nat print detail
Flags: X - disabled, I - invalid, D - dynamic
0 ;;; default configuration
chain=srcnat action=masquerade to-addresses=0.0.0.0 out-interface=ether1-gateway
1 ;;; Port Forwarding from WAN:4089 to 192.168.3.40:3389 (tcp)
chain=dstnat action=accept protocol=tcp dst-address=192.168.3.40 src-port=4089
dst-port=3389
2 ;;; Port Forwarding from WAN:4089 to 192.168.3.40:3389 (udp)
chain=dstnat action=accept protocol=udp dst-address=192.168.3.40 src-port=4089
dst-port=3389
I could not put my public address into the rule as it might change over time without any notice (I have a public IP but not a static IP).
As I have mentioned before, I have tried it with my current configuration even from the outer network and it has worked niether.
I just read your first post more clearly and I see that your dst-nat rules are not correct.
The correct rules should be
/ip firewall nat
add chain=dstnat action=dst-nat protocol=tcp dst-port=4089 in-interface=ether1 to-address=192.168.3.40 to-ports-3389EDIT
After reading the total thread again I think you already have it like that.
Maybe the order is wrong.
Yes, I have already corrected them and they work when connecting from outside of my network. However, I still have difficulties in connecting through the public ip when the originating device is inside my local network.
You need to install a hairpin nat rule in “/ip firewall nat” to access that ip from your localnet. I am not proficient at that any more. It has been a while.
Sorry for skipping some of the rules, the other rules are simple copies of the ones shown in the excerpt, just with another pairs of a port number and a destination ip. Everything else is the same.