OS: Ubuntu 16.04.3

Configuring a KVM Bridge between my ethernet card (eno1), guest(s) (vnet0), and bridge (br0)

I have my bridge working properly with my network card so that my machine has WAN access to my router.

I have been following these guides:


No IPv4 address assigned to KVM VM


Here are the interface settings for br0: # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback

# Ethernet
iface eno1 inet manual

# Bridge
auto br0 
iface br0 inet static
        hwaddress ether 40:16:7e:28:0e:60

        bridge_ports eno1
        bridge_stp off 
        bridge_fd 0


When brought up:

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 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
    link/ether 40:16:7e:28:0e:60 brd ff:ff:ff:ff:ff:ff
3: wlp13s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 54:27:1e:97:32:16 brd ff:ff:ff:ff:ff:ff
53: vboxnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
82: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:53:24:54:a5 brd ff:ff:ff:ff:ff:ff
    inet scope global docker0
       valid_lft forever preferred_lft forever
181: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 40:16:7e:28:0e:60 brd ff:ff:ff:ff:ff:ff
    inet brd scope global br0
       valid_lft forever preferred_lft forever
    inet6 2001:569:737d:a300:4216:7eff:fe28:e60/64 scope global mngtmpaddr dynamic 
       valid_lft 14700sec preferred_lft 14400sec
    inet6 fe80::4216:7eff:fe28:e60/64 scope link 
       valid_lft forever preferred_lft forever
182: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UNKNOWN group default qlen 1000
    link/ether fe:57:13:a9:fb:22 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc57:13ff:fea9:fb22/64 scope link 
       valid_lft forever preferred_lft forever

Finally I have this in /etc/sysctl.d/bridge.conf


reloaded with:

sysctl -p /etc/sysctl.d/bridge.conf

Ok on the VM side of things I am using terraform with a libvirt provider https://github.com/dmacvicar/terraform-provider-libvirt

I am not going to show the terraform file as its outside the scope but the xml it generates is as such.

<domain type='kvm' id='40'>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>1</vcpu>
    <type arch='x86_64' machine='pc-i440fx-xenial'>hvm</type>
    <boot dev='hd'/>
  <clock offset='utc'/>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/ubuntu-qcow2'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/commoninit.iso'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    <controller type='usb' index='0'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    <controller type='ide' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    <interface type='bridge'>
      <mac address='ea:57:13:a9:fb:22'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    <serial type='pty'>
      <source path='/dev/pts/18'/>
      <target type='isa-serial' port='0'/>
      <alias name='serial0'/>
    <console type='pty' tty='/dev/pts/18'>
      <source path='/dev/pts/18'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    <console type='pty'>
      <source path='/dev/pts/19'/>
      <target type='virtio' port='1'/>
      <alias name='console1'/>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-ubuntu1/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' port='5900' autoport='yes'>
      <listen type='address'/>
      <model type='cirrus' vram='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    <rng model='virtio'>
      <backend model='random'>/dev/random</backend>
      <alias name='rng0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
  <seclabel type='dynamic' model='apparmor' relabel='yes'>

Once the VM is up and running this is ip addr returns:

And brctl show:

bridge name bridge id       STP enabled interfaces
br0     8000.40167e280e60       no             eno1
docker0     8000.0242532454a5   no      

and virsh addrs shows nothing for the interface for me to connect too:

> virsh domifaddr ubuntu1 vnet0
 Name       MAC address          Protocol     Address

I am expecting the ip address to be filled based on the bridges connection to my router. My home router has a dhcp reservation for the host but I would expect the guests to be getting an ip as well?

Any guidance on how to get an IP for VM available on the LAN would be appreciated.

  • the ip is configured inside thevm – c4f4t0r Jan 12 '18 at 9:49
  • @c4f4t0r do you mean that it needs to be configured or that is it configured? – paxsonsa Jan 12 '18 at 9:56
  • to be configured, with your bridge you only provide an ethernet interface to your vm, when you are in bridge mode. – c4f4t0r Jan 12 '18 at 10:01
  • @c4f4t0r hmmm I am trying a few things here to try and get an ip. Do I need to add the IP into the interface (in the xml) or create a network for it. I am not very clear on how to get said IP on the machine. I know the ip addr add if one way but maybe you could provide a deeper insight?+ – paxsonsa Jan 12 '18 at 10:58
  • you need to configure the ip address inside the vm, not in the xml, so logging as root and configure the ip on your vm, not on physical host. – c4f4t0r Jan 12 '18 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.