-1

当我使用前缀名称服务器修改我的 /etc/dhcp/dhclient.conf 时,网络管理器重新启动后,生成的 resolv.conf 文件不包含这些服务器。我正在研究 Kali Linux。

这是我的 dhclient.conf

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
prepend domain-name-servers 208.67.222.222, 208.67.220.220;

修改后我运行

service network-manager restart

这是 cat /etc/resolv.conf 的输出

# Generated by NetworkManager
nameserver 192.168.1.254
nameserver 2001:b07:a99:4d41:ead1:1bff:fe7c:75eb

没有名称服务器。

4

2 回答 2

0

使用前置而不是取代

预先添加域名服务器 127.0.0.1;

root@debian:~# grep prepend /etc/dhcp/dhclient.conf       
#prepend domain-name-servers 127.0.0.1;

root@debian:~# 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 192.168.153.2
nameserver 192.168.88.1
search localdomain

root@debian:~# grep prepend /etc/dhcp/dhclient.conf
prepend domain-name-servers 127.0.0.1;

root@debian:~# /etc/init.d/networking restart
[ ok ] Restarting networking (via systemctl): networking.service.

root@debian:~# 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 127.0.0.1
search localdomain
于 2020-03-25T23:43:12.343 回答
0

使用代理链并通过在此步骤后删除 # 标签来激活名称服务器添加您的名称服务器信息并保存

于 2020-03-27T14:10:18.530 回答