KVM上のVMに対してOpen vSwitchのインタフェースをアタッチする
環境
[root@kvm02]ovs-vsctl show 0f695921-8a70-46a5-a588-a47240e431da Bridge ovs-pub Port "vnet2" Interface "vnet2" Port "enp7s0f1" Interface "enp7s0f1" Port ovs-pub Interface ovs-pub type: internal Bridge ovs-mng Port "vnet1" Interface "vnet1" Port "enp2s0f0" Interface "enp2s0f0" Port ovs-mng Interface ovs-mng type: internal Bridge ovs-dummy Port ovs-dummy Interface ovs-dummy type: internal Port "vnet3" Interface "vnet3" Bridge ovs-fuel Port "enp2s0f1" Interface "enp2s0f1" Port "vnet0" Interface "vnet0" Port ovs-fuel Interface ovs-fuel type: internal ovs_version: "2.3.1"
<interface type='network'> <mac address='52:54:00:60:db:b8'/> <source network='ovs-dummy'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface>
手順
- VMのコンソールに接続してログイン
virsh console srv
- NICの再構成をする為、定義ファイルを削除
rm /etc/udev/rules.d/70-persistent-net.rules
- 該当VMを停止
shutdown -h now
4.XMLファイルを編集
virsh edit srv
以下のようにxmlを編集
<interface type='bridge'> <mac address='52:54:00:60:db:b8'/> <source bridge='ovs-pub'/> <virtualport type='openvswitch'> <parameters interfaceid='75c7de80-3c5c-4c97-8739-84113ae2fbba'/> </virtualport> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <interface type='bridge'> <mac address='52:54:00:50:ca:11'/> <source bridge='ovs-mng'/> <virtualport type='openvswitch'> <parameters interfaceid='544b6771-04d9-46fc-8822-dbd878a3efca'/> </virtualport> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </interface>
- VMを起動
virsh start srv
- VMのコンソールに接続して状態を確認する
virsh console srv