CentOS 6虚拟机中eth1接口不可见且无法与其他服务器交互求助
Hey there, let's work through this issue where your CentOS 6 VM can't find the eth1 interface, preventing communication with other local VMs. Here's a step-by-step breakdown to get it sorted:
1. Verify VirtualBox Network Adapter Configuration
First, let's make sure VirtualBox actually assigned a second network adapter to your VM:
- Shut down the CentOS 6 VM.
- Open VirtualBox, right-click your VM > Settings > Network.
- Check Adapter 2: Ensure the checkbox for "Enable Network Adapter" is ticked. For local VM-to-VM communication, choose either Host-only Adapter (isolated network with your host and other VMs) or Bridge Adapter (connects to your host's physical network).
- Start the VM back up.
2. Check if the Network Hardware is Detected in CentOS
Next, confirm the OS recognizes the second Ethernet adapter:
- Run this command to list all Ethernet controllers:
You should see two entries (one for eth0, one for eth1).lspci | grep Ethernet - Run this to list all network interfaces (including disabled ones):
Look for an interface namedip link showeth1(it might show asDOWNinitially).
3. Create/Configure the eth1 Network File
If the hardware is detected but eth1 doesn't show up in ifconfig, you need to set up its configuration file:
- Navigate to the network scripts directory:
cd /etc/sysconfig/network-scripts/ - If you already have an
ifcfg-eth0file, copy it as a template for eth1:
If not, create a new file from scratch with this content (adjust values to match your network):cp ifcfg-eth0 ifcfg-eth1
Paste these lines (modify HWADDR, IPADDR, etc., as needed):vi ifcfg-eth1DEVICE=eth1 TYPE=Ethernet HWADDR=XX:XX:XX:XX:XX:XX # Replace with eth1's MAC from `ip link show eth1` BOOTPROTO=static IPADDR=192.168.56.102 # Use a valid IP for your Host-only/Bridge network NETMASK=255.255.255.0 ONBOOT=yes NM_CONTROLLED=no DEFROUTE=no
4. Restart the Network Service
Apply the configuration by restarting the network:
service network restart
Now run ifconfig again—eth1 should appear with the IP you set.
5. Troubleshoot Udev Persistent Rules (If Needed)
CentOS 6 uses udev to map MAC addresses to interface names. If the above steps don't work, the persistent rules might be misconfigured:
- Check the udev rules file:
Look for an entry matching eth1's MAC address. If it's missing or mapped to a different name:cat /etc/udev/rules.d/70-persistent-net.rules- Delete the rules file:
rm /etc/udev/rules.d/70-persistent-net.rules - Reboot the VM. The system will automatically regenerate the rules and assign the correct interface name.
- Delete the rules file:
Once eth1 is up and running, your VM should be able to communicate with other local VirtualBox VMs on the same network setup.
内容的提问来源于stack exchange,提问作者Venkatesh K

