无法启动 CentOS 7 “网络”服务

无法启动 CentOS 7 “网络”服务

我在一台有 6 个以太网端口的小型 PC 上安装了最小版本的 CentOS 7.2。我选择从安装中排除 NetworkManager,因为我更愿意使用基本网络服务或切换到使用 systemd-networkd。但是,我似乎无法启动网络或 systemd-networkd 服务。

    systemctl status network.service -l
��● network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network)
   Active: failed (Result: exit-code) since Tue 2011-05-10 00:01:22 UTC; 5min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 25591 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

May 10 00:01:22 localhost network[25591]: RTNETLINK answers: File exists
May 10 00:01:22 localhost network[25591]: RTNETLINK answers: File exists
May 10 00:01:22 localhost network[25591]: RTNETLINK answers: File exists
May 10 00:01:22 localhost network[25591]: RTNETLINK answers: File exists
May 10 00:01:22 localhost network[25591]: RTNETLINK answers: File exists
May 10 00:01:22 localhost network[25591]: RTNETLINK answers: File exists
May 10 00:01:22 localhost systemd[1]: network.service: control process exited, code=exited status=1
May 10 00:01:22 localhost systemd[1]: Failed to start LSB: Bring up/down networking.
May 10 00:01:22 localhost systemd[1]: Unit network.service entered failed state.
May 10 00:01:22 localhost systemd[1]: network.service failed.

journalctl -xe -u network.service
    -- Logs begin at Tue 2011-05-10 00:00:40 UTC, end at Tue 2011-05-10 00:02:35 UTC. --
May 10 00:00:44 localhost systemd[1]: Starting LSB: Bring up/down networking...
-- Subject: Unit network.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit network.service has begun starting up.
May 10 00:00:44 localhost network[334]: Bringing up loopback interface:  [  OK  ]
May 10 00:00:45 localhost network[334]: Bringing up interface eth0:  ERROR    : [/etc/sysconfig/network-scripts/ifup-eth] Device eth
0 does not seem to be present, delaying initialization.
May 10 00:00:45 localhost network[334]: [FAILED]
May 10 00:00:45 localhost network[334]: Bringing up interface eth1:  ERROR    : [/etc/sysconfig/network-scripts/ifup-eth] Device eth
1 does not seem to be present, delaying initialization.
May 10 00:00:45 localhost /etc/sysconfig/network-scripts/ifup-eth[702]: Device eth1 does not seem to be present, delaying initializa
tion.
May 10 00:00:45 localhost network[334]: [FAILED]
May 10 00:00:45 localhost systemd[1]: network.service: control process exited, code=exited status=1
May 10 00:00:45 localhost systemd[1]: Failed to start LSB: Bring up/down networking.
-- Subject: Unit network.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit network.service has failed.
-- 
-- The result is failed.
May 10 00:00:45 localhost systemd[1]: Unit network.service entered failed state.
May 10 00:00:45 localhost systemd[1]: network.service failed.
May 10 00:01:20 localhost systemd[1]: Starting LSB: Bring up/down networking...

这是 dmesg | grep e1000e

    [root@localhost ~]# dmesg | grep eth
