网络ifup无法启动 eth0

BWG在迁移机房后,会出现网络无法使用的情况。

root@X:~# service networking restart
Job for networking.service failed because the control process exited with error code.
See "systemctl status networking.service" and "journalctl -xe" for details.

根据提示,输入systemctl status networking.service继续排查

root@X:~# systemctl status networking.service
● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-04-28 14:03:19 CST; 24s ago
     Docs: man:interfaces(5)
  Process: 1227 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
  Process: 1223 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle (code=exited, status=0/SUCCESS)
 Main PID: 1227 (code=exited, status=1/FAILURE)

Apr 28 14:03:19 X ifup[1227]: than a configuration issue please read the section on submitting
Apr 28 14:03:19 X ifup[1227]: bugs on either our web page at www.isc.org or in the README file
Apr 28 14:03:19 X ifup[1227]: before submitting a bug.  These pages explain the proper
Apr 28 14:03:19 X ifup[1227]: process and the information we find helpful for debugging..
Apr 28 14:03:19 X ifup[1227]: exiting.
Apr 28 14:03:19 X ifup[1227]: ifup: failed to bring up eth1
Apr 28 14:03:19 X systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Apr 28 14:03:19 X systemd[1]: Failed to start Raise network interfaces.
Apr 28 14:03:19 X systemd[1]: networking.service: Unit entered failed state.
Apr 28 14:03:19 X systemd[1]: networking.service: Failed with result 'exit-code'.

问题出现在这里:

Apr 28 14:03:19 X ifup[1227]: ifup: failed to bring up eth1

实际上,这是对eth1的映射已经损坏了。 通常,网络管理器可以自动修复这里问题,但如果没有它,你必须自己完成,首先运行:

root@X:~# networkctl

这显示了我所有的网络接口,比如 lo,ens18,ens19,这实际上应该是 lo,eth0,eth1。为了纠正映射,运行:

root@X:~# ip link set ens18 name eth0
root@X:~# ip link set ens19 name eth1

然后手动重启网卡

root@X:~# service networking restart
上一篇
下一篇