[ovs-discuss] Replace Linux Bridge with Openvswitch on Ubuntu

densha at exemail.com.au densha at exemail.com.au
Mon Nov 13 09:12:39 UTC 2017

Hi Forum

I would like to replace the linux bridge installed with libvirt with a
openvswitch bridge, so I can learn about openvswitch.

I cannot get the VM to communicate with the bridge I create with openvswitch.

Here is what I did on a vanilla Ubutnu 17.10 Server X86_64 installation. 
Installing libvirt and openvswitch.

PACKAGES="qemu-kvm openvswitch-switch libvirt-bin virtinst virt-manager"
sudo apt-get update
sudo apt-get dist-upgrade -qy

sudo apt-get install -qy ${PACKAGES}

sudo adduser `id -un` libvirtd
sudo adduser `id -un` kvm

I deleted the current linux bridge using

virsh net-destroy default
virsh net-undefine default
systemctl restart libvirtd

Created a openvswitch bridge and assigned a IP address.

ovs-vsctl add-br virbr0
ip addr add dev virbr0

I can see the bridge and ip address.

5: virbr0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group
default qlen 1000
    link/ether 26:68:17:50:25:40 brd ff:ff:ff:ff:ff:ff
    inet scope global virbr0
       valid_lft forever preferred_lft forever

I create a VM using virsh-install

sudo qemu-img create -f qcow2 -o preallocation=metadata
/var/lib/libvirt/images/kvm01.qcow2 10G

sudo virt-install -n kvm01 \
--connect qemu:///system \
--vcpus=2 \
 -r 4096 \
--os-type linux \
--os-variant ubuntu16.04 \
--network=bridge:virbr0,virtualport_type='openvswitch' \
--vnc --noautoconsole \
--keymap=en-us \
--console pty,target_type=serial \
-f /var/lib/libvirt/images/kvm01.qcow2 \
--location /var/lib/libvirt/images/ubuntu-16.04.3-server-amd64.iso \
get_hostname=kvm01 vga=788"

When the VM boots I assign a static IP address to 
Inside the VM the NIC reoprts as

2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen
    link/ether 52:54:00:a5:53:36 brd ff:ff:ff:ff:ff:ff
    inet brd scope global ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::5254:ff:faa5:5336/64 scope link
       valid_lft forever preferred_lft forever

When I virsh dumpxml on the VM domain I see the network setup as
<interface type='bridge'>
      <mac address='52:54:00:a5:53:36'/>
      <source bridge='virbr0'/>
      <virtualport type='openvswitch'>
        <parameters interfaceid='93b23213-15cb-40bd-b053-a04f15ae395d'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03'

>From the host machine openswitch reports the vnet0 as an internal port
sudo ovs-vsctl show
    Bridge "virbr0"
        Port "vnet0"
            Interface "vnet0"
        Port "virbr0"
            Interface "virbr0"
                type: internal
    ovs_version: "2.8.0"

>From the VM I am unable to ping the IP of the bridge.

>From the host I am also unable to ping the VM

I am at my limit of understanding of linux networking and I wonder could
someone point out what I have done wrong here?



More information about the discuss mailing list