simple masquerade

Here is the my first post here, hello to all,

I’m using MT with Radius manager, all of users do PPPoE connections and they get a public IP. I’m over limit with public IPs so NAT is the next solution in this moment until I get more IPs.
Is there a simple way to share one public IP to 2 or 4 hosts without big changing in setup of my MT. I think to run a masquerade on the public subnet and on some way start this options if it is possible.

Thank you,

As you are using your Mikrotik as Router for public IPs i dont think masquerade is the right option here. you need to use SRC-NAT. so to accomplish that just add one of the public IPs you have to your router WAN interface and use SRC-NAT for local IPs to SRC-NAT using this IP.

Example:

public IP that you gona use is: 1.2.3.4

local ip range is : 192.168.1.0/24

code to enable SRC-NAT:

/ip firewall nat add chain=srcnat src-address=192.168.1.0/24 to-addresses=1.2.3.4 action=src-nat

Thank you sariao,

In case as you explain me, we have always one of local subnet through one fixed public IP. I know that I can break the local subnet in small subnets with small number of hosts, or I can make address lists and connect one address list to one public IP. All these are manual options.
I want to use some dynamically option and when number of customers spend all of public IP(first pool) then they will take the IPs from other smallest public pool (as a next pool) where they will share a one public per 4 local hosts. This option will come in only a short part of the day where I have all users active in the network so after that they will use again one local host per one public and the storm will calm.

that can be done i believe
post you current configurations i want to see how do you distribute your public IPs.

Here is that I think you need.

0 PPPoE_Public? 2.2.2.33-2.2.2.64
1 HotSpot 172.16.1.1-172.16.1.250
2 dhcp_pool1 192.168.8.1-192.168.8.253
3 PPPoE_Public1 1.1.1.1.11-1.1.1.254

1 Hotspot is the pool (DHCP enabled) from user come to make PPPoE connection, PPPoE server grant addresses from PPPoE_Public1. The next pool after “3” is “0” and there is small backup pool with public IPs that I ask for. That is all, I do not have any addition setup in firewall about this.
Please let me know if you need something more.

I would like to see your interfaces, ip address binding, and NAT rules if you have any.

How ever i will explain the general idea you can later modify it as you like.

In your scenario i am going to reserve 4 public IPs for the Router it self, these public ip are going to be used for NAT. i will take these IPs from your “PPPoE_Public1” scope and then i will cerate a new scope called “PPPoE_Private” this scope has 31 private IPs.

1- reserving 4 public ips:

/ip address
add address=1.1.1.251/24 int=[put your wan interface]
add address=1.1.1.252/24 int=[put your wan interface]
add address=1.1.1.253/24 int=[put your wan interface]
add address=1.1.1.254/24 int=[put your wan interface]

2- create your pools as follow:

/ip pool
add name=PPPoE_Public ranges=2.2.2.33-2.2.2.64 next-pool=PPPoE_Public1
add name=PPPoE_Public1 ranges=1.1.1.1.11-1.1.1.250 next-pool=PPPoE_Private
add name=PPPoE_Private ranges=192.168.101.1-192.168.101.31
add name=HotSpot ranges=172.16.1.1-172.16.1.250 
add name=dhcp_pool1 ranges=192.168.8.1-192.168.8.253

3- now i will devide your private ips into 4 groups each group contain 7 Ips, each group uses one public IP

/ip fire nat 
add chain=src-nat action=src-nat to-address=1.1.1.251 src-address=192.168.101.1/29
add chain=src-nat action=src-nat to-address=1.1.1.252 src-address=192.168.101.8/29
add chain=src-nat action=src-nat to-address=1.1.1.253 src-address=192.168.101.16/29
add chain=src-nat action=src-nat to-address=1.1.1.254 src-address=192.168.101.24/29

Now point your PPOE server to use “PPPoE_Public” as default pool.

Good luck