kvm + vlan enable VM

来源:互联网 发布:seo教程自学网 编辑:程序博客网 时间:2024/05/16 15:05

All operations are based on Ubuntu.

In case eth3 is a port of compute node which configured to trunk

1, make sure the module 802.1q has been loaded

lsmod | grep 802

modprobe 8021q

2, install software vlan

apt-get install vlan

3, add a vlan port

vconfig add eth3 vlanid

eg: vconfig add eth3 613

4, add a bridge for vlan

       brctl addbr brvlan

5, add the vlan port to the bridge

       brctl addif brvlan vlanport

eg: brctl addif brvlan eth3.613

 6, enable a vm from kvm

qemu-system-x86-64 --enable-kvm -hda xxx.img -net nic -net tap,ifname=tap0

On ubuntu 12.04, it will auto create a tap, and you need use brctl command to add the tap to the brigde for vlan.

but on ubuntu 14.04 you need create the tap and add it to the brigde for vlan before execute this command.

0 0