Dhcp

使用 dnsmasq 分配分配給 dhcp 客戶端的 fqdn 的主機名?

  • July 16, 2018

我知道您可以通過在 dnsmasq.conf 中執行以下操作來分配靜態 DNS 條目名稱:

address=/wiki.leerdomain.lan/192.168.1.200
ptr-record=wiki.leerdomain.lan/192.168.1.200

然後使用 DHCP 使用相關機器的 mac 地址分配靜態 IP 地址(請參閱下面 OpenWRT 的 UCI 配置):

config host
   option name 'wiki.leerdomain.lan'
   option mac 'xx:xx:xx:xx:xx:xx'
   option ip '192.168.1.200'

但是,如何使用選項 DHCP 選項 12 設置 Linux 機器的主機名?(或者我已經用第二個片段這樣做了?)

我希望有問題的機器能夠執行命令hostname並接收選項 12 分配的主機名。

在 Dnsmasq 中,如果您可以直接編輯配置文件,則可以為 dhcp 客戶端指定主機名,如下所示:

dhcp-host=f8:da:0c:0a:af:c9,192.168.1.222,SpecialMachine,30d

這將為客戶端分配 MAC 地址f8:da:0c:0a:af:c9IP 192.168.1.222、主機名“SpecialMachine”和 30 天的 DHCP 租用時間。

$$ Apologies. In lieu of deleting this post, I figured, best to explain that in my case, what I wanted to accomplish was ensure that the device hostname showed up in my router as I wanted it. I did not verify that the device actually changed it’s hostname $$.

引用自:https://serverfault.com/questions/881233