在 16.04 上重新启动网络服务时出现问题

在 16.04 上重新启动网络服务时出现问题

我为 Ubuntu 16.04 上的专用服务器购买了新的 IP 地址,并尝试进行设置,但一直遇到一个问题;我无法正确重启网络服务,即使使用原始配置也是如此。这是我通过 systemctl status networking.service 获得的结果;

systemd[1]: Starting Raise network interfaces...
ifup[24985]: RTNETLINK answers: File exists
ifup[24985]: Failed to bring up eth0.
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_client_restrictions
networking.service: Main process exited, code=exited, status=1/FAILURE
Failed to start Raise network interfaces.
networking.service: Unit entered failed state.
networking.service: Failed with result 'exit-code'.

以下是接口文件的内容(当然我已经审查了地址);

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address xxx.xx.xx.146
    netmask 255.255.255.0
    network xxx.xx.xx.0
    broadcast xxx.xx.xx.255
    gateway xxx.xx.xx.254

auto eth0:0
iface eth0:0 inet static
    address yy.yy.yyy.153
    netmask 255.255.255.255

    post-up /sbin/ifconfig eth0:0 yy.yy.yyy.153 netmask 255.255.255.255 broadcast yy.yy.yyy.153
    pre-down /sbin/ifconfig eth0:0 down

原始文件(从 .bak 文件复制过来)和使用新 IP 的编辑文件都出现此错误。网络服务由于未指定的原因无法运行。如果我尝试直接 ifup eth0,我会得到“文件存在”和“无法启动 eth0”行。然而,尽管关闭了,但 IP 似乎在接口配置中设置正确;它们正确映射到相应的接口(eth0、eth0:0),相应的 Apache/Postfix/Dovecot 安装似乎也可以正常工作。

然而,当通过 networkctl 查看时,这是我得到的结果;

WARNING: systemd-networkd is not running, output will be incomplete.

IDX LINK             TYPE               OPERATIONAL SETUP
  1 lo               loopback           n/a         unmanaged
  2 bond0            ether              n/a         unmanaged
  3 dummy0           ether              n/a         unmanaged
  4 ifb0             ether              n/a         unmanaged
  5 ifb1             ether              n/a         unmanaged
  6 eth0             ether              n/a         unmanaged
  7 eth1             ether              n/a         unmanaged
  8 teql0            void               n/a         unmanaged
  9 tunl0            tunnel             n/a         unmanaged
 10 sit0             sit                n/a         unmanaged
 11 ip6tnl0          tunnel6            n/a         unmanaged

接口名称显然是 eth0,而不是其他名称。我想知道是否有某种 dhcp 服务干扰,或者是否有其他服务实际管理接口。我不认为安装了 NetworkManager,因为在刷新 eth0 后让服务器再次可 ping 通的唯一方法是尝试启动网络,但网络仍然会因同一错误而崩溃。我担心的是,这会导致服务器在硬重启时无法 ping 通。

有人对这个问题有什么建议吗?

EDIT1:jones0610 要求 ifconfig -a,这是针对 eth0 和 eth0:0 的

eth0      Link encap:Ethernet  HWaddr 0c:c4:7a:c3:4e:f2
          inet addr:xxx.xx.xx.146  Bcast:xxx.xx.xx.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2283 errors:0 dropped:0 overruns:0 frame:0
          TX packets:251 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:149408 (149.4 KB)  TX bytes:41071 (41.0 KB)

eth0:0    Link encap:Ethernet  HWaddr 0c:c4:7a:c3:4e:f2
          inet addr:yy.yy.yyy.153  Bcast:yy.yy.yyy.153  Mask:255.255.255.255
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth1      Link encap:Ethernet  HWaddr 0c:c4:7a:c3:4e:f3
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

这是 var/log/syslog 中发生的情况,可能是 postfix 的问题吗?

Jun 16 09:26:32 www postfix[3583]:  * Reloading Postfix configuration...
Jun 16 09:26:32 www postfix[3588]: Postfix is running with backwards-compatible default settings
Jun 16 09:26:32 www postfix[3588]: See http://www.postfix.org/COMPATIBILITY_README.html for details
Jun 16 09:26:32 www postfix[3588]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
Jun 16 09:26:32 www postfix/master[1773]: reload -- version 3.1.0, configuration /etc/postfix
Jun 16 09:26:32 www postfix[3583]:    ...done.
Jun 16 09:26:32 www systemd[1]: Reloaded LSB: Postfix Mail Transport Agent.
Jun 16 09:26:32 www systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Jun 16 09:26:32 www systemd[1]: Failed to start Raise network interfaces.
Jun 16 09:26:32 www systemd[1]: networking.service: Unit entered failed state.
Jun 16 09:26:32 www systemd[1]: networking.service: Failed with result 'exit-code'.

相关内容