Dynamic mapping of Private IPs to Public IPs

We’ve private 172.16.1.0/24 pool of LAN ( 254 hosts- This the maximum concurrent users, but the total subscribers are more than 500). We also have public pool of eg. 1.1.1.0/24. All the users are HotSpot users. We have the requirement of dynamically mapping a public IP to the HotSpot user after it logs in.
Eg. User with IP 172.16.1.10 should be assigned any public IP from the 1.1.1.0/24 pool and that there should be logging of which public IP was assigned to the user along with the time-stamp. Say the user was assigned with public IP of 1.1.1.32. But as the user logs out, 1.1.1.32 should be free and any other HotSpot user who logs in could be assigned with the same IP.
We’ve tried using netmap rule, but that runs the rule even before user logs in, and also its flow is such way: User with private IP 172.16.1.10 is always assigned 1.1.1.10 (I guess it always makes the last octet similar for both private & public while mapping) and hence of no use.

The motive is of the total 500 subscribers since there are only 254 (maximum) concurrent users, we have to assign public ip to the logged in users & to log it to Syslog (This is to strictly deal with Cyber Crime mails and due to the norms of DoT)

WAN on eth1 - 2.2.2.2/30 with g/w 2.2.2.1
LAN (HotSpot) on eth2 - 172.16.1.1/24
Total subscriber - 500
Concurrent Users - 254

Would really appreciate help on this.


Shivakrishnan.

There may be a Miktotik way of doing this, but this sounds very much like a job for a separate RADIUS server.

Another option, since you have lots and lots of private address space, is that you can simply create another DHCP pool for the other users, and add new ones as your userbase outgrows the subnet size. Mikrotik’s DHCP server tends to hand out the same IP address to the same machine unless it has to recycle IPs. You can also periodically log in and make all the dynamic leases static.
That doesn’t really help you monitor the login/out very much, nor does it tell you anything about the activity of the users, but you do at least know who has what internal private IP.