码迷,mamicode.com
首页 > 其他好文 > 详细

KVM虚拟机加入物理机网络的方法(可用于应急)

时间:2015-05-29 18:24:45      阅读:552      评论:0      收藏:0      [点我收藏+]

标签:kvm 虚拟机 网络瘫痪 应急


安装vnc和xauth:

yum install -y tigervnc xauth


增加一块网卡,直接连接到br-ex  

virsh edit instance-00000002

增加一块网卡,

    <interface type=‘bridge‘>

      <mac address=‘fa:16:3e:cd:82:1f‘/>

      <source bridge=‘qbr317a0ffe-56‘/>

      <target dev=‘tap317a0ffe-56‘/>

      <model type=‘virtio‘/>

      <driver name=‘qemu‘/>

      <address type=‘pci‘ domain=‘0x0000‘ bus=‘0x00‘ slot=‘0x03‘ function=‘0x0‘/>

    </interface>

      <interface type=‘bridge‘>

      <source bridge=‘br-ex‘/>

      <virtualport type=‘openvswitch‘>

      </virtualport>

    </interface>


(具体xml格式可以参考:http://libvirt.org/formatdomain.html#elementsNICSVirtual)


关闭虚拟机电源:

virsh destroy instance-00000002

启动虚拟机:

virsh start instance-00000002

使用virsh和vnc连接虚拟机:

virsh vncdisplay instance-00000002

:0

vncviewer :0


进入虚拟机,将第二块网卡的地址改为业务地址



虚拟机恢复:

将虚拟机内部网络设置复原


virsh edit instance-00000002

将临时增加的interface部分去掉。


通过管理界面启动虚拟机


   


本文出自 “yuweibing的技术博客” 博客,请务必保留此出处http://yuweibing.blog.51cto.com/3879355/1656459

KVM虚拟机加入物理机网络的方法(可用于应急)

标签:kvm 虚拟机 网络瘫痪 应急

原文地址:http://yuweibing.blog.51cto.com/3879355/1656459

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!