DHCP - Must hostname match actual hostname?

By "hostname" I mean the item by that name in LuCI's static lease setting, i.e.:

LuCI > Network > DHCP and DNS > Static Leases (tap) > Add (button)

or the 'option name' item in a /etc/config/dhcp block that looks like:

config host
	option mac '00:26:66:E5:80:15'
	option name 'N5b-WAN'
	option dns '1'
	option ip '10.10.10.4'

In that example, the hostname is N5b-WAN

Question: Must this hostname I enter by LuCI or command line match the actual hostname of the machine in question?

You may think, "Why can't just get the hostname right instead of wondring what happens when you get it wrong?"

The situation is that N5b is a (regular) router, and I may not know how to find out its hostname. Also it has two different MAC addresses on the WAN and the LAN side, and I want to have two separate static lease items for them going by two different names.

To my not inconsiderable agony, I learned that a hostname like "N5b WAN" (with space) entered into config quite broke the router, obliging it to be factory reset.

So again the question is, can I enter any hostname so long as it is not ungrammatical like "N5b WAN" (or leave it blank) or must it actually match the actual hostname? Thanks.

1 Like

No, it doesn't need to match, but it needs to be valid.
Short names are preferable as dnsmasq adds the domain.

1 Like

Have you worked a lot with computers on the system level?

Generally and always no matter what the computer is called and no matter what firmware is installed.
This seems to always apply, space is always unrecomended if you whant the system to do what you mean.

Space is written in system level with the underscore ’_’.

This is because computer systems most often see a space as a linebreak.

Thank you. My experiments with random names confirm that too.

1 Like

By no means. I have so far done most everything by clicking something, in Windows. Thanks for the tip.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.