/ip firewall nat add action=masquerade chain=srcnat comment="Hairpin NAT" dst-address=172.18.17.0/24 src-address=172.18.17.0/24
/ip firewall nat add action=masquerade chain=srcnat comment="Main NAT" out-interface-list=ether1
/ip firewall nat add action=dst-nat chain=dstnat comment="Port forward - service X" dst-address-list=WAN dst-port=1234 protocol=udp to-addresses=172.18.17.123 to-ports=1234
/ip firewall nat add action=dst-nat chain=dstnat comment="Port forward - service Y" dst-address-list=WAN dst-port=4321 protocol=tcp to-addresses=172.18.17.123 to-ports=4321
/ip firewall nat
add chain=srcnat action=src-nat dst-address=172.16.100.100 to-addresses=172.16.100.1
I usually add the local interface as the output interface.I think it's a simple src-nat on router with IP address 172.16.100.1. If that router is Mikrotik, then simple
So whatever passing that router on the way towards router will get NATed.Code: Select all/ip firewall nat add chain=srcnat action=src-nat dst-address=172.16.100.100 to-addresses=172.16.100.1
Sure thing, sometimes one has to narrow down the NAT rule to only part of traffic ... but that largely depends on use case. E.g. if you have router with a WAN interface and single LAN subnet, then limiting SRC NAT to out-interface=WAN doesn't make any change most of the time (and in case when one wants hair-pin NAT it's actually counter productive). But if you have router with several LAN subnets and one only wants to perform SRC-NAT for traffic egressing towards internet, then setting out-interface=WAN is necessary.I usually add the local interface as the output interface.
chain = dstnat action = netmap to-addresses = 172.16.100.100 to-ports = 80 protocol = tcp in-interface = pppoe dst-port = 80
/ip firewall nat
add chain=srcnat dst-addresses=172.16.100.100 protocol=tcp dst-port=80 action=masquerade
Thank you all, everything worked out. Mikrotik is truly a very powerful device.Then just add some srcnat rule, for example:
Code: Select all/ip firewall nat add chain=srcnat dst-addresses=172.16.100.100 protocol=tcp dst-port=80 action=masquerade