Linux

無法啟動 CentOS 7 “網路”服務

  • May 11, 2017

我在具有 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…等。

這裡有另一個執行緒Can’t start CentOS 7 “network” service這意味著 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 ~]# 

您必須手動配置介面。該連結應該可以為您提供所需的東西。

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

NetworkManager 是一個….不是好東西。刪除它並在 /etc/sysconfig/network-scripts/ifcfg-(NAME OF INTERFACE) 中配置您的介面

您的 dmesg 輸出顯示核心啟動 eth0-ethX 作為介面名稱,但隨後將它們重命名為“更友好”的名稱。

目前介面名稱將由ip addr show root 列出。

引用自:https://serverfault.com/questions/745048