Solve CentOS eth0: Error: disconnect the device 'eth0'
1. Problem Description
[Root @ pdshow ~] # Ping www.baidu.com
Connect: inaccessible Network
[Root @ pdshow ~] #
[Root @ pdshow ~] # Ping www.baidu.com
Connect: inaccessible Network
[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: No Process
[Root @ pdshow ~] #
Failed to set the network IP address.
2. network startup Error
Closing interface eth0: Error: disconnecting device 'eth0' (/org/freedesktop/NetworkManager/Devices/0) failed: This device is not active;
3. Disable NetworkManager.
NetworkManager affects/etc/init. d/network.
[Root @ 192 ~] # Service NetworkManager stop
Stop the NetworkManager daemon: [OK]
[Root @ 192 ~] #
Service network restart fails.
4. View ifcfg-eth0 configuration problems
[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
20174_failure_fatal = yes
IPV6INIT = no
NAME = "System eth0"
If ONBOOT = no is displayed, this configuration is invalid. You should set it to yes. no indicates that the NIC is not activated. Change to yes
5. Restart the network./Etc/init. d/network restart, which takes effect later and solves the network problem.