How to get "hostnames" to be used again?

I was using LEDE firmware from 02/01/2020 on my R7800 firmware a few days ago, then set the R7800 aside. Before I set it aside, I had entered maybe 10 or 12 host names under Network -> Hostnames. And the Bandwidth Monitoring and Status Overview was using the host names. Now I'm back using the same router, same LEDE firmware, and the host names are still in Network -> Hostnames. However, now the host names aren't being used in Status Overview or in the Bandwidth Monitor.

Is there anything I can do to get the firmware to use the host names that it has in the Bandwidth monitor and Status Overview? Another one of those things that I can't believe that someone else hasn't run into :-).

Thanks.

1 Like

Ah, I see what happened here. I entered hostnames corresponding to MAC addresses. The DHCP IP address at the time was also associated with the hostname. Then when I came back to using the router after a few days, and got a new set of DHCP addresses, the hostnames didn't work because the Bandwidth Monitor and Status Overview don't use the MAC address to get the hostname, even though the MAC address for each client is known, they use the IP address. So the clients that have different DHCP addresses now cannot be found, since the MAC address isn't used to look them up.

I can't say what a hokey implementation of hostnames this is. It's the MAC address that's characteristic of a client's identity, not it's current DHCP address, which is subject to change. This is just broken, and way too fragile to waste time on.

I'll need to delete and re-enter all the hostnames that now have different DHCP IP addresses than they had last time I used this router, which is the majority of them. What a mess, please fix this so that it relies on the information that you get from the actual hardware, not on a DHCP IP address that can change on the whim of the DHCP address server.

I guess I could make static address reservations for all my hosts, but geeze, that's what DHCP is supposed to avoid. What a mess.

I have noticed the same and agree with you that hostnames should be tied up to MAC addresses.
What is the purpose of the Network / Hostnames page? Is it just there for users to assign device names they will recognise? Or has it got another purpose..?
I would prefer not to set static addresses for my devices.

???

Are you saying that you have a problem if DHCP issues another IP?

Hosts are referenced in DNS by IP (to obtain hostname - A/AAAA), or by hostname (to obtain IP - PTR)...can you both explain this MAC address issue and how it relates to the lookup of hostnames?

Are you confusing DHCP and DNS?

Ok, so this post, https://superuser.com/questions/1260761/associate-mac-address-with-name-on-openwrt, put me in the right direction I hope.
Basically, /etc/config/dhcp can be edited to make sure hostnames are persistent even if the DHCP IP address of the device changes, you tie them up to the MAC addresses of the devices. You add the following at the end of the file.

config host
option name mydevice
option mac de:ad:be:ef:ca:fe

You can achieve (almost) the same in Luci by going to Network -> DHCP and DNS -> Static Leases. Click the add button, pick up your device MAC-Address and select "unspecified" for IPV4-Address. Leave the rest as it is.
When you use Luci, it adds the same lines as above in your /etc/config/dhcp file, plus an option dns '1'

Does anyone know what that DNS option is..?

I will now test these settings, it will hopefully work!

Yes, the problem arise when the DHCP server assign a new address to a device. In Status -> Overview and Bandwith Monitor, I end up with hostnames that are different from the ones I set in Network -> Hostnames.
I believe @ MrDoh face the same issue.

Can we see this config?

I honestly think you're trying to assign hostnames without assigning an IP address; otherwise I don't understand why you both admit the IPs change when the issue arises.

Thanks for your help lleachii. The issue arises when the IPs change, not the opposite.
I gave an easily recognisable hostname to each IP address/device on my network (done in Luci in Network -> Hostnames).
Here is an entry for one of the devices in /etc/config/dhcp:

config domain
option name 'phone'
option ip '192.168.1.3'

I also linked the device MAC address to the very same hostname (done in Luci Network -> DHCP and DNS).
Here is the entry in /etc/config/dhcp:

config host
option mac '00:03:4R:U1:LB:3A'
option name 'phone'
option dns '1'

I just rebooted my router, the device was given a new IP address by the DHCP server, but this time, the status page shows the very hostname I gave the device. Also, on the Hostnames page in Luci, the IP address of the hostname changed automatically to new one.

Let me know if I have created other potential problems by doing this! Otherwise, that's problem sorted.

PS: I need to learn markdown in this forum, if anyone know of some guide, please share it with me!

Already understood.

  • Are you sure that your phone's MAC isn't changing? Phones do that for security.
  • Why are you hostname configs missing a domain name?
  • Did you remove the domain setting from the DNS page?
  • Why did you specify the name twice - both in config domain and config host?

???

  • The MAC address hasn't changed after reboot, unless my memory fails me.
  • What should that domain name be for example? I only sent you an extract of the dhcp file obviously.
  • Which DNS page? I can think of 4 different places in Luci in Network where you can change DNS :smile: If you are talking about Network -> Interfaces -> WAN -> Advanced Settings -> Use custom DNS servers, I've got a set of DNS server addresses in there, they are my VPN provider servers.
  • To get around the issue. This is the only way I found for now. Like this, my phone's hostname is always reported as "phone", no matter what IP address the DHCP server assigned to it. Before, the hostname would become "Darius iPhone" once it changed IP address, it would ignore what I had selected in Network -> Hostnames.

I just want to have a consistent host-naming across Luci. For some devices, it's harder to change what they call themselves on your network and you get stuck with random names. With my fix, all is working as I want.

If anyone thinks this could cause other type of issues, let me know! Otherwise, this is case closed for me and hopefully I don't need more assistance in this thread :grin:

1 Like