statick DHCP same IP for the same computer via ethernet or wifi

I have set static DHCP for some computers, but they sometimes arerconnected through ethernet and other times through wifi. As the mac are different in either case, static lease only work for one interface. It is possible to use the same static lease for both interfaces?

best regards

Hmm never heard of that. Interesting question.
I simply make both IPs static so that the device has a fixed IP for wired and a fixed IP for wifi.

Depends on how forgiving the RouterOS DHCP server is, I guess. If it allows you to create two static leases for the same IP address but with different MAC addresses, it’s probably possible. Give it a try, I’d say.

You can not have the Same IP in a static Lease even for a different MAC address…
Just make a better network planning..

If I make static the second lease and then try to change the ip to the same as the first one it reports an error "Couldn’t change DHCP Lease - already have static lease with this IP address.
I wonder if it will be possible using both macs in the same entry or a script or some other approach.

Although I agree it’s a bit of a hack, from a protocol point of view there is no reason why you couldn’t have two (or more, for that matter) static leases for the same IP address. Only one of them could be active at the same time of course, and you would need to check for that, but modern DHCP servers do confict detection by default or can be told to.

But the RouterOS DHCP server will not do conflict detection for static leases (no idea why not, as it does do it by default for dynamic ones) so you’re right, it won’t work in RouterOS.

(OK, I just saw the OP tried it and it will not even let you create the second lease)

One problem with the concept of having single static IP address for multiple network interfaces of same device is that not all network devices actually automatically disable one interface when the other one gets connectivity … sure there are some laptops that do it, but they have to run user-land software for that.

I agree that ROS not checking for address conflicts for static leases is a bug and it should actually get fixed. Possibly in ROS v7 as this bug is not really critical (DHCP clients are required to perform address conflict detection and should reject problematic lease … just in this case it would be endless loop of assign/reject because ROS would assign the same address over and over again.

sure there are some laptops that do it, but they have to run user-land software for that.

Actually you can change the Metric of the Interface itself… If i set my ethernet card with Metric e.g. 20 and my wireless card with Metric 19 then the wireless card will be used as default… If the traffic can not be routed through the default interface then the second interface with bigger Metric will be checked…
So no additional software is needed…

Well … metric is L3 function … MAC is L2 function … not saying it wouldn’t work overall, but if the interface with higher metric receives ARP request, it’ll answer with own MAC address none the less …

One possibility would be to use bonding in “active-backup” mode … which doesn’t require any support from network infrastructure. Here’s example config (section 4 Configuration - Example 2 (“Laptop-Mode”)) … which drops the problem of different MAC addresses to the client side.
I don’t know if such setup is possible on Windows (I imagine it is possible in MacOS).

I like the idea. Actually the computers I would like to assign static ips are linux machines, so I will give it a try.

Beware that this idea probably fails miserably if both interfaces don’t connect to same L2 network … I guess the same idea can be used with dynamic address acquisition (over DHCP) and such a bond will request IP address only when one of interfaces obtain connectivity (and both were without it previously) … if the link state trips and bond switches to the slave interface which is in different L2 network, bond’s IP address won’t be valid any more.