解決CentOS 7 開機網路裝置不啟動方法

來源:互聯網
上載者:User

標籤:centos 7 網卡

在VMware 10裡新裝一個CentOS 7系統,開機發現沒有網路,於是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",至此問題徹底解決!



解決CentOS 7 開機網路裝置不啟動方法

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.