我DNS在/etc/resolvconf/resolv.conf.d/base文件中设置了静态:
nameserver 8.8.8.8
nameserver 8.8.4.4
Run Code Online (Sandbox Code Playgroud)
但是我的电脑仍然从 DHCP 获取 DNS,这是我的/etc/resolv.conf:
nameserver 192.168.100.2
nameserver 8.8.8.8
nameserver 8.8.4.4
Run Code Online (Sandbox Code Playgroud)
如何忽略DNS从DHCP服务器获取?
cuo*_*glm 36
您可以将此行添加到您的/etc/dhcp/dhclient.conf:
supersede domain-name-servers 8.8.8.8, 8.8.4.4;
Run Code Online (Sandbox Code Playgroud)
然后重新启动网络或运行dhclient以进行更改。
来自man dhclient.conf:
The supersede statement
supersede [ option declaration ];
If for some option the client should always use a locally-configured
value or values rather than whatever is supplied by the server, these
values can be defined in the supersede statement.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
38497 次 |
| 最近记录: |