`
luozhaoyu
  • 浏览: 343474 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

kvm虚拟机桥接模式上网配置

阅读更多
本文介绍如何配置kvm虚拟机桥接上网
首先是要在自己的debian/ubuntu上把网卡eth0设为桥接
auto eth0                                                                       
iface eth0 inet manual                                                          
                                                                                
auto br0                                                                        
iface br0 inet static                                                           
    address 10.5.0.80                                                           
    netmask 255.255.0.0                                                         
    gateway 10.5.0.67                                                           
    bridge_ports eth0                                                           
    bridge_stp off                                                              
    bridge_fd 0                                                                 
    bridge_maxwait 0


然后是关闭虚拟机,
如果你虚拟机用root装的
virsh -c qemu:///system shutdown vm0

否则
virsh -c qemu:///session shutdown vm0


配置虚拟机,
虚拟机的配置文件在$HOME/.libvirtd/qemu/vm0.xml下,这么改
    <interface type='bridge'>                                                                                                                         
      <mac address='52:54:00:48:27:68'/>                                           
      <source bridge='br0'/>                                                       
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

然后启动虚拟机,应该能自动分配ip了
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics