NAT Public IP to clients if using /30 in interface facing ISP

Hi! Im building a brand new WISP network and dont have much public IP availables to deliver to my customers.

I have a /30 connection between my ISP and my MT Router, (10.0.0.1/30MT - 10.0.0.2/30ISP Router). They route me /29 public block of IP to my ether1 interface (10.0.0.1). That gives to me 8 available public IP.

But i have more than 8 customers, i want to have the posibility of adding each of 8 Public IP to some virtual interfaces on my MT Router for later MASQUERADE the customers private IPs within those public IPs.

So lets say first available public IP on the /29 delivered to my Router is 200.X.X.1, and i have 2 customers connected to LAN interface (ether2). Customers private IPs are 192.168.88.101/24 and 192.168.88.102/24. (Both customers will share the same public IP)

How could i accomplish to NAT/MASQUERADE the 192.168.88.101/24 and 192.168.88.102/24 to that public IP considering that my outside interface IP is not in that block but a different /30?

Should i create a bridge interface for each available public IP? →

/interface bridge add name=Bridge1
/ip address add address=200.X.X.1/32 interface=Bridge1

Then create Address List that will be used for Source Address List on The NAT/MASQUERADE action:

/ip firewall address-list
add address=192.168.88.101 list=list1
add address=192.168.88.102 list=list1

And finally NAT MASQUERADE

/ip firewall nat add chain=srcnat src-address-list=list1 out-interface=Bridge1  action=masquerade

Is this correct or the right way? If this won’t work i cant figure it out another way. Some help would be appreciated

You want something like this:

/ip firewall nat
add action=src-nat chain=srcnat src-address-list=list1 out-interface=<WAN> to-addresses=200.x.x.1

To which interface you assing 200.x.x.1, does not really matter. You can use WAN interface (but it may possibly interfere with masquerade rules, if you have some), or dedicated bridge interface as a loopback (you can put all addresses to one; but remember that it won’t get actually used as outgoing interface), or it would even work for outgoing connections without actually having the 200.x.x.1 on router at all (but you probably want to have it there).

So in conclusion:

  1. I Want to use action=src-nat (instead of masquerade)
    2.a) out-interface=ether1 (depends if I’m not using other NAT/masquerade rules)
    2.b) out-interface=Bridge1 (but i Want to make sure if address are added and routed to the Mikrotik router?)

Thanks for quickly answering!

  1. Yes.
  2. Not what I meant, it was about where to put those addresses from routed subnet, i.e.:
/ip address add address=200.X.X.1/32 interface=<some interface>

It does not really matter too much what is. Note that out-interface= in srcnat rule is not related to this at all, I just put it there, because you probably want to NAT only outgoing traffic to internet. But even that may not be necessarily true.

For example, lets say that customer with internal address 192.168.88.101 runs web server visible to outside on 200.x.x.1. And another customer with 192.168.88.222, who would normally use 200.x.x.2 as outgoing address, would access it. If both internal addresses are in same subnet, you could either use default hairpin NAT and make the connection look like it comes from router’s internal address. Or you could drop out-interface= condition, let the srcnat rule catch it and make it look to webserver like it comes from 200.x.x.2. If it does not make sense, don’t worry about it. :slight_smile:

I’d probably just do this:

/interface bridge
add name=loopback
/ip address
add address=200.0.0.1/32 interface=loopback
add address=200.0.0.2/32 interface=loopback
...

Again, this “loopback” interface is there only to hold addresses, you can’t use it as in-interface or out-interface anywhere.

And another option, if you had some demanding customer who would require a public address directly on their equipment, you can just take any of remaining addresses and route it directly anywhere in your network.

Hi Sob! Ok NAT is working as it should for internal clients (i didn’t specify the out-interface in the firewall rule).

But from the Mikrotik Router i can only reach/ping Public IPs if i set as Source Address the Loopback’s created. And can’t for example upgrade my Router packages because it says couldn’t resolve upgrade.mikrotik.com.

What should i set on the IP>Dns for Mikrotik to solve address using my available public IPs?
Since now what i have is
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,4.2.2.2

Nevermind Sob, problem was on Default Route to My ISP Router (10.0.0.2), I managed to use the 200.x.x.1 as default source address on:

/ip route
add distance=1 gateway=10.0.0.2 pref-src=200.x.x.1

Dont know if its the best way but is working