[Linux] 解決 CentOS7 上 network service 無法啟動的問題

[Linux] 解決 CentOS7 上 network service 無法啟動的問題

今天想要重啟 CentOS 7 上的 network service,於是執行了 systemctl restart network,

卻遇到了奇怪的問題,一直會出現啟動失敗的訊息…

root@localhost ~ # systemctl restart network
Job for network.service failed. See 'systemctl status network.service' and 'journalctl -xn' for details.

 

如果用 systemctl status network 去看狀態的話,會看到

Failed to start LSB: Bring up/down networking 的錯誤訊息:

root@localhost ~ # systemctl status network
network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network)
Active: failed (Result: exit-code) since Mon 2015-09-14 12:53:12 CST; 2s ago
Process: 3752 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
Sep 14 12:53:12 localhost network[3752]: RTNETLINK answers: File exists
Sep 14 12:53:12 localhost network[3752]: RTNETLINK answers: File exists
Sep 14 12:53:12 localhost network[3752]: RTNETLINK answers: File exists
Sep 14 12:53:12 localhost network[3752]: RTNETLINK answers: File exists
Sep 14 12:53:12 localhost network[3752]: RTNETLINK answers: File exists
Sep 14 12:53:12 localhost network[3752]: RTNETLINK answers: File exists
Sep 14 12:53:12 localhost network[3752]: RTNETLINK answers: File exists
Sep 14 12:53:12 localhost systemd[1]: network.service: control process exited, code=exited status=1
Sep 14 12:53:12 localhost systemd[1]: Failed to start LSB: Bring up/down networking.
Sep 14 12:53:12 localhost systemd[1]: Unit network.service entered failed state.

 

弄了蠻久的時間,終於從 CentOS 7/RHEL 7 网卡启动错误 這篇找到線索~

原來我記在 /etc/sysconfig/network-scripts/ifcfg-em1 的網卡 MAC address 有誤,

所以服務一直起不來…

ifcfg-em1 裡記錄的 HWADDR (Mac address) 是 34:17:EB:9E:2A:E8,

但如果用 ip addr 去查的話,會發現實際的 Mac address 是 98:90:96:d5:53:ca:

2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 98:90:96:d5:53:ca brd ff:ff:ff:ff:ff:ff
inet 10.1.117.199/22 brd 10.1.119.255 scope global dynamic em1
valid_lft 860464sec preferred_lft 860464sec
inet6 fe80::9a90:96ff:fed5:53ca/64 scope link
valid_lft forever preferred_lft forever

 

為什麼 ifcfg-em1 記錄的是錯誤的… 這已經不可考了,

不過把它改成正確的 Mac address 之後,再重新 systemctl restart network,

就可以正確地啟動網路服務了~

以下是改好的 ifcfg-em1 的內容,HWADDR 的部分已經修正好了:

TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=em1
UUID=0604c392-6189-49ad-abc0-8461a06321cf
ONBOOT=yes
#HWADDR=34:17:EB:9E:2A:E8
HWADDR=98:90:96:d5:53:ca
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

 

(本頁面已被瀏覽過 10,120 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料