Problem Description: the ifconfig command cannot find the eth0 device, and/etc/sysconfig/network-scripts/contains only the ifcfg-lo file, without the ifcfg-eth0. Temporary Solution 1: Use the command ifconfigeth0192.168.1.x to set the IP address of eth0. this method is only for temporary purposes and will be lost after the system restarts.
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