在绑定网络连接上设置 dns-nameservers

在绑定网络连接上设置 dns-nameservers

我们有一台运行 Ubuntu 12.04 Server 的服务器。

此服务器上有两个网络接口(eth0 和 eth1),我们已将它们绑定为 bond0。DNS 目前无法正常工作。如果我 ping google.com,则会收到无法解析主机的信息,但我可以正常 ping Google 的 IP 地址。

据我所知,我们只需要添加到dns-nameservers/etc/network/interfaces但我不确定它是否能以相同的方式与粘合连接一起工作。

这是居住生产服务器拥有大量用户,所以显然不想搞砸网络连接,因为我只有 SSH 访问权限!

有人能告诉我这是否是正确的方法吗?将名称服务器添加到绑定而不是每个单独的接口是否正确?

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet manual
bond-master bond0

auto eth1
iface eth1 inet manual
bond-master bond0

auto bond0
iface bond0 inet static
address 192.168.1.15
gateway 192.168.1.100
netmask 255.255.255.0
dns-nameservers 8.8.8.8 8.8.4.4 208.67.222.222
slaves eth0 eth1

或者有没有更简单的方法来更新名称服务器?我们过去把它们放在 resolv.conf 中,但现在重启时它会被覆盖。

答案1

无论如何,今天必须重启服务器以解决其他问题。我最初问题中的方法很有效。只需输入:

dns-nameservers 8.8.8.8 8.8.4.4 208.67.222.222

/etc/network/interfaces

相关内容