解決CentOS eth0: 錯誤:斷開裝置 ‘eth0’

來源:互聯網
上載者:User

解決CentOS eth0: 錯誤:斷開裝置 ‘eth0’
1,問題描述

[root@pdshow ~]# ping www.baidu.com
connect: 網路不可達
[root@pdshow ~]#

[root@pdshow ~]# ping www.baidu.com
connect: 網路不可達
[root@pdshow ~]# ifconfig eth0 192.168.121.51 netmask 255.255.255.0 broadcast 192.168.121.255
[root@pdshow ~]# route add default gw 192.168.120.1
SIOCADDRT: 沒有那個進程
[root@pdshow ~]#
網路ip地址設定沒有成功,失效了。

2,network啟動報錯

正在關閉介面 eth0: 錯誤:斷開裝置 ‘eth0’(/org/freedesktop/NetworkManager/Devices/0) 失敗:This device is not active;

3,關閉NetworkManager

看到網上有說的是NetworkManager影響了/etc/init.d/network,所以關閉NetworkManager
[root@192 ~]# service NetworkManager stop
停止 NetworkManager 守護進程: [確定]
[root@192 ~]#

也沒有效果,service network restart失敗。

4,查看ifcfg-eth0配置問題

[root@192 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
TYPE=Ethernet
UUID=fd7935ed-d944-4a1a-81eb-bf72b1e368c0
ONBOOT=no
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=00:0c:29:cd:1f:68
IPADDR=192.168.121.52
PREFIX=23
GATEWAY=192.168.120.1
DNS1=192.168.121.212
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=”System eth0”

看到ONBOOT=no,這個配置失效了,應該配置成yes猜對,no是網卡不啟用失效的設定。改成yes

5,重啟network

/etc/init.d/network restart,之後生效,網路問題解決了。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.