Community discussions

MikroTik App
 
Carl
just joined
Topic Author
Posts: 2
Joined: Tue Jan 24, 2006 6:11 am

DHCP server static lease, one IP, multiple MAC ?

Mon Feb 19, 2007 8:43 pm

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 ?
 
ferry
Frequent Visitor
Frequent Visitor
Posts: 75
Joined: Mon Jan 15, 2007 11:59 am

arp

Tue Feb 20, 2007 9:21 am

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:
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Tue Feb 20, 2007 9:57 am

this is not possible to add 2 different mac addresses to one ip address in RouterOS
 
Carl
just joined
Topic Author
Posts: 2
Joined: Tue Jan 24, 2006 6:11 am

Tue Feb 20, 2007 2:20 pm

why is that limited ?

but is there any workaround for that ?
 
wingolo
just joined
Posts: 13
Joined: Thu Nov 28, 2013 4:36 pm

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

Mon Aug 04, 2014 12:05 am

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?
 
notToNew
Member Candidate
Member Candidate
Posts: 174
Joined: Fri Feb 19, 2016 3:15 pm

Re:

Fri Oct 07, 2016 6:51 pm

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...
 
pe1chl
Forum Guru
Forum Guru
Posts: 10542
Joined: Mon Jun 08, 2015 12:09 pm

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

Fri Oct 07, 2016 7:23 pm

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.
 
notToNew
Member Candidate
Member Candidate
Posts: 174
Joined: Fri Feb 19, 2016 3:15 pm

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

Fri Oct 07, 2016 7:44 pm

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.
 
wingolo
just joined
Posts: 13
Joined: Thu Nov 28, 2013 4:36 pm

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

Sat Oct 08, 2016 1:17 am

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.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

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

Mon Oct 10, 2016 10:37 am

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.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10542
Joined: Mon Jun 08, 2015 12:09 pm

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

Mon Oct 10, 2016 11:06 am

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...
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

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

Mon Oct 10, 2016 11:09 am

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.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10542
Joined: Mon Jun 08, 2015 12:09 pm

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

Mon Oct 10, 2016 11:11 am

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.
 
notToNew
Member Candidate
Member Candidate
Posts: 174
Joined: Fri Feb 19, 2016 3:15 pm

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

Mon Oct 10, 2016 2:51 pm

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
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

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

Tue Oct 11, 2016 8:36 am

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.
 
notToNew
Member Candidate
Member Candidate
Posts: 174
Joined: Fri Feb 19, 2016 3:15 pm

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

Tue Oct 11, 2016 10:35 am

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 ;-)
 
pe1chl
Forum Guru
Forum Guru
Posts: 10542
Joined: Mon Jun 08, 2015 12:09 pm

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

Tue Oct 11, 2016 10:48 am

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.
 
notToNew
Member Candidate
Member Candidate
Posts: 174
Joined: Fri Feb 19, 2016 3:15 pm

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

Tue Oct 11, 2016 11:01 am

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.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10542
Joined: Mon Jun 08, 2015 12:09 pm

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

Tue Oct 11, 2016 12:29 pm

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.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

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

Tue Oct 11, 2016 3:26 pm

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.
 
alonzo
just joined
Posts: 1
Joined: Tue Apr 24, 2018 1:14 am

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

Tue Apr 24, 2018 1:31 am

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