2021-05-12 14:32:11
CentOS 7虛擬機器網絡卡啟動不了解決辦法
在VMMare12裡安裝了CentOS7虛擬機器,但是開機發現連不了網,ifconfig一下,發現網絡卡沒有啟動。
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:0c:29:2b:c0:1e txqueuelen 1000 (Ethernet)
RX packets 1 bytes 251 (251.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 386 bytes 33512 (32.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 386 bytes 33512 (32.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
習慣性的重新啟動網絡卡服務“service network restart”
提示:
Restarting network (via systemctl): [ OK ]
重新啟動OK,,,,
再檢視網絡卡"ifconfig"
還是老樣子
於是"ifup eno16777736"手動重新啟動網絡卡
提示:
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/0)
啟動成功
再檢視網絡卡狀態"ifconfig"
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.41.128 netmask 255.255.255.0 broadcast 192.168.41.255
inet6 fe80::20c:29ff:fe2b:c01e prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:2b:c0:1e txqueuelen 1000 (Ethernet)
RX packets 74 bytes 9637 (9.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 61 bytes 7083 (6.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 650 bytes 56612 (55.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 650 bytes 56612 (55.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
OK,,得到IP問題解決。
後續:
本來這個問題不會出現的,主要是我的網路環境是有DHCP伺服器,IP地址可以自動獲得。如果是手動輸入IP就不會出現這個問題了,因為在網絡卡組態檔裡有一項"ONBOOT=no"表示引導時不啟用網絡卡,由於對centos7不熟悉,所以未發現這個問題。
上面的解決方法是不徹底的,因為每重新啟動一次伺服器就需要輸入一次"ifup eno16777736",很是麻煩,我們可以修改網絡卡的組態檔"/etc/sysconfig/network-scripts/ifcfg-eno16777736"裡面的"ONBOOT=no"修改成"ONBOOT=yes",至此問題徹底解決!
本文永久更新連結地址:http://www.linuxidc.com/Linux/2017-07/145639.htm
相關文章