在 RedHat/Centos 6.x 下,我在 /etc/sysconfig/network-scripts/ifcfg-eth0 中使用 DHCP_HOSTNAME=`hostname -s` 将客户端主机名传递给 DHCP 以在 DNS 中注册,并且运行正常。我现在正在使用 RedHat 7,它似乎运行不稳定,甚至根本不能运行。
我有一台特定的虚拟机(如果相关的话,它是克隆的),它不会向 DHCP 注册其主机名,因此无法通过 DNS 注册。我尝试过 DHCP_HOSTNAME=`hostname`、DHCP_HOSTNAME=$(hostname) 和其他变体,但我还尝试过 DHCP_HOSTNAME=(actual hostname),但无济于事。禁用 NetworkManager 似乎没有效果。DHCP/DNS 服务器位于 Windows/AD 中,DHCP 配置为在 DNS 中更新主机名。其他 Linux 变体(Ubuntu/Debian 衍生产品、Redhat/Centos 6.x)不会出现此问题。
还有人遇到过这种情况吗?如果您能提供任何见解,我将不胜感激。
更新一些更多信息。事实证明,DHCP 选项 12 正在发送,但 dhclient 也在请求它。我想知道这是否会对 DHCP 服务器造成一些混淆。这是预期行为吗?
tcpdump/dhcpdump 输出:
[root@myhostname ~]# tcpdump -lenx -i 3 -s 1500 port bootps or port bootpc | dhcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens192, link-type EN10MB (Ethernet), capture size 1500 bytes
TCPdump 3.8.x output
TIME: 09:36:15.438666
IP: > (00:50:56:92:7c:55) > (Broadcast)
OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
HLEN: 6
HOPS: 0
XID: 932b3b7f
SECS: 0
FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 00:50:56:92:7c:55:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION: 53 ( 1) DHCP message type 3 (DHCPREQUEST)
OPTION: 50 ( 4) Request IP address 192.168.50.79
OPTION: 12 ( 19) Host name myhostname
OPTION: 55 ( 18) Parameter Request List 1 (Subnet mask)
28 (Broadcast address)
2 (Time offset)
121 (Classless Static Route)
15 (Domainname)
6 (DNS server)
12 (Host name)
40 (NIS domain)
41 (NIS servers)
42 (NTP servers)
26 (Interface MTU)
119 (Domain Search)
3 (Routers)
121 (Classless Static Route)
249 (MSFT - Classless route)
33 (Static route)
252 (MSFT - WinSock Proxy Auto Detect)
42 (NTP servers)
---------------------------------------------------------------------------
TIME: 09:36:15.441067
IP: > (00:50:56:92:44:c4) > (Broadcast)
OP: 2 (BOOTPREPLY)
HTYPE: 1 (Ethernet)
HLEN: 6
HOPS: 0
XID: 932b3b7f
SECS: 0
FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 192.168.50.79
SIADDR: 192.168.50.28
GIADDR: 0.0.0.0
CHADDR: 00:50:56:92:7c:55:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: pxelinux.0.
OPTION: 53 ( 1) DHCP message type 5 (DHCPACK)
OPTION: 58 ( 4) T1 3600 (60m)
OPTION: 59 ( 4) T2 6300 (1h45m)
OPTION: 51 ( 4) IP address leasetime 7200 (2h)
OPTION: 54 ( 4) Server identifier 192.168.50.4
OPTION: 1 ( 4) Subnet mask 255.255.255.0
OPTION: 15 ( 10) Domainname domain.local
OPTION: 6 ( 12) DNS server 192.168.1.4
OPTION: 3 ( 4) Routers 192.168.50.1
---------------------------------------------------------------------------