Ubuntu 添加第二个网卡导致网络重启失败

Ubuntu 添加第二个网卡导致网络重启失败

我正在运行 Ubuntu 16.04 LTS 机器并尝试在其上安装第二个 NIC。以下是 /etc/network/interfaces 配置:

源 /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

#nic1
auto et6543
iface et6543 inet static
address 10.16.15.100
netmask 255.255.255.0
gateway 10.16.15.1
dns-nameservers 10.16.15.141
dns-domain example.ext

#nic2
auto et1234
iface et1234 inet static
address 10.16.16.100
netmask 255.255.255.0
gateway 10.16.16.1
dns-nameservers 10.16.15.141
dns-domain example.ext

当我添加第二个网卡信息时,尝试重新启动网络服务时会失败... ifconfig 显示正确的网络信息,但无法从服务器上方的交换机访问网络。我感觉这些错误是造成这种情况的原因。

错误是:

解析池 ntp.ubuntu.com 时出错:名称解析暂时失败(-3)管理员:无法解析主机 webserver1 管理员:默认条目有问题;TTY=pts/1;PWD=/;

答案1

我认为您正试图让该服务器可从两个网络访问,但当服务器连接到互联网时,您只需使用其中一个网络,即 DMZ。否则,您根本不需要将其放在 DMZ 网络上,因为内部网络也连接到互联网(基于它有一个网关 - 相反的情况相当罕见)。

  • 从内部网络接口(我猜一定是 nic2/et1234)中删除默认网关。您不需要路由到0.0.0.0这里,因为您想使用路由器10.16.15.1连接除内部网络之外的任何设备10.16.16.0/24
  • 根据错误,您可能没有路由到网络10.16.15.141上的名称服务器10.16.16.0/24。删除它(或用在此接口上工作的 DNS 服务器替换,如果需要)。所有递归 DNS 查询都可以使用来自10.16.15.1nic1 的。

最终配置:

#nic1 - external DMZ
auto et6543
iface et6543 inet static
address 10.16.15.100
netmask 255.255.255.0
gateway 10.16.15.1
dns-nameservers 10.16.15.141
dns-domain example.ext

#nic2 - internal
auto et1234
iface et1234 inet static
address 10.16.16.100
netmask 255.255.255.0

相关内容