Troubleshooting KVM Bridged Networking: VM Not Receiving IPv4 Address in Ubuntu 10.10


5 views

The issue occurs when launching a KVM virtual machine with bridged networking configuration on Ubuntu 10.10. While the VM starts successfully and appears in process listings, the network interface within the VM fails to acquire an IPv4 address.

brctl show output:
bridge name bridge id       STP enabled interfaces
br0     8000.e0cb4ebb9907   no      eth0
                            vnet0

The bridge configuration appears correct with both physical interface (eth0) and virtual interface (vnet0) properly attached. However, daemon logs reveal potential issues:

NetworkManager[3342]: /sys/devices/virtual/net/vnet0: couldn't determine device driver; ignoring...
modem-manager: (net/vnet0): could not get port's parent device

Host machine's /etc/network/interfaces:

auto br0
iface br0 inet dhcp
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0

Libvirt XML configuration shows the bridged networking setup:

<interface type='bridge'>
    <mac address='52:54:00:06:7e:9c'/>
    <source bridge='br0'/>
    <model type='virtio'/>
</interface>

1. DHCP Client Configuration in Guest

First verify the guest VM's network configuration. For Ubuntu guests, check:

sudo cat /etc/network/interfaces
# Should contain something like:
auto eth0
iface eth0 inet dhcp

2. Bridge STP Settings

Try enabling STP on the bridge:

sudo brctl stp br0 on

3. NetworkManager Conflicts

Completely disable NetworkManager for the bridge interface:

sudo nmcli dev set br0 managed no

4. Alternative: Static IP Assignment

If DHCP continues to fail, configure a static IP in the guest:

auto eth0
iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 8.8.8.8 8.8.4.4

Check packet flow through the bridge:

sudo tcpdump -i br0 -n

Verify DHCP server operation:

sudo tcpdump -i br0 -n port 67 or port 68

For Ubuntu 10.10 specifically, consider using the legacy network script method:

sudo mv /etc/init/network-manager.conf /etc/init/network-manager.conf.disabled
sudo service network-manager stop
sudo service networking restart

The most likely cause is NetworkManager interfering with bridge operations. The comprehensive solution would be:

# Stop NetworkManager
sudo service network-manager stop

# Bring down interfaces
sudo ifdown br0
sudo ifdown eth0

# Configure bridge manually
sudo brctl addbr br0
sudo brctl addif br0 eth0
sudo ifconfig eth0 0.0.0.0 up
sudo ifconfig br0 up
sudo dhclient br0

# Make NetworkManager ignore these interfaces
echo -e 'iface br0 inet manual\niface eth0 inet manual' | sudo tee /etc/network/interfaces.d/no-nm

The host system shows a bridge interface br0 with both eth0 and vnet0 attached, but the VM's network interface isn't receiving an IPv4 address. Looking at the configuration:

bridge name bridge id       STP enabled interfaces
br0     8000.e0cb4ebb9907   no      eth0
                            vnet0
  • The vnet0 interface only shows IPv6 address (fe80::fc54:ff:fe06:7e9c)
  • NetworkManager logs indicate it couldn't determine the device driver for vnet0
  • Daemon logs show "no ifupdown configuration found" for vnet0

The host's /etc/network/interfaces shows proper bridge setup:

auto br0
iface br0 inet dhcp
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0
    bridge_maxwait 0

The VM's network interface is configured as:

<interface type='bridge'>
    <mac address='52:54:00:06:7e:9c'/>
    <source bridge='br0'/>
    <model type='virtio'/>
</interface>

1. Verify DHCP Client Inside VM

First ensure the guest OS has a DHCP client running. For Ubuntu/Debian:

sudo apt-get install dhclient
sudo dhclient eth0

2. Check Firewall Rules

Ensure no firewall is blocking DHCP requests:

sudo iptables -L -n -v
sudo iptables -I INPUT -i br0 -p udp --dport 67:68 --sport 67:68 -j ACCEPT

3. Alternative Bridge Configuration

Try this modified bridge setup in /etc/network/interfaces:

auto br0
iface br0 inet dhcp
    bridge_ports eth0 vnet0
    bridge_stp on
    bridge_fd 5
    bridge_maxwait 30

4. NetworkManager Workaround

Add this to /etc/NetworkManager/NetworkManager.conf:

[keyfile]
unmanaged-devices=interface-name:vnet*

If basic fixes don't work, try these advanced techniques:

# Monitor DHCP traffic
sudo tcpdump -i br0 port 67 or port 68 -vv

# Check syslog for DHCP errors
grep -i dhcp /var/log/syslog

# Verify bridge forwarding
cat /proc/sys/net/ipv4/ip_forward

If DHCP continues to fail, configure a static IP in the guest:

# In guest's /etc/network/interfaces
auto eth0
iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 8.8.8.8

After making changes, restart networking components:

# On host
sudo ifdown br0 && sudo ifup br0
sudo service libvirt-bin restart

# In guest
sudo ifdown eth0 && sudo ifup eth0