Opened 8 years ago

Closed 6 years ago

#6205 closed enhancement (fixed)

Static DHCP leases don't work if more then one MAC is associated with one IP address

Reported by: David Kovalský <david@…> Owned by: jow
Priority: normal Milestone: Features Paradise
Component: luci Version: Kamikaze trunk
Keywords: dhcp luci Cc:


My typical setup is that I have the same IP address for both my wired network interface and wifi. This was I'm able to keep my internet connection (usually through NetworkManager) when I pull out my network cable. I do this by mapping 2 MAC addresses to the same IP, which the WEB UI allows me to do.

If I set this up in KAMIKAZE (8.09.1, r16278) static mapping doesn't work and I get an IP address from the pool. Removing mapping my other MAC to other IP address makes static mapping work.

Please let me know if you need more information to diagnose the issue.

Attachments (0)

Change History (13)

comment:1 Changed 8 years ago by David Kovalský <david@…>

JFTR, I've checked with KAMIKAZE (8.09.2-RC2, r17574) and the issue is still present.

comment:2 Changed 8 years ago by Tony Butler <spudz76@…>

AFAIK, dnsmasq doesn't support this type of configuration, and neither does the full ISC DHCPd. The web interface accepts it and passes both mappings to dnsmasq, but it will ignore one of them because it is duplicate.

It would be nice to have this feature as I have had a setup like yours where I knew I would be using one or the other at any given time. And even if both did come up on the network simultaneously, the ARP/ping it already does to verify no host is already camping on the IP before it gives out the assignment would bounce the dupe off into the pool.

Probably the type of thing that should be created and submitted upstream directly to dnsmasq project, and then let it trickle down to OpenWRT. Unless of course there are philosophical reasons they do not want to support the feature, and then we'd just add it here with package patches.

comment:3 Changed 8 years ago by David Kovalský <david@…>

Tony, thanks for the comments!

It seems dnsmasq doesn't have a bug tracker, so I'll send an e-mail to dnsmasq-discuss@… soon.

FYI - this is possible in DHCPD (tested on Debian Lenny). My (working) config with private info stripped:

subnet netmask {                                            
        host host-wifi {                                                           
                hardware ethernet 01:23:45:67:89:01;                                  
        host host-wired {                                                          
                hardware ethernet 11:22:33:44:55:66;                                  

Works pretty well with my Fedora. I keep keep most of my apps/internet connections running without reconfiguring when I switch wired/wifi.

comment:4 Changed 8 years ago by richardvoigt@…

Did anyone even read the dnsmasq man page before concluding that dnsmasq wouldn't support it?

"As a special case, it is possible to include more than one hardware address. eg: --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12, This allows an IP address to be associated with multiple hardware addresses, and gives dnsmasq permission to abandon a DHCP lease to one of the hardware addresses when another one asks for a lease. Beware that this is a dangerous thing to do, it will only work reliably if only one of the hardware addresses is active at any time and there is no way for dnsmasq to enforce this. It is, for instance, useful to allocate a stable IP address to a laptop which has both wired and wireless interfaces."

The problem is your web tool making two separate dhcp-host entries with the same IP address (not allowed) instead of a single entry with two or more MAC addresses.

comment:5 Changed 8 years ago by David Kovalský <david@…>

comment:6 Changed 8 years ago by spudz76

[patchteam] Apologies for my shortsighted previous answer, it was based on wanting to do the same thing in the past but not coming up with a way to do it, but I just didn't dig deep enough once it didn't work the most obvious way.

So is this a Luci issue then? You didn't mention which web interface you were using.

comment:7 Changed 8 years ago by David Kovalský <david@…>

Yes, web UI is Luci

comment:8 Changed 8 years ago by spudz76

  • Component changed from packages to luci
  • Keywords luci added
  • Milestone changed from Kamikaze to Kamikaze Features Paradise
  • Owner changed from developers to jow
  • Type changed from defect to enhancement
  • Version changed from Kamikaze 8.09 to Kamikaze trunk

[patchteam] Assigning to jow and reclassifying, as this is now a confirmed Luci issue (and setting for trunk as 8.09.2 is final).

comment:9 Changed 8 years ago by jow

  • Resolution set to fixed
  • Status changed from new to closed

See r20074 - the dnsmasq uci now allows multiple mac addresses in config host sections and you can enter multiple macs separated by space in LuCI.

comment:10 Changed 8 years ago by anonymous

Since I didn't want to wait for another release I wrote a little bit of code to implement it

# diff /etc/init.d/dnsmasq_save /etc/init.d/dnsmasq
--- /etc/init.d/dnsmasq_save Thu Jun 10 20:22:27 2010
+++ /etc/init.d/dnsmasq Thu Jun 10 20:59:37 2010
@@ -44,6 +44,10 @@

append args "-i $1"


+append_dhcphost() {
+ append args "-G $1"

dnsmasq() {

local cfg="$1"
append_bool "$cfg" authoritative "-K"

@@ -73,6 +77,7 @@

append_parm "$cfg" "local" "-S"
config_list_foreach "$cfg" "server" append_server
config_list_foreach "$cfg" "interface" append_interface

+ config_list_foreach "$cfg" "dhcphost" append_dhcphost

append_parm "$cfg" "leasefile" "-l"
append_parm "$cfg" "resolvfile" "-r"
append_parm "$cfg" "tftp_root" "--tftp-root"

An example section in /etc/config/dhcp to use this looks like this:

config 'dnsmasq'

list 'dhcphost' '00:00:00:00:00:05,00:00:00:00:00:06,'

Don't ask how to patch if you don't know what a diff is, but maybe it will help someone :-)

comment:11 Changed 7 years ago by lkraav

if you're stumbling here like me wondering why your lame windows 7 laptop doesn't act right when switching between wired and wireless, while have dnsmasq assign them the same IP, read this:

hopefully nobody minds the side note.

comment:12 Changed 6 years ago by Zeridon

  • Resolution fixed deleted
  • Status changed from closed to reopened

Just tried this on OpenWrt Backfire 10.03.1-RC6 luci - 0.10+svn7852-1 and though the UCI and dnsmasq part work the LuCI one does not.

I can edit the config manually/uci but the web does not allow me to save.

The translation of config files to LuCI display is ok though

snip: (notice the red font/halo of the first line)

comment:13 Changed 6 years ago by jow

  • Resolution set to fixed
  • Status changed from reopened to closed

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.