Associate a hostname with a MAC address on the LAN

Is there a way to associate a hostname to a specific MAC address through LuCI or text file? From what I see it can be done in LuCI only with IP address and not MAC.

You don’t necessarily have to put an IP address in LuCI. A hostname with a MAC address is sufficient.

I found what I was looking for. I was looking the wrong way. I went to the Network/Hostenames entry in LuCI instead it is in Network/DHCP and DNS/Static Leases. Here you can set names based on the MAC address. Thanks anyway, even if nothing was explained in your answer.

That does not work since LuCI is expecting a valid IP address or prefix as the design purpose of that option is to construct an appropriate reverse record (PTR) for a custom domain name that can be leveraged by dnsmasq. It works like an entry in /etc/hosts but instead integrates with UCI/LuCi via /etc/config/dhcp

config domain
	option name ''
	option ip ''

It does not work with clients that being assigned dynamic IPs.

The logic of a static IP lease is tying a client’s MAC | DUID with a fixed IP and as convenience set a symbolic hostname - basically serves as comment/note to remember which client the MAC and tied static IP belongs to.

Perfect. I understand this, but it works perfectly for my purpose and kresd is happy.

I was talking about “Network/DHCP and DNS/Static Leases”. Setting a blank IP address results in this in /etc/config/dhcp:

config host
        option name ''
        option mac ''

With that, the name is correctly assigned to the client.

That was not clear at all and if I am not mistaken the initial post been edited and pointed earlier to cgi-bin/luci/admin/network/hosts


results also that the host not being assigned an IP.

The

is assigned to static IP and only shows conveniently in LuCI, however it is not assigned to client at all - the hostname is set at the client side and being broadcasted upstream to the router and not vice versa.

Is there a way and what is it to have a name assigned to a MAC address and a dynamic IP? What procedure? Abstain dreamers and time wasters.

Only if

  • the client connects to the router via Bootstrap Protocol (BOOTP)
  • the client requests a hostname via DHCPREQUEST
  • the DHCP server supports DHCP option 12

Else not, and it makes sense in the context of DHCP where clients broadcast their hostname to the DHCP server and usually the hostname is easily editable on the client side.

Maybe you would like to elaborate what you want to achieve?

Example: I have a Samsung TV, in Turris OS TV’s hostname is ?
I would like something better to know immediately what device I am talking about.
Client side, i.e. on TV, I can’t change hostname.

It is a known bug [1] in OS that Samsung uses in their TV appliances and apparently cannot be bothered to fix it.

[1] https://eu.community.samsung.com/t5/TV/Why-quot-Host-Name-localhost-quot/td-p/425332


If it is matter of convenience use the static IP method

It is not the only operating system (cursed Tizen OS!) to have this problem. I have 15 hosts connected and at least half of them don’t have an understandable name, mostly a nice question mark. To move in the tribe, I have to name each one.

In the end it is the method I used, not being able to do otherwise.

Such would indicate bugs in their DHCP handling or lack of providing hostname manipulation…

That said, it seems that even iOS has some trouble with DHCPv6, the device provides its hotsname via DHCPv4 but only its DUID via DHCPv6

Networking is an idiosyncratic world. It is a living body in constant change. It has nothing logical. Attempts are made through protocols, conventions, but then it’s chaos. So we find it with a thousand bugs and flaws of all kinds. But it’s not anyone’s fault. Welcome to the network: made of logic and irrationality.

I would beg to differ - if vendors fail to implement current industry standards, best example are cheap IoT devices with gaping security flaws, only then it becomes somewhat twisted.

Not that some of the standards are not flawed either, to begin with, but vendors adding on top does not help.

I agree with you, except that I also include in the networks the hosts, devices, PCs, appliances and everything that connects and all the firmware and BIOS, but also all the same protocols, sometimes a thousand that do the same thing in a thousand different ways. Indeed, the network is made up of devices and software, whether it connects or is connected.