大网数据广告活动
服务器运维问答

How to supply hostname using isc-dhcp-server to hosts without fixed-address

· 52CE 我爱测

I have a DHCP+DNS setup on my network using bind9 and isc-dhcp-server . It works fine for all clients that have a "proper" hostname configured without any special setup in dhcpd.conf in the server. There are also a couple of host…

问题原文

原帖链接 · xxDMxx · CC BY-SA 4.0

I have a DHCP+DNS setup on my network using bind9 and isc-dhcp-server. It works fine for all clients that have a "proper" hostname configured without any special setup in dhcpd.conf in the server. There are also a couple of hosts I have setup with fixed addresses using blocks like the following:

option domain-name "dyna.mynet";

host someserver {
  hardware ethernet 00:11:22:33:44:55;
  fixed-address someserver.mynet;   # someserver.mynet has a DNS entry in bind9
  server-name "nameserver.mynet";
}

So using the above, this host is reachable via someserver.mynet and via someserver.dyna.mynet.

However, without the fixed-address I can't get host sections like this working.

e.g. Another host block in the same dhcpd.conf

host worklaptop {
  hardware ethernet AA:BB:CC:DD:EE:00;
}

I've also tried:

host worklaptop {
  hardware ethernet AA:BB:CC:DD:EE:00;
  option host-name "worklaptop";
}

Neither works. I don't see any entries like Added new forward map from ... as I would expect in the logs.

Is there anything else I need to add?

Edit:

Just to clarify based on one of the comments, I don't need the actual device hostnames to change. I just need a DNS entry to be added, so I can address these devices using a DNS name.

Related info:

I think what the problem might be with the laptop is that it is a windows laptop and advertises the hostname with full work AD domain name e.g. worklaptop.mywork.com. And i don't have a DNS Zone for mywork.com in my LAN.

The other devices that don't get a name are things like Elgato lights, that have spaces in their hostname. I can't seem to override those hostnames either with these host blocks in the dhcpd.conf file.

已采纳解答

原帖链接 · Lacek · CC BY-SA 4.0

Names for DNS entries should be specified by the ddns-hostname option for every client you want to create DNS record for. According to the dhcpd.conf man page:

ddns-hostname name;

The name parameter should be the hostname that will be used in setting up the client's A and PTR records. If no ddns-hostname is specified in scope, then the server will derive the hostname automatically, using an algorithm that varies for each of the different update methods.

Note that the ddns-hostname should contain the host name only, the domain name will be appended using the value given in the domain-name option.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-06-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。