域名 dhcp 选项不适用于主机名 -f

域名 dhcp 选项不适用于主机名 -f

我的 Ubuntu 12.04.3 机器没有从 dhcp 获取应用于所返回的 FQDN 的域名选项hostname -fdnsdomainname未返回任何内容)。

IP配置:

# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether fc:4d:d4:31:89:cb brd ff:ff:ff:ff:ff:ff
    inet 10.101.100.166/16 brd 10.101.255.255 scope global eth0
5: vmnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:01 brd ff:ff:ff:ff:ff:ff
    inet 192.168.185.1/24 brd 192.168.185.255 scope global vmnet1
6: vmnet8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff
    inet 172.16.10.1/24 brd 172.16.10.255 scope global vmnet8

DHCP 租约末尾:

# tail -16 /var/lib/dhcp/dhclient.eth0.leases 
lease {
  interface "eth0";
  fixed-address 10.101.100.166;
  option subnet-mask 255.255.0.0;
  option routers 10.101.0.1;
  option dhcp-lease-time 14400;
  option dhcp-message-type 5;
  option domain-name-servers 10.101.200.1,10.101.200.2;
  option dhcp-server-identifier 10.101.200.1;
  option dhcp-renewal-time 7200;
  option dhcp-rebinding-time 12600;
  option domain-name "eng.sophos";
  renew 4 2013/10/03 14:14:24;
  rebind 4 2013/10/03 16:01:08;
  expire 4 2013/10/03 16:31:08;
}

解析.conf:

# cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.101.200.1
nameserver 10.101.200.2
search eng.sophos
search eng.sophos green.sophos

在 /etc/hosts 中:

# head /etc/hosts
127.0.0.1       localhost
127.0.1.1       abelard

答案1

RFC2132,第 3.17 节,DHCPdomain-name选项不指定要分配给客户端的域名。它指定客户端在 DNS 中解析主机名时应使用的域名。

正如您/etc/resolv.conf所显示的,resolvconf相应地将选项转换为search关键字。

除了充当不合格主机名的默认命名上下文(可以使用关键字searchin更通用地实现resolv.conf)之外,没有理由在系统上设置 FQDN,因为这是命名系统的属性,而不是机器本身的属性。

相关内容