重启后必须重新启动网络服务(centos 7)

重启后必须重新启动网络服务(centos 7)

我正在设置一台具有 4 个端口(em1 到 em4)QLogic 网络接口的服务器。它通过 em3 连接,IP 地址由 DHCP 根据 mac 地址自动给出。开机后我无法访问网络。所以,我必须 systemctl restart network在每次开机后使用。

启动后,systemctl status network有时会给我这个:

network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since ven. 2019-03-15 09:20:18 CET; 2min 21s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1365 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

mars 15 09:19:32 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking...
mars 15 09:19:32 localhost.localdomain network[1365]: Activation de l'interface loopback :  [  OK  ]
mars 15 09:20:18 localhost.localdomain network[1365]: Activation de l'interface em3 :  Erreur : l'activation de la connexion a échoué : La configuration IP n'a pas pu être réservée (aucun adresse disponible, délai d'expiration, etc. )
mars 15 09:20:18 localhost.localdomain network[1365]: [ÉCHOUÉ]
mars 15 09:20:18 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
mars 15 09:20:18 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
mars 15 09:20:18 localhost.localdomain systemd[1]: Unit network.service entered failed state.
mars 15 09:20:18 localhost.localdomain systemd[1]: network.service failed.

显然,网络未激活。但有时(显然是随机的),我也可以在启动后得到:

network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: active (exited) since ven. 2019-03-08 15:05:10 CET; 48s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2781 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)
  Process: 3019 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)

mars 08 15:05:09 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking...
mars 08 15:05:09 localhost.localdomain network[3019]: Activation de l'interface loopback :  [  OK  ]
mars 08 15:05:09 localhost.localdomain network[3019]: Activation de l'interface em3 :  Connexion activée (chemin D-Bus actif : /org/freedesktop/NetworkManager/ActiveConnection/5)
mars 08 15:05:09 localhost.localdomain network[3019]: [  OK  ]
mars 08 15:05:10 localhost.localdomain systemd[1]: Started LSB: Bring up/down networking.

但是虽然连接似乎已激活,但我必须重新启动才能访问网络。

让我补充一下 /etc/sysconfig/network-scripts/ifcfg-em3 包含:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=em3
UUID=442f***************************
ONBOOT=yes
IPV6_PRIVACY=no

由于 ONBOOT 设置为 yes,我不知道如何解决此问题。

PS:当查看 /var/log/message (仅包括网络管理器的行)时,我有启动时间:

 Mar 15 09:10:59 localhost NetworkManager[1148]: <info>  [1552637459.9299] ifcfg-rh: new connection /etc/sysconfig/network-scripts/ifcfg-em3 (442f*****************,"em3")
Mar 15 09:11:01 localhost NetworkManager[1148]: <info>  [1552637461.9915] manager: (em3): new Ethernet device (/org/freedesktop/NetworkManager/Devices/4)
Mar 15 09:11:01 localhost NetworkManager[1148]: <info>  [1552637461.9924] device (em3): state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
Mar 15 09:11:01 localhost kernel: IPv6: ADDRCONF(NETDEV_UP): em3: link is not ready
Mar 15 09:11:02 localhost kernel: bnx2x 0000:01:00.2 em3: using MSI-X  IRQs: sp 85  fp[0] 87 ... fp[7] 94
Mar 15 09:11:02 localhost kernel: bnx2x 0000:01:00.2 em3: NIC Link is Up, 1000 Mbps full duplex, Flow control: none
Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.2490] device (em3): link connected
Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5636] device (em3): state change: unavailable -> disconnected (reason 'none') [20 30 0]
Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5657] policy: auto-activating connection 'em3'
Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5668] policy: auto-activating connection 'em3'
Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5682] device (em3): Activation: starting connection 'em3' (442f********************)
Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5683] device (em3): disconnecting connection 'em3' for new activation request
Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5683] device (em3): state change: disconnected -> deactivating (reason 'new-activation') [30 110 60]
Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5691] device (em4): Activation: starting connection 'em3' (442f************************)
Mar 15 09:11:02 localhost NetworkManager[1148]: <info>  [1552637462.5702] device (em3): state change: deactivating -> disconnected (reason 'new-activation') [110 30 60]
Mar 15 09:11:02 localhost nm-dispatcher: req:2 'down' [em3]: new request (4 scripts)
Mar 15 09:11:02 localhost nm-dispatcher: req:2 'down' [em3]: start running ordered scripts...
Mar 15 09:11:30 localhost NetworkManager[1148]: <info>  [1552637490.3692] device (em4): disconnecting connection 'em3' for new activation request
Mar 15 09:11:30 localhost NetworkManager[1148]: <info>  [1552637490.3704] audit: op="connection-activate" uuid="442f*********************" name="em3" pid=1484 uid=0 result="success"
Mar 15 09:11:30 localhost NetworkManager[1148]: <info>  [1552637490.3909] device (em4): Activation: starting connection 'em3' (442f*******************)
Mar 15 09:11:55 localhost network: Activation de l'interface em3 :  Connexion activée (chemin D-Bus actif : /org/freedesktop/NetworkManager/ActiveConnection/3)

首先,em3 和 em4 之间似乎存在交互作用,并且在任何时候我都没有发生过如下情况systemctl restart network

localhost NetworkManager[14060]: <info>  [1552637774.4521] device (em3): Activation: starting connection 'em3' (442f**********************)
localhost nm-dispatcher: req:2 'down' [em3]: new request (4 scripts)
localhost nm-dispatcher: req:2 'down' [em3]: start running ordered scripts...
localhost NetworkManager[14060]: <info>  [1552637774.4535] device (em3): state change: disconnected -> prepare (reason 'none') [30 40 0]
localhost NetworkManager[14060]: <info>  [1552637774.4543] device (em3): state change: prepare -> config (reason 'none') [40 50 0]
localhost NetworkManager[14060]: <info>  [1552637774.4779] device (em3): state change: config -> ip-config (reason 'none') [50 70 0]
localhost NetworkManager[14060]: <info>  [1552637774.4787] dhcp4 (em3): activation: beginning transaction (timeout in 45 seconds)
localhost NetworkManager[14060]: <info>  [1552637774.4823] dhcp4 (em3): dhclient started with pid 14582

答案1

我意识到 cat /proc/net/devem4 上有一些网络交换。然后我想起来,当服务器物理安装时,2 Gb 端口已连接。所以我拔掉了连接到 em4 的网线,我的问题现在似乎已经解决了。

相关内容