You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CentOS 6虚拟机中eth1接口不可见且无法与其他服务器交互求助

Fixing Missing eth1 Interface on CentOS 6 in VirtualBox

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:
    lspci | grep Ethernet
    
    You should see two entries (one for eth0, one for eth1).
  • Run this to list all network interfaces (including disabled ones):
    ip link show
    
    Look for an interface named eth1 (it might show as DOWN initially).

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-eth0 file, copy it as a template for eth1:
    cp ifcfg-eth0 ifcfg-eth1
    
    If not, create a new file from scratch with this content (adjust values to match your network):
    vi ifcfg-eth1
    
    Paste these lines (modify HWADDR, IPADDR, etc., as needed):
    DEVICE=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:
    cat /etc/udev/rules.d/70-persistent-net.rules
    
    Look for an entry matching eth1's MAC address. If it's missing or mapped to a different name:
    • 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.

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 07:28:50