linux forward ip? mikrotik can ?

Hello, I had a question, I was searching on the Internet when I came across IP forwarding in Linux, it was interesting to me and I tried it and they were connected to each other in two separate networks. Basically, every packet sent to the server one was automatically forwarded to the server two without tunneling ! , without being in the same gateway. Now the question is, how can this work be done with Mikrotik?

this command running in linux :
sysctl net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -p tcp --dport 22 -j DNAT --to-destination “server1”
iptables -t nat -A PREROUTING -j DNAT --to-destination “server2”
iptables -t nat -A POSTROUTING -j MASQUERADE

Congratulations, you just discovered src/dstnat, the hidden secret of RouterOS. :wink:

/ip firewall nat
add chain=dstnat protocol=tcp dst-port=22 action=dst-nat to-addresses="server1"
add chain=dstnat action=dst-nat to-addresses="server2"
add chain=srcnat action=masquerade

Don’t try #2 on remote routers, you wouldn’t like the result.

Yes, I know what src / dst nat is in Mikrotik, but I tried it and it didn’t work.

Well, you probably made some mistake. If you show us what exactly you did, someone may tell you what it was.

yes it was mistake , work prefectly , thank you bro :mrgreen: