How to predefine hostnames for DHCP leases?

Normally one can define hostnames that are proposed/sent to the client. I thought this is “Client ID” but now my static leases got ignored: This seems to be a MATCHING field, along with the MAC address. So I have to leave that one empty. In my opinion, static leases should only match MAC address, but ok…

But now there is no field left to define a hostname. (DHCP host-name option). How can I define it for a static lease?

You can’t. Hostname dhcp server gets from client, not sends to it. Add comment to static lease if you need to identify it.

:open_mouth: :open_mouth: :frowning: :frowning: :frowning:

Crazy.
Every other DHCP server supports this.
Sad that RouterOS has to stand out

If you say so…

Perhaps you mean option 012 hostname, it is supported
https://help.mikrotik.com/docs/display/ROS/DHCP#DHCP-DHCPOptions.1

Thank you!

Options are a global setting … how would I make the connection to the lease and and where would/could the hostname be stored?

The link mentions $(HOSTNAME) but to me it’s unclear where the value of this variable actually comes from (and how it connects to a specific lease entry).

Or … create one entry in options for each lease and then reference it?

Like:

/ip dhcp-server option
add code=12 force=yes name=hostname-iPad1 value="'iPad1'"
add code=12 force=yes name=hostname-iPad2 value="'iPad2'"

/ip dhcp-server lease
add address=192.168.1.101 comment=iPad1 dhcp-option=hostname-iPad1 mac-address=XX:XX:XX:XX:XX:XX server=dhcp-server
add address=192.168.1.102 comment=iPad2 dhcp-option=hostname-iPad2 mac-address=XX:XX:XX:XX:XX:XX server=dhcp-server

Is this what you mean?

Never used this server-side, but should work

At least some really widely used one support this indeed:

Well. Maybe not "every other". But really widely used ones.

From the cited document:

It should be noted here that most DHCP clients completely ignore the host-name option sent by the DHCP server, and there is no way to configure them not to do this. So you generally have a choice of either not having any hostname to client IP address mapping that the client will recognize, or doing DNS updates. It is beyond the scope of this document to describe how to make this determination.

So this feature has very questionable benefit.

It comes from the DHCP client.

So this feature has very questionable benefit.

Not at all. it is very usefull to dynamically booting diskless machines. I have been using it for years in my university lab with FreeBSD/Linux and Windows machines,
and dynamically registering these names in DNS.

This.
I usually boot (dynamically) two or three diskless machines every day, just before breakfast.