临时修改:
vim /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
永久1:
/etc/dhcp/dhclient.conf
在尾部增加
supersede domain-name-servers 8.8.8.8, 8.8.4.4;
重启网卡:systemctl restart networking.service
永久2:
/etc/network/interfaces
在对应网卡下方增加
dns-nameservers 8.8.8.8 8.8.4.4
示例:
auto eth0
iface eth0 inet static
address 192.168.0.188
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4
重启网卡:systemctl restart networking.service
|