在開機以後,發現網卡沒有啓動起來,進行了以下操做
一、ifup ens33
Bringing up interface ens33: Error: Connection activation failed: No suitable device found for this connection.
二、接着想重啓網絡服務
[root@client01 network-scripts]# systemctl start network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
三、根據提示查看報錯
[root@client01 network-scripts]# systemctl status network.service
● 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 Thu 2017-11-02 21:21:15 CST; 4s ago
Docs: man:systemd-sysv-generator(8)
Process: 4550 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)服務器
Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 network[4550]: RTNETLINK answers: File exists
Nov 02 21:21:15 client01 systemd[1]: network.service: control process exited, code=exited status=1
Nov 02 21:21:15 client01 systemd[1]: Failed to start LSB: Bring up/down networking.
Nov 02 21:21:15 client01 systemd[1]: Unit network.service entered failed state.
Nov 02 21:21:15 client01 systemd[1]: network.service failed.
四、bing搜索報錯信息,通常可能有兩種解決措施
4.一、網卡配置文件中沒有添加MAC地址信息,處理過程以下
4.1.一、查看網卡對應MAC地址
[root@client01 network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
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: ens33: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:0c:29:9b:e7:51 brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
link/ether 52:54:00:a7:c4:9b brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
link/ether 52:54:00:a7:c4:9b brd ff:ff:ff:ff:ff:ff
4.1.二、將MAC地址添加在配置文件中
echo "HWADDR=00:0c:29:9b:e7:51" >> /etc/sysconfig/network-scripts/ifcfg-ens33
4.1.三、重啓網絡服務systemctl start network網絡
在嘗試了上述方法後,問題依然沒有解決,嘗試第二種方案oop
4.二、中止NetworkManager服務
中止
[root@client01 network-scripts]# systemctl stop NetworkManager
取消開機啓動
[root@client01 network-scripts]# systemctl disable NetworkManager
重啓網絡
[root@client01 network-scripts]# service network restart
Restarting network (via systemctl): [ OK ]ui
至此,問題解決this
NetworkManager和network的區別spa
簡單說network適合使用於網路設定後固定不變的服務器,而NetworkManager則適合使用於筆記型電腦上必須經常在有線及無線網路環境切換時使用,而且這二個服務所讀取及寫入的設定檔是不一樣的。
network :讀取的設定檔路徑爲「/etc/sysconfig/network-scripts/*」下的設定檔。
NetworkManager :讀取的設定檔路徑爲「/etc/sysconfig/networking/*」下的設定檔。
CentOS7 在預設狀況下會啓動NetworkManager 服務(包含開機啓動),由於我的習慣傳統的network設定,所以建議將NetworkManager 服務停用後再繼續後續設定做業,不然在二個服務都啓動的狀況下將會形成互相干擾的麻煩情況。rest