無網路:無法啟動 eth0

無網路:無法啟動 eth0

網路服務無法啟動/重新啟動時無法啟動。

Restarting networking (via systemctl): networking.serviceJob for networking.service failed because the control process exited with error code.

我仍然可以透過遠端控制台存取伺服器,但沒有其他方法,因為沒有網絡,就沒有出路,也沒有出路。

systemctl statusnetworking.service 說:

● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor prese
t: enabled)
  Drop-In: /run/systemd/generator/networking.service.d
           └─50-insserv.conf-$network.conf
   Active: failed (Result: exit-code) since Mo 2016-04-18 06:53:11 UTC; 43s ago
     Docs: man:interfaces(5)
  Process: 3551 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=
1/FAILURE)
  Process: 3546 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [
 -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle (cod
e=exited, status=0/SUCCESS)
 Main PID: 3551 (code=exited, status=1/FAILURE)

Apr 18 06:53:11 h2502988.stratoserver.net ifup[3551]: For info, please visit htt
ps://www.isc.org/software/dhcp/
Apr 18 06:53:11 h2502988.stratoserver.net ifup[3551]: Usage: dhclient [-4|-6] [-
SNTP1dvrx] [-nw] [-p <port>] [-D LL|LLT]
Apr 18 06:53:11 h2502988.stratoserver.net ifup[3551]:                 [-s server
-addr] [-cf config-file] [-lf lease-file]
Apr 18 06:53:11 h2502988.stratoserver.net ifup[3551]:                 [-pf pid-f
ile] [--no-pid] [-e VAR=val]
Apr 18 06:53:11 h2502988.stratoserver.net ifup[3551]:                 [-sf scrip
t-file] [interface]
Apr 18 06:53:11 h2502988.stratoserver.net ifup[3551]: Failed to bring up eth0.
Apr 18 06:53:11 h2502988.stratoserver.net systemd[1]: networking.service: Main p
rocess exited, code=exited, status=1/FAILURE
Apr 18 06:53:11 h2502988.stratoserver.net systemd[1]: Failed to start Raise netw
ork interfaces.
Apr 18 06:53:11 h2502988.stratoserver.net systemd[1]: networking.service: Unit e
ntered failed state.
Apr 18 06:53:11 h2502988.stratoserver.net systemd[1]: networking.service: Failed
 with result 'exit-code'.

我的 /etc/network/interfaces 看起來像:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

我可以從哪裡開始調試?

感謝您的任何提示!問候,K

# sudo ifup --verbose eth0
Configuring interface eth0=eth0 (inet)
/bin/run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/ethtool
run-parts: executing /etc/network/if-pre-up.d/wireless-tools
run-parts: executing /etc/network/if-pre-up.d/wpasupplicant

/sbin/dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -I -df /var/lib/dhcp/dhclient6.eth0.leases eth0  
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Usage: dhclient <snip>
Failed to bring up eth0.

答案1

這件事剛剛發生在我身上。原因是套件依賴不一致導致我從trusty升級到xenial,所以有些套件版本不一致。就我而言,不一致是由squid3和ca-certificates-java引起的。

我透過運作恢復了網路連線dhclient eth0。通過刪除有問題的軟體包並運行解決了軟體包不一致問題後apt-get install -f,我運行了apt-get dist-upgradeapt-get install ubuntu-standard。這完全解決了我的問題。

導致我懷疑這種不一致的原因是/sbin/ifup二進位檔案包含過時的dhclient命令列以及不再支援的-I選項。肯定是包版本不一致。

答案2

我假設您剛剛安裝/升級到較新的作業系統,例如 Ubuntu 16.04,並且由於偏離了傳統的介面命名方案(例如eth0或 )eth1,系統無法啟動您的介面。

嘗試編輯您/etc/network/interfaces以使用ens32ens192代替eth0類似

# The loopback network interface
auto lo
iface lo inet loopback

# The Ethernet interface
auto ens192
iface ens192 inet dhcp

這將使您的網路介面重新啟動。我希望它有幫助。有關預測性網路介面變更的詳細信息

https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

答案3

不確定這是否仍然有用: dhclient 似乎不再具有“-I”或“-df”選項,根據手冊頁DDNS 是否:

-I 使用 RFC 4701 和 4702 中的標準 DDNS 方案。

一旦我從命令列中刪除該選項,dhclient 就能夠啟動 eth0。

[編輯]:現在如果我能找到“-I”選項在哪裡...

答案4

試試這個:-

sudo ifdown --exclude=lo -a && sudo ifup --exclude=lo -a

所以替換networking restartifdown... && ifup....

順便說一句:ifconfig也已被棄用很長一段時間 -ip從包中使用iproute2

你也可以嘗試

ifconfig eth0 down && ifconfig eth0 up

(或無論你的網路介面被稱為什麼)來重新啟動網路。

相關內容