[Solved] Multiple static leases to same MAC address possible?

Hello everyone,

Is it possible to set static leases in DHCP and DNS (dnsmasq) to allow for two different fixed ip addresses to be assigned to the same MAC address?

I have a linux based box (Debian derivative) that has eth0 and what I suppose is an alias interface named xx@eth0. Both use the same Mac address. Both interfaces are set to get their IP addresses from DHCP.

I'm willing to set well defined known IP addresses to both interfaces, but have failed to do so. I first tried adding only one static lease via the GUI, which was accepted by Luci normally. Unfortunately, once I rebooted the linux system, it refused to get the IP address I set in DHCP and DNS as a static lease.

I then tried to manually edit /etc/config/dhcp and add two separate config host entries, the first with option IP '192.168.1.100' and the second with option IP '192.168.1.101'. Each config host entry was also set with the same option mac 'xx:xx:xx:xx:xx:xx' and each one got a unique option name ('name-x' and 'name-y'), respectively. I then restarted dnsmasq with /etc/init.d/dnsmasq restart and it restarted successfully.

But the linux box still refused to get the static ip leases as defined above.

Is it possible, at all, to set dnsmasq in OpenWRT to lease different ip addresses to different interfaces using the same mac address?

TIA

No. The DHCP server would have no way to distinguish between the two interfaces if they both have the same MAC address.

Thanks, @krazeh
Much appreciated

Hey @krazeh ,

In fact, I just learned that IT IS possible.
I was searching the internet about dnsmasq and found out the following paragraph, from https://www.linux.com/topic/networking/dns-and-dhcp-dnsmasq/

Set Static Addresses from DHCP

This is my favorite thing. You may assign static IP addresses to your LAN hosts by MAC address, or by hostname. The address must fall in a range you have already configured with dhcp-range=:

dhcp-host=d0:50:99:82:e7:2b,192.168.10.46
dhcp-host=turnip,192.168.10.45

So I thought, what if I tried manually editing /etc/config/dhcp by adding two config host entries, as before, but leaving out the option mac line, only identifying my hosts by hostnames, as suggested by the above?

So I tried and it works!

config host
        option ip '192.168.1.101'
#	 option mac '99:99:99:99:99:99'
	option name 'My-Linux-Box'
	option dns '1'

config host
        option ip '192.168.1.102'
#        option mac '99:99:99:99:99:99'
        option name 'xx-My-Linux-Box'
        option dns '1'

It's always nice to be able to learn a new thing everyday. :grinning:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.