Multiple IP NAT

Hi

We have a 3rd party hosted system and the vendor is wishing to replace one component with a MikroTik CCR2004-16G-2S+.

A bunch of devices sit behind this with multiple internal IP addresses and use 1 IP address on the router and PAT to access the internet.

What we’d like to understand is, can we have a 2nd external IP on the router accessing the internet NAT’d to 1 specific internal IP, and a 3rd external IP NAT’d to another internal IP?

I.e.

1.0.0.1

1.0.0.2

…

1.0.0.100 all using 172.x.x.2 (PAT) to access the web

Plus

1.0.0.101 NAT’d to 172.x.x.3

1.0.0.102 NAT’d to 172.x.x.4

Is that possible?

Thanks

Rx

Yes. It can easily be done by adding SRCNAT rules. Use the src-address condition to selectively apply different to-addresses based on the source address. Please note that the order of the rules is important. So place the special rules for sources 10.0.0.101/32 and 10.0.0.102/32 above a catch all rule for source 10.0.0.0/24.

NAT | RouterOS Manual

Also, this flowchart will come handy. The relevant SRCNAT rules would be the box #25 in the chart:

The ultimate Mikrotik iptables flowchart - RouterOS / Useful user articles - MikroTik community forum

For incoming connections, apply DSTNAT rules if you want to map 172.x.x.3 to 10.0.0.101 and 172.x.x.4 to 10.0.0.102 (in that direction).