我一直试图启动网络服务,但它不起作用。我收到以下错误。我尝试了很多方法,但都没有用。
root@cerberos:~# 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 命令后,我得到了以下信息:
● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Drop-In: /run/systemd/generator/networking.service.d
└─50-insserv.conf-$network.conf
Active: failed (Result: exit-code) since Thu 2019-04-04 14:47:36 UTC; 5min ago
Docs: man:interfaces(5)
Process: 749 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
Process: 746 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle (code=exited
Main PID: 749 (code=exited, status=1/FAILURE)
Apr 04 14:47:36 cerberos systemd[1]: Starting Raise network interfaces...
Apr 04 14:47:36 cerberos ifup[749]: Cannot find device "eth0"
Apr 04 14:47:36 cerberos ifup[749]: Failed to bring up eth0.
Apr 04 14:47:36 cerberos systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Apr 04 14:47:36 cerberos systemd[1]: Failed to start Raise network interfaces.
Apr 04 14:47:36 cerberos systemd[1]: networking.service: Unit entered failed state.
Apr 04 14:47:36 cerberos systemd[1]: networking.service: Failed with result 'exit-code'.
lines 1-17/17 (END)
/etc/network/interfaces 下面的配置文件给了我这个。
# 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
# Source interfaces
# Please check /etc/network/interfaces.d before changing this file
# as interfaces may have been defined in /etc/network/interfaces.d
# See LP: #1262951
source /etc/network/interfaces.d/*.cfg
and the content of /etc/network/interfaces.d/ shows
uto eth0
iface eth0 inet static
address 10.4.0.2
netmask 255.255.255.0
gateway 10.4.0.1
dns-nameservers 10.4.1.12
实际上我无法理解为什么 ifup 无法找到 eth0 设备以及如何使其工作?
答案1
如果我正确理解了你的问题,你需要这样做......
改成/etc/network/interfaces
这样...
# 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
# Source interfaces
# Please check /etc/network/interfaces.d before changing this file
# as interfaces may have been defined in /etc/network/interfaces.d
# See LP: #1262951
# source /etc/network/interfaces.d/*.cfg
# and the content of /etc/network/interfaces.d/ shows
# auto eth0
# iface eth0 inet static
# address 10.4.0.2
# netmask 255.255.255.0
# gateway 10.4.0.1
# dns-nameservers 10.4.1.12
然后转到 NetworkManager GUI,创建一个新的Wired Connection
,将其设置为手动寻址,然后在那里输入上述静态信息。它应该是这样的……我的看起来和你的有点不同,因为我使用的是 18.10,但你会明白的……