当前位置: 代码迷 >> 综合 >> 让KVM支持OpenvSwitch Bridge ( by quqi99 )
  详细解决方案

让KVM支持OpenvSwitch Bridge ( by quqi99 )

热度:96   发布时间:2023-12-13 09:35:19.0

让KVM支持OpenvSwitch Bridge ( by quqi99 )

作者:张华  发表于:2013-09-29
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明

( http://blog.csdn.net/quqi99 )

            用virt-manager工具创建的虚机不用使用openvswitch bridge, 可以添加“<virtualport type='openvswitch' />”解决。

sudo virsh edit fedora19

    <interface type='bridge'>
      <mac address='52:54:00:c7:13:ec'/>
      <source bridge='br-phy'/>
      <virtualport type='openvswitch' />
      <model type='e1000'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

以上生成的 是macvtap bridge mode的虚拟网卡。


也可以直接定义一个ovs的network, 如下:

sudo apt-get install qemu-system qemu-kvm virtinst libvirt-bin openvswitch-datapath-source openvswitch-controller openvswitch-switch virt-top virt-manager python-libvirt
sudo ovs-vsctl add-br br-phy
sudo virsh net-destroy default
sudo virsh net-edit default
<network>
  <name>br-phy</name>
  <forward mode='bridge'/>
  <bridge name='br-phy'/>
  <virtualport type='openvswitch'/>
</network>
sudo virsh net-undefine default
sudo irsh net-autostart br-phy
cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto br-phy
iface br-phy inet static
   address 172.16.1.1
   network 172.16.1.0
   netmask 255.255.255.0
   broadcast 172.16.1.255
iface br-phy inet6 static
   address 2001:172:16:1::1
   netmask 64
reboot your machine


vi /etc/network/interfaces

allow-ovs br-int
iface br-int inet manual
  ovs_type OVSBridge
  mtu 9000