Home  >  Article  >  Operation and Maintenance  >  What to do if linux cannot see eth0

What to do if linux cannot see eth0

藏色散人
藏色散人Original
2021-11-22 11:32:287911browse

Solution to Linux not seeing eth0: 1. Use the command "ifconfig eth0 192.168.1.x" to set the IP of eth0; 2. Change the adapter type in "vSphere Client".

What to do if linux cannot see eth0

The operating environment of this article: linux5.9.8 system, G3 computer.

linux What should I do if I can’t see eth0?

Linux system cannot find the solution for the eth0 device

1. Problem description:
Linux under VMware vSphere Client The virtual machine ifconfig command cannot find the eth0 device, and there is only the ifcfg-lo file in /etc/sysconfig/network-scripts/, but not ifcfg-eth0.

2. There may be two reasons:
First, the simple ifcfg-eth0 file is lost or eth0 becomes eth x (can be viewed through the ifconfig -a command), Linux The eth0 network card device will be automatically enabled through this file during startup
Second, the network adapter does not match the old version of Linux

Third, for the first reason, temporary solution:

Use the command ifconfig eth0 192.168.1.x to set the IP of eth0 normally. This method is only a temporary solution and will become invalid after the system is restarted. //Note: Running this command on my computer shows that the device cannot be found.
Permanent solution:
1. Create a new ifcfg-eth0 file in the /etc/sysconfig/network-scripts/ directory;
2. Correctly set the DEVICE and BOOTPROTO of ifcfg-eth0 , ONBOOT, IPADDR, GATEWAY, NETMASK, NETWORK, NAME, etc., such as:
DEVICE=eth0                     #Physical device name
BOOTPROTO=static   #Indicates static IP, and setting it to DHCP means dynamic acquisition
IPADDR= 192.168.1.x #IP address
NETMASK=255.255.255.0 #Subnet mask
GATEWAY=192.168.1.1 #Gateway address
ONBOOT=yes #Automatically enabled at startup

4. Solution to the second reason:
Add an old version of the network adapter to match your current Linux system, such as E1000
Method: In the vSphere Client Change the adapter type in
Select the virtual machine in the VMware vSphere Client--Edit virtual machine settings, then add-network adapter, select the E1000 type

We use the vSphere Client to add network adapter 2 (the adapter type is E1000), then delete network adapter 1 and restart the server.

After restarting, under /etc/sysconfig/network-scripts/, you will see two configuration files ifcfg-eth0 and ifcfg-eth0.bak. The system automatically generates a new configuration file and The original configuration file was renamed.

Recommended learning: "linux video tutorial"

The above is the detailed content of What to do if linux cannot see eth0. 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