Community discussions

MikroTik App
 
lweidig
just joined
Topic Author
Posts: 17
Joined: Mon May 01, 2006 4:56 pm
Location: Sheboygan, WI

Dstnat with IP address rewrite

Tue Feb 25, 2020 6:56 pm

I have a rule similar to the following where 1.2.3.4 is the public IP address that will be used to access the device on the private network located at 192.168.0.2:
add action=dst-nat chain=dstnat comment="Init" dst-address=1.2.3.4 dst-port=22,80,161,443 protocol=tcp src-address-list=OnlyFromHere to-addresses=192.168.0.2
I have an identical rule setup for another private address where the device has a gateway and this functions properly so it is not the address list, port list,...

HOWEVER on the original device (192.168.0.2) there is NOT a gateway setup so it will need to not only bring in the dst-nat traffic, but then rewrite the source IP address so that the traffic appears to be coming in from the LAN. In the firewall we are converting from (Untangle) there is simple a rewrite rule where we could say ANY traffic from OnlyFromHere list destined to 192.168.0.2 should have a new source address of 192.168.0.254 which then of course is local and can communicate.

I cannot figure out how to replicate this functionality in Mikrotik though I am sure it should be possible since RouterOS is far more flexible than Untangle. Would appreciate any clues how to accomplish this. Thanks!
 
sid5632
Long time Member
Long time Member
Posts: 554
Joined: Fri Feb 17, 2017 6:05 pm

Re: Dstnat with IP address rewrite  [SOLVED]

Tue Feb 25, 2020 7:30 pm

Add something like this as well:
add action=masquerade chain=srcnat dst-address=192.168.0.2 dst-port=22,80,161,443 protocol=tcp src-address-list=OnlyFromHere

Who is online

Users browsing this forum: Bing [Bot], Extrems and 51 guests