How to forward one or few VLAN's to KVM virtual machine

Next step using network configuration via Open vSwitch (How to forward all VLAN's to KVM virtual machine) provide only one vlan.

We need create new bridge interface
# ovs-vsctl add-br vlan236
  Bridge "vlan236"
    Port "vlan236"
      Interface "vlan236"
        type: internal

Create new port with will be connected to our br0 with have all vlans
# ovs-vsctl add-port vlan236 vlan236-br0 \
   -- set interface vlan236-br0 type=patch options={peer=br0-vlan236}

And same from another side with restriction for one (or few) vlan by tag
# ovs-vsctl add-port br0 br0-vlan236 tag=236 \
   -- set interface br0-vlan236 type=patch options={peer=vlan236-br0}

And that's all. Just define ("virsh net-define") new network for KVM and use as usual
# ovs-vsctl show 
7a0c9d14-3166-4173-8813-bb43a01e39f0
    Bridge "vlan236"
        Port "vnet4"
            Interface "vnet4"
        Port "vlan236"
            Interface "vlan236"
                type: internal
        Port "vlan236-br0"
            Interface "vlan236-br0"
                type: patch
                options: {peer="br0-vlan236"}
    Bridge "br0"
        Port "vnet2"
            Interface "vnet2"
        Port "br0"
            Interface "br0"
                type: internal
        Port "bond0"
            Interface "bond0"
        Port "br0-vlan236"
            tag: 236
            Interface "br0-vlan236"
                type: patch
                options: {peer="vlan236-br0"}
        Port "vnet0"
            Interface "vnet0"

Comments

Popular posts from this blog