Are multiple leases for one IP possible?

Hi,

I’m new to RouterOS so apologies if I’ve missed anything obvious and am asking a dumb question! I have a requirement to build three network testing stations to enable creation of specific line conditions. I think that RouterBoard/RouterOS will be the ideal platform for this and have bought a few units to test. I’ve got stuck however and hope that someone can assist me to resolve the issue or suggest a workaround for it. The configuration of the router in my test is as follows:
<internet_router> — <(eth1)RB750G(eth5)> — <device_being_tested>
The device being tested (a games console) has one physical external Ethernet port and an internal switch with two connected internal ports (referred to as G & D). I need to assign a sticky IP address to G (for a netmap) and an IP address from a pool to D. To do this I created a reservation for the MAC address of unit G and setup a pool. This worked as required (interface G got the sticky IP and was visible from the Internet, interface D got an address from the pool and was only visible internally). The complication is that we have a pool of devices used for testing. Ideally therefore I would like to be able to create leases for the MAC addresses of the G interfaces of several of our devices against the same IP address so that people can plug any device in and it will work (only one device would be connected to the router at any time). When I try to do this however the router report the error: Couldn’t add new DHCP lease - already have static lease with this IP address (6). I could get round the problem by installing an additional single board computer running Linux with the ISC DHCP server (as this will allow multiple reservations for a given IP address) but was wondering if there was a solution using the capabilities of the RT750?

I hope the above makes sense.

Thanks..

Egor.

Set the addresses on the devices themselves. I doubt you will find a device that will do a DHCP reservation for multiple devices to the same IP. Alternatively, depending on the device, you could spoof the MAC address of the first device so that they all have the same MAC address. Either way, you will need to do this on the devices themselves.

Set up the DHCP pool as a single IP pool and use extremely short (like 2 minute) leases? You’ll get a metric ton of network traffic but everything will get the same IP address lease, you’ll just need to wait a few minutes for the lease to expire as you switch devices before the new one will come online, but it’ll save you reconfiguring devices.

Hi folks,

I finally found a nice, workable solution to this problem so thought I would post it for those who stumble across this thread in future with the same issue. I discovered that whilst the RouterOS DHCP server will not allow you to create multiple leases with the same IP address if you use User Manager as a RADIUS server for DHCP then you can set the same IP address for each ‘user’ (MAC address).

I also needed to be able to give the same client MAC address a different IP address depending on what port it was connected to and it took me a while to figure out that this could also be done using User Manager. Steps to do this are as follows:

  • Add a DHCP server to the required interface ensuring that the ‘Use RADIUS’ option is selected.
  • Add the network information associated with the DHCP service.
  • Add a RADIUS server and select the DHCP service. Enter a value in the ‘Called ID’ field (I used the name of the DHCP server created above). Set the address field to the address of the port that the DHCP server configured above is running on. Enter a secret.
  • Create a new User Manager subscriber with the subscriber name the same as the ‘Called ID’ used above.
  • Add a router to the User Manager configuration using the IP address and Secret configured above.
  • Add Users (MAC addresses - NB must be in upper case) and their IP address assignments as required.

Repeat the above steps for any additional interfaces that you wish to configure.

NB: The above steps assume that User Manager is running on the same RouterBoard as the DHCP server. I’ve not tested these directions in an environment where User Manager is running on a separate box.

Combining the two solutions above I have been able to achieve the required goal of three interfaces running DHCP each of which is a distinct subnet and each of which only gives out the same reserved (sticky) IP address to the connected client (each interface is setup with a /30 subnet). I have a pool of client devices and when I connect any of those devices to any port and it will immediately get the correct reserved address.

Hope this info is helpful and saves others a bit of time.

Egor.

Thank you for posting the resolution that you found! Using RADIUS to work around this issue would not have occurred to me. Before I found this, I tried to work around the restriction by hacking the backup files, but did not have success…

The restriction of one lease per IP address does not make sense. Since you can have VRFs, and can run a different DHCP server for each VRF, there is no reason why you should not be able to statically assign the same IP address to different hosts covered by separate DHCP servers. It would make sense to display this error if someone tried to create a lease with the same address on the same DHCP server (or if there were a static lease created for “all” servers), but it should allow you to re-use the same address on different DHCP instances.

Unfortunately, the one downside to using RADIUS to work around this restriction – besides the fact that it is overkill, at least for my application, and also besides the fact that it means I have to install user manager, which is also overkill – is that even though it works, the DHCP leases table only shows one entry for every IP. If a client requests an address on DHCP server1, and then a client served by DHCP server2 is assigned the same address, then the lease assigned by server2 overwrites the lease previously assigned by server1. So you can’t see all of your active leases.

Hopefully in a future version of RouterOS, MikroTik will re-engineer the DHCP server code so that this restriction can be lifted.

– Nathan