Home >Operation and Maintenance >CentOS >centos cannot find eth0 device

centos cannot find eth0 device

王林
王林Original
2020-03-17 13:20:142744browse

centos cannot find eth0 device

Problem:

The ifconfig command cannot find the eth0 device, and there is only the ifcfg-lo file in /etc/sysconfig/network-scripts/, but not ifcfg-eth0.

Solution:

1. Create a new ifcfg-eth0 file in the /etc/sysconfig/network-scripts/ directory;

(Recommended tutorial: centos use Tutorial )

2. Correctly set the DEVICE, BOOTPROTO, ONBOOT, IPADDR, GATEWAY, DNS1, DOMAIN, NETMASK, NETWORK, NAME, etc. of ifcfg-eth0, such as:

            DEVICE=eth0                    物理设备名称
            IPADDR=192.168.1.x         IP地址
            NETMASK=255.255.255.0  子网掩码
            NETWORK=192.168.1.0     指定网络,通过IP地址和子网掩码自动计算得到
            GATEWAY=192.168.1.1     网关地址
            BROADCAST=192.168.1.255 广播地址,通过IP地址和子网掩码自动计算得到
            ONBOOT=[yes|no]             引导时是否激活设备
            USERCTL=[yes|no]           非ROOT用户是否可以控制该设备
            BOOTPROTO=[none|static|bootp|dhcp]    引导时不使用协议|静态分配|BOOTP协议|dhcp协议
            HWADDR=00:13:D3:27:9F:80   MAC地址
            NAME=eth0 名称

3. After the above settings, it can be successful under normal circumstances. If there are still problems, add ifup eth0 at the end of the file /etc/rc.d/rc.local (the /etc/rc.local script is executed after all other initialization scripts) Execute after completion).

4. Restart the computer, OK.

Related video tutorial sharing: linux video tutorial

The above is the detailed content of centos cannot find eth0 device. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn