Page 1 of 1

DHCP server static lease, one IP, multiple MAC ?

Posted: Mon Feb 19, 2007 8:43 pm
by Carl
In my network is 1 IP per customer, static dhcp and everything is fine.

but some clients have two or more computers (desktop + laptop).

with linux dhcp conf was like that:

host clientX_dektop { hardware ethernet 00:22:22:22:22:22; fixed-address 10.0.6.24; }
host clientX_laptop { hardware ethernet 00:11:11:11:11:11; fixed-address 10.0.6.24; }

everything worked fine (but one computer at once).


Tried same thing with Mikrotik RouterOS but can't make several dhcp static leases with same IP "Couldn't change DHCP Lease <10.0.6.24> - already have static lease with this IP adress (6).

is there any workaround ?

arp

Posted: Tue Feb 20, 2007 9:21 am
by ferry
Just go to ip - arp, and remove the mac address you want to. and if the arp appear again, just make it static. you can di it by right click and set it to static :lol:

Posted: Tue Feb 20, 2007 9:57 am
by janisk
this is not possible to add 2 different mac addresses to one ip address in RouterOS

Posted: Tue Feb 20, 2007 2:20 pm
by Carl
why is that limited ?

but is there any workaround for that ?

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Mon Aug 04, 2014 12:05 am
by wingolo
Hi all!

This is an old post, but I need to do the same thing.

I know that RouteOS do not manage different associations from mac addresses to one ip, but I was wondering if could be possible to bypass that, using a script that change the associations (static) mac-ip just before the dhcp assign the ip.

Any suggestions about how tu run a script just before the dhcp-server asign the ip?

Re:

