我希望 tp 取代名称服务器信息,这些信息是我使用自己的配置从 DHCP 服务器获取的。因此,我在我的中使用以下选项/etc/dhcp/dhclient.conf
:
supersede domain-name-servers 1.1.1.1, 2.2.2.2, 3.3.3.3;
一切正常,但我想添加 IPv6 地址,而且这是双堆栈服务器。以下语句不起作用(我进入/etc/dhcp/dhclient.conf line 56: semicolon expected.
系统日志):
supersede domain-name-servers 1.1.1.1, 2.2.2.2, 3.3.3.3, ::1, 2000::BEEF, FURTHER_IPv6_ADDRESS;
所以我的问题是:如何将 IPv6 地址添加到supersede domain-name-servers
中的选项中/etc/dhcp/dhclient.conf
?
答案1
背景
我发现这个错误中埋藏着解决方案,标题为:Bug 643890 - dhclient 拒绝添加 ipv6 域名服务器。
Jiri Popelka 2010-10-18 15:37:46 UTC
(In reply to comment #0)
> prepend domain-name-servers 2001:470:20::2 ;
correct is
prepend dhcp6.name-servers 2001:470:20::2;
(see dhcp-options(5) man page)
but it seems that dhclient is really ignoring it.
I'm trying to figure out what's wrong.
的手册页dhcp-options
也显示了它:
option dhcp6.name-servers ip6-address [, ip6-address ... ] ;
The name-servers option instructs clients about locally available
recursive DNS servers. It is easiest to describe this as the "nameserver"
line in /etc/resolv.conf.
修复示例
因此,在我的客户端上,我添加了以下几行来执行双堆栈(IPv4 和 IP6):
$ cat /etc/dhcp/dhclient.conf
...
...
## Global section example
prepend domain-name-servers 192.168.7.14,192.168.7.85;
prepend dhcp6.name-servers 2602:6030:dd00:d807::1a11;
## Interface section example
interface "eth0" {
prepend domain-name-servers 192.168.7.14,192.168.7.85;
prepend dhcp6.name-servers 2602:6030:dd00:d807::1a11;
}
...
...