[    9.194339] e1000e 0000:00:19.0 eth0: (PCI Express:2.5GT/s:Width x1) 00:01:05:0f:2a:a0
[    9.202239] e1000e 0000:00:19.0 eth0: Intel(R) PRO/1000 Network Connection
[    9.209127] e1000e 0000:00:19.0 eth0: MAC: 7, PHY: 8, PBA No: FFFFFF-0FF
[    9.320640] e1000e 0000:04:00.0 eth1: registered PHC clock
[    9.320643] e1000e 0000:04:00.0 eth1: (PCI Express:2.5GT/s:Width x1) 00:30:59:08:18:53
[    9.320645] e1000e 0000:04:00.0 eth1: Intel(R) PRO/1000 Network Connection
[    9.320734] e1000e 0000:04:00.0 eth1: MAC: 3, PHY: 8, PBA No: FFFFFF-0FF
[    9.453298] e1000e 0000:05:00.0 eth2: registered PHC clock
[    9.458777] e1000e 0000:05:00.0 eth2: (PCI Express:2.5GT/s:Width x1) 00:30:59:08:18:54
[    9.466673] e1000e 0000:05:00.0 eth2: Intel(R) PRO/1000 Network Connection
[    9.473608] e1000e 0000:05:00.0 eth2: MAC: 3, PHY: 8, PBA No: FFFFFF-0FF
[    9.609123] e1000e 0000:06:00.0 eth3: registered PHC clock
[    9.609126] e1000e 0000:06:00.0 eth3: (PCI Express:2.5GT/s:Width x1) 00:30:59:08:18:55
[    9.609128] e1000e 0000:06:00.0 eth3: Intel(R) PRO/1000 Network Connection
[    9.609203] e1000e 0000:06:00.0 eth3: MAC: 3, PHY: 8, PBA No: FFFFFF-0FF
[    9.704211] e1000e 0000:07:00.0 eth4: registered PHC clock
[    9.704214] e1000e 0000:07:00.0 eth4: (PCI Express:2.5GT/s:Width x1) 00:30:59:08:18:56
[    9.704216] e1000e 0000:07:00.0 eth4: Intel(R) PRO/1000 Network Connection
[    9.704291] e1000e 0000:07:00.0 eth4: MAC: 3, PHY: 8, PBA No: FFFFFF-0FF
[    9.816322] e1000e 0000:08:00.0 eth5: registered PHC clock
[    9.816324] e1000e 0000:08:00.0 eth5: (PCI Express:2.5GT/s:Width x1) 00:01:05:0f:2a:a1
[    9.816326] e1000e 0000:08:00.0 eth5: Intel(R) PRO/1000 Network Connection
[    9.816483] e1000e 0000:08:00.0 eth5: MAC: 3, PHY: 8, PBA No: FFFFFF-0FF
[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN 
    link/gre 0.0.0.0 brd 0.0.0.0
3: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
4: enp0s25: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:01:05:0f:2a:a0 brd ff:ff:ff:ff:ff:ff
5: enp4s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:30:59:08:18:53 brd ff:ff:ff:ff:ff:ff
6: enp5s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:30:59:08:18:54 brd ff:ff:ff:ff:ff:ff
7: enp6s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:30:59:08:18:55 brd ff:ff:ff:ff:ff:ff
8: enp7s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:30:59:08:18:56 brd ff:ff:ff:ff:ff:ff
9: enp8s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:01:05:0f:2a:a1 brd ff:ff:ff:ff:ff:ff
10: eth_bri: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN 
    link/ether ae:75:23:c7:e3:b6 brd ff:ff:ff:ff:ff:ff
    inet 129.193.148.1/24 brd 129.193.148.255 scope global eth_bri
       valid_lft forever preferred_lft forever
    inet6 fe80::ac75:23ff:fec7:e3b6/64 scope link 
       valid_lft forever preferred_lft forever

Journctl -u network.service 似乎暗示没有 eth0,但从 dmesg 显示有 eth0 到 eth5。但是;当我发出 ip addr 时,您可以看到它们都已重命名为 systemd-udevd 提供的新样式;enp0s25……等等。

这里还有另一个话题无法启动 CentOS 7 “网络”服务这意味着 dhcpclient 服务可能会妨碍。该线程的答案建议禁用 dhcpclient 服务。就我而言,我没有运行 dhcpclient。

[root@localhost ~]# ps -ef | grep dhc
root      2506 23576  0 00:23 ttyS0    00:00:00 grep --color=auto dhc
[root@localhost ~]# 

答案1

您必须手动配置接口。此链接应该可以为您提供所需的信息。

http://ask.xmodulo.com/configure-static-ip-address-centos7.html

答案2

NetworkManager 不是个好东西。删除它并在 /etc/sysconfig/network-scripts/ifcfg-(接口名称) 中配置您的接口

您的 dmesg 输出显示内核启动时将 eth0-ethX 作为接口名称,但随后某些东西将它们重命名为“更友好”的名称。

当前接口名称将由 root 列出ip addr show

答案3

这将解决问题!

# rm /etc/udev/rules.d/70-persistent-ipoib.rules 

# reboot
  • 现在编辑 /etc/sysconfig/network-scripts/ifcfg-eth0,
  • 添加新生成的 HWADDR 或者删除它
  • 删除 UUID 行

-重新启动网络服务

 #systemctl restart network.service

工作中。

相关内容