尝试为旧 Linux 机器配置 DNS 服务。网络运行良好,通过 ip ping 可以到达互联网。但如果我通过名称ping www.google.com
命令 ping,则会挂起很长时间并给出答案:ping: unknown host www.google.com
/etc/network/interfaces:
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface uses static address
auto eth0
iface eth0 inet static
address 192.168.1.99
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
如何修复 DNS 服务?
答案1
你能换个台词吗
dns-nameservers 192.168.1.1
到
dns-nameservers 8.8.8.8
并在终端中执行
sudo service networking restart
ping www.google.com
之后还有工作吗?