Posted: Fri Oct 07, 2016 6:51 pm
by notToNew
this is not possible to add 2 different mac addresses to one ip address in RouterOS
That's quiet sad. I have lots of IP_Cams. When connected by wire, they automatically disable wifi. wired and wireless have the same mac,
and i need them to have the same IP and i don't care if they are connected by wire or just wireless...

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Fri Oct 07, 2016 7:23 pm
by pe1chl
If they indeed have the same mac on ether and wifi and you bridge the ethernet and wifi networks there
will be no issue I think. The DHCP server will give the same IP to each because mac is the same.

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Fri Oct 07, 2016 7:44 pm
by notToNew
Sorry, of course i was wrong! They do have DIFFERENT MAC-adresses, but there is always only one of them connected. wired or wireless.
so i'd need a feature to add static leases with different-macs and same ip!
most other dhcp-server allow this, so i don't understand why they implemented this limitation.

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Sat Oct 08, 2016 1:17 am
by wingolo
I'm glad to hear that i'm not the only one who need that function.
Unfortunatly It's due to that feature that I can't use the dhcp server on some routerboard :(

I do really hope to see, in a future (soon), this function implemented.

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Mon Oct 10, 2016 10:37 am
by janisk
if both interfaces have the same MAC, DHCP server will give you same IP address. If there are 2 MAC addresses, you will give different IP addresses. As weird solution, you can create VLAN for your camera and assign DHCP server with only 1 address in the pool with very short lease time, so when something changes, your camera would be able to get the only address in the pool.

It is not possible to add 2 static leases with the same IP address.

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Mon Oct 10, 2016 11:06 am
by pe1chl
It is not possible to add 2 static leases with the same IP address.
Maybe you can put that on the wishlist as it apparently is desired by some people to do that, and technically it should be no problem.
Of course the user is responsible when the two devices are online at the same time...

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Mon Oct 10, 2016 11:09 am
by janisk
it is not allowed because technically, you will have address conflict enforced by the DHCP-server. And if you suddenly have some switch with longer cache times you will have problems.

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Mon Oct 10, 2016 11:11 am
by pe1chl
As others have already written, it just works when using the Linux ISC DHCP server.
Of course there will only be a conflict when both MAC addresses are active at the same time, which probably cannot happen with the intended usage.
However, it will surely introduce the potential for errors when fixed IP addresses are configured for other purposes.

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Mon Oct 10, 2016 2:51 pm
by notToNew
it is not allowed because technically, you will have address conflict enforced by the DHCP-server. And if you suddenly have some switch with longer cache times you will have problems.
Is this a MIKROTIK rule as i cannot find this in the RFC? I have multiple other Routers and only really cheap router prohibit this aswell. Most other routers allow me this setting, alltough my
main firewall just ignore the static reservation if the ip is already taken...

For me, this limitation results in "more work, running a second device just for a better (more usable) dhcp"

Edit1: added questionmark

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Tue Oct 11, 2016 8:36 am
by janisk
long time ago this was made thas way.

As a workaround you can try to set up VRRP interface (without any slave interface, so you can add additional DHCP server (might work) and then add lease with different servers but same IP address. It is not something that can be changed easily.

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Tue Oct 11, 2016 10:35 am
by notToNew
long time ago this was made thas way.
It is not something that can be changed easily.
I understand this, but please also understand that unneeded limitations sometimes result in extra work for your support (for explaining the limitation) and for
your customers (for creating a workaround).
As a workaround you can try to set up VRRP ...
Did not work, the duplicate-check is still complaining, even on a different dhcp-server. I think that this isn't good aswell ;-)

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Tue Oct 11, 2016 10:48 am
by pe1chl
I understand this, but please also understand that unneeded limitations sometimes result in extra work for your support (for explaining the limitation) and for
your customers (for creating a workaround).
It might well be that another user has caused work for support by setting static IP addresses using DHCP and not checking that
every device has a unique address, then getting very strange and not-reproducible effects.
I have seen other postings where users were requesting extra checking/limitations to prohibit them from fouling up.
So the situation is not so easy. There probably would have to be an extra checkmark (default off) with "allow duplicates" that the
user would have to set before doing this and with many people asking what it is for.
Maybe it is easier when you just configure a static IP on your camera.

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Tue Oct 11, 2016 11:01 am
by notToNew
I have over 50 cameras, and my gateway or ntp sometimes change, so dhcp ist the preferred way ;-)

Configuration-faults are marked red in winbox, so i wonder if there should be an option to highlight "unsecure" configuration as blue, or any other color.
But i know, this isn't easy aswell.
I'd be very happy with an "allow duplicates"-setting, maybe even "allow duplicates-(beta)" for declaring it as an untested feature, but currently it seems to be easier to setup
a seperate linux-instance just for this. this would be a perfect usecase for a small linux-distro in metarouter, but sadly there is not much progress i see and i don't like old openwrt.

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Tue Oct 11, 2016 12:29 pm
by pe1chl
For a quick solution I would add a Raspberry Pi running Linux. It can often be used to add small functions that RouterOS cannot provide.
Indeed it would be nice to have a Metarouter running a standard Linux (e.g. Debian) instead of openwrt.

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Tue Oct 11, 2016 3:26 pm
by janisk
as I said before but this time I will make it clearer - allowing same IP address for different MAC addresses would require a general overhaul of DHCP server in RouterOS. Sorry, it is not on the "possible feature list" for now.

Re: DHCP server static lease, one IP, multiple MAC ?

Posted: Tue Apr 24, 2018 1:31 am
by alonzo
There is one nasty hack to achieve this - namely put pool instead of IP address into static lease. Namely:
Having myhost-ip (192.168.0.50) with mac-wlan (11:11:11:11:11:11) and mac-eth0 (22:22:22:22:22:22)
Go to IP-> Pool, create 2 pools:
dhcp-myhost-wlan 192.168.0.50 11:11:11:11:11:11
dhcp-myhost-eth0 192.168.0.50 22:22:22:22:22:22

Go to IP-> DHCP Server -> Leases , Add New:
Address: dhcp-myhost-wlan (don't use IP here)
MAC Address: 11:11:11:11:11:11

Add New:
Address: dhcp-myhost-eth0
MAC Address: 22:22:22:22:22:22

This hack has multiple side-effects, namely if both interfaces request DHCP, one will fail,
dhcp-server-name: failed to give out IP address: pool <dhcp-myhost-wlan> is empty

Tested on 6.41.4. Feel free to experiment