How to Fix Network Interface Renaming from eth0 to eth1 in Ubuntu Server Virtual Machine


9 views

After an unexpected Windows 7 host reboot following security updates, my Ubuntu Server 9.04 VM in VirtualBox lost network connectivity. The system logs revealed an intriguing message:

[] eth0: registered as PCnet/FAST III 79c973
[] udev: renamed network interface eth0 to eth1

The root cause lies in how udev handles network interface naming. When the VM hardware signature changes (common after host reboots), udev's persistent net rules may assign a new name to prevent conflicts.

The current /etc/network/interfaces configuration:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

Here's how to quickly restore network functionality:

# First check available interfaces
ip link show

# Temporary solution (until next reboot):
sudo ifconfig eth1 up
sudo dhclient eth1

# Permanent solution - edit interfaces file:
sudo nano /etc/network/interfaces
# Change eth0 to eth1 in the file

For stable interface naming across reboots:

# Option 1: Create udev rule
sudo nano /etc/udev/rules.d/70-persistent-net.rules
# Add or modify with your MAC address:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"

# Option 2: Use modern predictable interface names (Ubuntu 15.10+)
sudo ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules

For VirtualBox VMs, these additional steps help maintain stable networking:

# Ensure consistent MAC address in VM settings
VBoxManage modifyvm "VM name" --macaddress1 xxxxxx

# Install VirtualBox Guest Additions if not present
sudo apt-get update
sudo apt-get install virtualbox-guest-utils

After applying changes, verify with:

# Check interface naming
ip a

# Test network connectivity
ping -c 4 google.com

# View kernel messages for network events
dmesg | grep -i eth

When running Ubuntu Server 9.04 in VirtualBox on a Windows 7 host, you might encounter network connectivity issues after the host system reboots. The key symptom appears in dmesg output:

[] eth0: registered as PCnet/FAST III 79c973
[] udev: renamed network interface eth0 to eth1

This automatic renaming causes network configuration problems since Ubuntu still tries to use eth0 in /etc/network/interfaces.

Modern Linux systems (including Ubuntu) use udev rules to manage persistent network interface naming. When the host reboots, VirtualBox might present the virtual NIC with a different MAC address or identifier, triggering udev to assign a new name.

First, check available interfaces and their status:

ip link show
ifconfig -a

To temporarily bring up the renamed interface:

sudo ifconfig eth1 up
sudo dhclient eth1

Option 1: Update interfaces file

Edit /etc/network/interfaces:

auto lo
iface lo inet loopback

auto eth1
iface eth1 inet dhcp

Then restart networking:

sudo /etc/init.d/networking restart

Option 2: Create udev persistent rule

Create/edit /etc/udev/rules.d/70-persistent-net.rules:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="[your-mac-address]", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Find your MAC address using:

ip link show eth1 | grep link/ether

Option 3: Use Predictable Network Interface Names (Recommended)

For modern Ubuntu systems, consider using the new naming scheme:

sudo ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
sudo reboot

In VirtualBox settings:

  1. Go to VM Settings > Network
  2. Ensure "Cable Connected" is checked
  3. Try changing the adapter type (e.g., from PCnet-FAST III to Intel PRO/1000 MT)

After implementing any solution, verify with:

ping -c 4 google.com
ifconfig
ip route show