What's new

Edited MAC address of static DHCP entry. Router won't give new device the old static IP address.

  • 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!

theirongiant

Regular Contributor
Will edit this after posting...

edit: in case you're wondering what's up, I'm getting dinged by the CloudFlare protection algorithm. My (attempted) post doesn't even include sample code or potentially malicious queries. I'm literally just trying to write a couple of short paragraphs describing my problem. I will continue edit attempts until I figure out the blocked word or phrase.

---

I had a static DHCP entry set for a computer in my homelab that has been replaced today. The new computer needs to have the same IP adddress as the old one. The MAC address is different, of course.

I logged into the router, went to the LAN settings > DHCP Server tab, and edited the Static entry for this IP/hostname to reflect the MAC address from the new computer. I double checked my work and clicked "Apply." Everything seemed to save correctly. I refreshed the page and it still looks good.

When I unplug and reconnect the Ethernet adapter, the device still shows a dynamically assigned IP address from the general pool.

There is an error message in the router logs indicating it does not want to give out this address because it's in the etc/hosts file, but it's not clear why.

Is this a bug? Should I edit the hosts file directly?


EDIT: are you kidding me...

this forum has CloudFlare protection triggered for text that starts with a forward slash and includes system paths. How are people supposed to discuss issues in the file system?


Example:

etc/hosts is allowed
but ∕etc/hosts is not allowed


(that last line contains a special Unicode slash, U+2215)
 
Last edited:
Static IP addresses are assigned at the client. Reserved IP addresses are assigned at the DHCP device. If the device needs a constitant IP address do it at the client!
 
Static IP addresses are assigned at the client. Reserved IP addresses are assigned at the DHCP device. If the device needs a constitant IP address do it at the client!

Sure, but the point is that it was working quite well until I replaced the computer.

Yes, I could set it statically on the computer itself and I think I'll resort to that... but having Static DHCP is useful in case the device is moved to another network ... or if I need to reset the router for an unrelated problem, and I'd still like to be able to reach that device by a dynamic IP without having to manually reset it. This is a small computer with no display, so interfacing with it would require physical access.

Edit: also, I'm using DNSFilter with this computer. DHCP hands out the list of DNS servers for devices with static reservations. It's very handy.
 
Last edited:
Is this a bug? Should I edit the hosts file directly?
It sounds like a bug because applying the DHCP changes should recreate the hosts file from scratch. But if it's not doing that I'm surprised nobody else has reported it. In any case have you rebooted the router? If that doesn't get rid on the conflicting hosts entry then there must be some custom script that's inserting it.
 
I think the log entry is misleading. I just changed the settings again and the two files (hosts, dnsmasq.conf) are both changing at the same time. The correct data is populated into DNSMasq.conf.
 
I just rebooted the router and both "hosts" and "dnsmasq.conf" appear to be exactly the same. They were also recreated after the reboot. I've now deleted the entry from the static DHCP list and will try adding it again.

Aha. I've gotten somewhere...

So here's the scenario:

The device is a computer with two network interfaces: Wi-Fi and Ethernet. Both are connected to the LAN. Local hostname set to "tardis". Wi-Fi needs to be enabled for some extra features to work.

The Asus router sees the Wi-Fi connection first and creates an entry in the client list called "tardis" with an IP address of 192.168.11.146. My DHCP pool is ranged from .100 to .254.

On the computer, I go to the Ethernet settings and enable DHCP for that interface. It connects to the LAN and obtains an IP address of 192.168.11.202.

On the Asus router, the Client List on the router contains no entry corresponding to the Ethernet interface. I can only find a client for the Wi-Fi adapter.

Now when I go to the static DHCP page to update the record, I create a new entry with the following information:

MAC address: F0:18:98:EC:17:29 (Ethernet interface)
IP address: 192.168.11.99 (static reservation outside the DHCP scope)
DNS Server: blank
Host name: "tardis"

Click the (+) button to add the entry. Click Apply to save changes.

From the SSH terminal I check the "hosts" and "dnsmasq" entries.

That's when I spot it:

dhcp-host=F0:18:98:EC:17:29,set:F0:18:98:EC:17:29,tardis,192.168.11.146

The web interface shows the same (incorrect) information.

PROBLEM: dnsmasq created an entry with the MAC address of the Ethernet interface, but the IP address of the Wi-Fi interface.

@RMerlin - is this a known bug, or a new bug?

TL;DR: one computer with two active network interfaces connected to the same LAN (i.e.: Wi-Fi and Ethernet). Only one interface gets an entry in the Client List. After setting a static DHCP entry, dnsmasq records the correct MAC address, but the wrong IP address.
 
Last edited:
dnsmasq keeps track of existing DHCP leases, and will keep it until it expires, or you reboot the router to flush the known leases.
 
dnsmasq keeps track of existing DHCP leases, and will keep it until it expires, or you reboot the router to flush the known leases.
I rebooted the router and it did not fix the issue.

What about the fact that the router only sees one "client" even though there are two MAC addresses ? The second MAC address isn't even showing up in the client list so I can't do anything with the MAC address. Several functions on the router have a drop down list with hostnames that map to those MAC addresses. Since the computer has two NICs connected to the LAN, I expect to see two clients with the same name. Instead, the router only shows one.
 
edit: the second MAC finally showed up in the Clients table some time this evening while I was out. I was able to set the static DHCP reservation. After cycling the Ethernet connection on the computer, it retrieved the desired IP address (192.168.11.99) instead of from the DHCP pool (.100 - .254).

It would appear that dnsmasq-dhcp, or perhaps just the web interface, depends on having a "client" matching the desired MAC address in order to configure the reservation properly.

Where is the list of MAC addresses stored for "client" ? In the /jffs folder, in /tmp, or purely in RAM?
 
Since the computer has two NICs connected to the LAN, I expect to see two clients with the same name. Instead, the router only shows one.
You can't have two NICs connected at the same time on the same network segment, that would cause routing loop issues, and also a hostname conflict since you can't have two "clients" with the same hostname.

The second MAC address isn't even showing up in the client list so I can't do anything with the MAC address.
Just manually type the MAC and IP address on the DHCP reservation page. You don't need to use the client networkmap to manage DHCP static leases, simply manually enter them. Just be aware that if you start reusing an existing IP or hostname for a different MAC, dnsmasq will refuse to allocate it as long as the previous lease hasn't expired.
 
You can't have two NICs connected at the same time on the same network segment, that would cause routing loop issues, and also a hostname conflict since you can't have two "clients" with the same hostname.


Just manually type the MAC and IP address on the DHCP reservation page. You don't need to use the client networkmap to manage DHCP static leases, simply manually enter them. Just be aware that if you start reusing an existing IP or hostname for a different MAC, dnsmasq will refuse to allocate it as long as the previous lease hasn't expired.

Sorry. I was using "NIC" as a shorthand for "network interface." One interface is Wi-Fi. The other is Ethernet. Same address space, different VLAN (br0 vs wl0).

I think that was the problem; the lease hadn't expired. I'll shorten the lease time to 1 hour.
 
One interface is Wi-Fi. The other is Ethernet. Same address space, different VLAN (br0 vs wl0).
Asuswrt does not use VLANs. br0 and wl0 are both on the same bridge, and therefore the same network segment. You can't connect both at the same time without causing issues.
 

Similar threads

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