Libvirt Openvswitch: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 
(4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 
=Openswitch integration=
 
=Openswitch integration=
==/etc/network/interfaces==
+
=/etc/network/interfaces=
 
<pre>
 
<pre>
 
auto lo
 
auto lo
Zeile 34: Zeile 34:
 
   mtu 1500
 
   mtu 1500
 
</pre>
 
</pre>
 
+
=ovs-network.xml=
==ovs-network.xml==
 
 
<pre>
 
<pre>
 
<network connections='1'>
 
<network connections='1'>
Zeile 59: Zeile 58:
 
   <portgroup name='vlan-all'>
 
   <portgroup name='vlan-all'>
 
     <vlan trunk='yes'>
 
     <vlan trunk='yes'>
 +
      <tag id='1'/>
 
       <tag id='2'/>
 
       <tag id='2'/>
 
       <tag id='252'/>
 
       <tag id='252'/>
Zeile 71: Zeile 71:
 
*virsh net-autostart  ovs-network
 
*virsh net-autostart  ovs-network
 
*virsh net-list --all
 
*virsh net-list --all
==XML Interface in der VM==
+
=XML Interface in der VM=
 
<pre>
 
<pre>
<interface type='bridge'>
+
<interface type='network'>
      <mac address='52:54:00:ce:c8:d1'/>
+
  <mac address='52:54:00:ce:c8:d1'/>
      <source network='ovs-network' portgroup='vlan2' bridge='vmbr0'/>
+
  <source network='ovs-network' portgroup='vlan1'/>
      <vlan>
+
  <target dev='veth0-lulu'/>
        <tag id='2'/>
+
  <model type='rtl8139'/>
      </vlan>
+
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
      <virtualport type='openvswitch'>
+
</interface>
        <parameters interfaceid='9564f940-6516-4a95-864f-b0c89a8eac95'/>
 
      </virtualport>
 
      <target dev='vnet0'/>
 
      <model type='rtl8139'/>
 
      <alias name='net0'/>
 
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
 
    </interface>
 
 
</pre>
 
</pre>
 
*[[Open Vswitch]]
 
*[[Open Vswitch]]

Aktuelle Version vom 13. Oktober 2017, 09:06 Uhr

Openswitch integration

/etc/network/interfaces

auto lo
iface lo inet loopback

auto vmbr0
allow-ovs vmbr0
iface vmbr0 inet manual
  ovs_type OVSBridge
  ovs_ports ens5 vlan1
  mtu 9000

auto ens5
iface ens5 inet manual
 ovs_bridge vmbr0
 ovs_type OVSPort
 ovs_options tag=1 vlan_mode=native-untagged trunks=2,252
 pre-up ovs-vsctl add-port vmbr0 ens5
 pre-up ovs-vsctl del-port vmbr0 ens5


allow-vmbr0 vlan1
iface vlan1 inet static
  ovs_type OVSIntPort
  ovs_bridge vmbr0
  ovs_options tag=1
  ovs_extra set interface ${IFACE} external-ids:iface-id=$(hostname -s)-${IFACE}-vif
  address 10.81.1.97
  netmask 255.255.0.0
  gateway 10.81.0.1
  dns-nameservers 10.80.0.2 10.80.0.3
  dns-search xinux.lan
  mtu 1500

ovs-network.xml

<network connections='1'>
  <name>ovs-network</name>
   <forward mode='bridge'/>
  <bridge name='vmbr0'/>
  <virtualport type='openvswitch'/>
  <portgroup name='vlan1'>
    <vlan>
      <tag id='1'/>
    </vlan>
  </portgroup>
  <portgroup name='vlan2'>
    <vlan>
      <tag id='2'/>
    </vlan>
  </portgroup>
  <portgroup name='vlan252'>
    <vlan>
      <tag id='252'/>
    </vlan>
  </portgroup>
  <portgroup name='vlan-all'>
    <vlan trunk='yes'>
      <tag id='1'/>
      <tag id='2'/>
      <tag id='252'/>
    </vlan>
  </portgroup>
</network>

Aktivieren

  • virsh net-define openswitch.xml
  • virsh net-start ovs-network
  • virsh net-autostart ovs-network
  • virsh net-list --all

XML Interface in der VM

<interface type='network'>
  <mac address='52:54:00:ce:c8:d1'/>
  <source network='ovs-network' portgroup='vlan1'/>
  <target dev='veth0-lulu'/>
  <model type='rtl8139'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>