Score:0

KVM client not getting IP from bridge

cn flag

I recently upgraded from ubuntu 18.04 to 20.04 and now I'm unable to get KVM bridges to work.

For testing purposes I'm using a bone stock 20.04lts install with only the required KVM, bridge utils etc packages installed. No firewall configured or anything.

I can create the bridge and the host has network access etc. but if I assign the bridge to a VM it does not get a IP assigned from the DHCP server. I tried setting static IPs but the problem doesn't change, no internet access.

I seems that something is going wrong with the bridge/routing part but I have no clue as to what.

Host settings:

ip link

ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP mode DEFAULT group default qlen 1000
    link/ether 1c:69:7a:a9:b3:f0 brd ff:ff:ff:ff:ff:ff
3: wlo1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 14:85:7f:46:94:ed brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 1c:69:7a:a9:b3:f0 brd ff:ff:ff:ff:ff:ff
5: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether fe:54:00:77:53:d9 brd ff:ff:ff:ff:ff:ff

ip addr show

ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
    link/ether 1c:69:7a:a9:b3:f0 brd ff:ff:ff:ff:ff:ff
3: wlo1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 14:85:7f:46:94:ed brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 1c:69:7a:a9:b3:f0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.59/24 brd 192.168.0.255 scope global dynamic br0
       valid_lft 6655sec preferred_lft 6655sec
    inet6 fe80::5cf0:6eff:feec:6394/64 scope link
       valid_lft forever preferred_lft forever
5: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UNKNOWN group default qlen 1000
    link/ether fe:54:00:77:53:d9 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc54:ff:fe77:53d9/64 scope link
       valid_lft forever preferred_lft forever

brctl

brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.1c697aa9b3f0       no              enp1s0
                                                        vnet0

netplan

network:
  ethernets:
    enp1s0:
     dhcp4: yes
     dhcp6: no
  version: 2
  bridges:
    br0:
     interfaces: [enp1s0]
     dhcp4: yes
     dhcp6: no
     parameters:
       stp: false
       forward-delay: 0

iptables

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

virsh

virsh net-list --all
 Name          State    Autostart   Persistent
---------------------------------------------
 host-bridge   active   yes         yes

virsh net-edit host-bridge

<network>
  <name>host-bridge</name>
  <uuid>5c83bc93-624f-47fe-908e-be22cee755ea</uuid>
  <forward mode='bridge'/>
  <bridge name='br0'/>
</network>

ip v4 forwarding

sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

route

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.210   0.0.0.0         UG    100    0        0 br0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 br0
192.168.0.210   0.0.0.0         255.255.255.255 UH    100    0        0 br0

The VM is just a basic ubuntu 18.04 install with networking set to DHCP but no IP is obtained. If I set a static IP I can ping the host ip but not the gateway or any other ip on the same subnet which again leads me to believe there is something wrong with the bridge.

in flag
routing is not relevant for bridging, but a common tool to trace what happens is `tcpdump` use it as `tcpdump -i vnet0` then move on to br0 and finally eth0. There is also ebtables and nftables.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.