What's new

Setting up 2 mac addresses to same IP in dnsmasq.conf.add

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

lokester

Occasional Visitor
Long time user of Asus routers and Merlin firmware, but just a novice.. I just started using "dnsmasq.conf.add" for IP address manual assignment and so far so good. In the case of phones and tablets that have dual wifi (2.4 and 5) capabilities, they show to have a separate MAC address for each radio. If I want to assign the same IP address to a device, regardless of whether they connect on 2.4 or 5 ghz, can I do this in dnsmasq.conf.add and if so, what would be the recommended way?

dhcp-host=[2.4 ghz mac], 192.168.1.123,AndroidPhone
dhcp-host=[5 ghz mac], 192.168.1.123,AndroidPhone

and I also read where maybe just put both MAC addresses on same line but with a single space in between.



 
Why are you trying to separate out the same MAC address based on which WiFi spectrum (2.4Ghz or 5Ghz) it connects to in the dnsmasq.conf.add file? What device are you using that has separate MAC addresses for each band (2.4Ghz and 5Ghz)?
Normally one would just put the single MAC address in, and let the tablet, phone, PC device itself select which WiFi spectrum it connects to. This way the same MAC address, IP # and name are used no matter which WiFi ban it connects to.
Example: dhcp-host=7C:61:66:xx:xx:xx,192.168.1.10,AmazonEchoDot

Edit to add: Some more context. Normally one would only connect to either the 5Ghz OR the 2.4Ghz band, not both at the same time. Generally you cannot have the same IP address being used by two or more network adapters at the same time. It will cause confusion if both network adapters are active at the same time using the same IP address.
One can specify two MAC addresses at once but generally only if a single adapter is active at any one time NOT both at the same time. Doing it this way may introduce errors or issues.
Example: dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.1.10,AmazonEchoDot
MAC Address #1: 11:22:33:44:55:66 in the example
MAC Address #2: 12:34:56:78:90:12 in the example
As a special case, in DHCPv4, 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,192.168.0.2 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 normal way is to simply assign a different IP address to each MAC address to avoid any potential issues.
 
Last edited:
Your doubt that my device had more than one MAC address got me looking at my Android phone a bit closer. There is a Privacy setting that randomizes the MAC address rather than link up with the device's physical MAC address. So I was in error, there is just one MAC, but the phone kept changing the MAC that the router was seeing, so I made a bad assumption that each radio had its own MAC.
I feel foolish. I will turn that setting off and move on.

Thanks for being so quick to raise the doubt. Problem solved.
 
I actually have a use case for this. Normally I'd use the WiFi for my notebook's connection. But occasionally I do use a wired connection for things like file transfers, server maintenance, backups. Right now I have two manually assigned IPs in dhcp - just having one would be awesome. Is something like this workable?
 
I actually have a use case for this. Normally I'd use the WiFi for my notebook's connection. But occasionally I do use a wired connection for things like file transfers, server maintenance, backups. Right now I have two manually assigned IPs in dhcp - just having one would be awesome. Is something like this workable?

+1 on this point. Just for info, I had an old laptop that did have separate MAC address for the 2.4 and 5.0 radios. It was a weird laptop from day one..........
 
I actually have a use case for this. Normally I'd use the WiFi for my notebook's connection. But occasionally I do use a wired connection for things like file transfers, server maintenance, backups. Right now I have two manually assigned IPs in dhcp - just having one would be awesome. Is something like this workable?
Looks like you can specify more than one mac for same ip, or even use device id:
https://serverfault.com/questions/272299/dnsmasq-mapping-2-mac-addresses-to-the-same-ip-address

https://linux.die.net/man/8/dnsmasq

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,192.168.0.2 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.
Sorry, realized this was already stated by @bennor
 
Last edited:
I've just discovered that if I clone my NICs MAC to the wifi they're both operational with the same IP. This is under Ubuntu 22.04.
Observations. The notebook only shows in the network map when connected through wifi. Whether the wifi is on or off the LAN connects with the same IP though the LAN connection doesn't show in the map (stealth mode anyone?). So I can have the same IP on both interfaces no matter how it's connected. LAN takes priority when both are connected.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top