Problem description:
The ifconfig command cannot find the eth0 device, and the/etc/sysconfig/network-scripts/contains only the ifcfg-Lo file, without the ifcfg-eth0.
Temporary solution 1:
Run the ifconfig eth0 192.168.1.x command to set the eth0 IP address. This method is only a temporary solution. After the system is restarted, it becomes invalid.
Permanent solution 2:
1. Create a ifcfg-eth0 file under the/etc/sysconfig/network-scripts/directory;
2. correctly set the device, bootproto, onboot, ipaddr, gateway, dns1, domain, netmask, network, name and so on of the ifcfg-eth0, such:
Device = eth0 physical device name
Ipaddr = 192.168.1.x IP Address
Netmask = 255.255.255.0 Subnet Mask
Network = 192.168.1.0 indicates the network, which is automatically calculated using the IP address and subnet mask.
Gateway = 192.168.1.1 gateway address
Broadcast = 192.168.1.255 broadcast address, automatically calculated by IP address and subnet mask
Onboot = [Yes | no] whether to activate the device during boot
Userctl = [Yes | no] Can a non-root user control the device?
Bootproto = [none | static | BOOTP | DHCP] Protocol not used during boot | static allocation | BOOTP protocol | DHCP protocol
Hwaddr = 00: 13: D3: 27: 9f: 80 MAC address
Name = eth0 name
3. After the above settings, it can be successful under normal circumstances. If there is still a problem, in the file/etc/rc. d/RC. add IFUP eth0 (/etc/rc. the local script is executed after all other initialization scripts are executed ).
4. Restart your computer. OK.
Other network control commands:
Ifdown eth0, ifconfig eth0 down // disable the network
IFUP eth0, ifconfig eth0 up // enable the network
-------------------------------------------------------
Set the DNS Configuration File Location/etc/resolv. conf
-------------------------------------------------------
Service Network start // start a network service
Service Network stop // stop a network service
Srvice network restart // restart the network service
Service Network Status // view the network service status
This article from the "Half city smoke sand" blog, please be sure to keep this source http://vabc1314.blog.51cto.com/2164199/1537784