KVM:虚拟机网卡模式改为bridge

  • Post author:
  • Post category:其他


kvm中虚拟机网卡默认为nat模式,如果想调整为bridge,只需要进行下面简单的几步:

[root@node160 ~]# virsh edit CentOS-7.3-X86_64

将xml配置文件中的:

1
2
3
4
5
6



<interface


type


=


'network'


>



<mac address=


'52:54:00:e4:7c:77'


/>



<


source


network=


'default'


/>



<model


type


=


'virtio'


/>



<address


type


=


'pci'


domain=


'0x0000'


bus=


'0x00'


slot=


'0x03'


function


=


'0x0'


/>



<


/interface


>

修改为:

1
2
3
4
5
6



<interface


type


=


'bridge'


>



<mac address=


'52:54:00:e4:7c:77'


/>



<


source


bridge=


'br0'


/>



<model


type


=


'virtio'


/>



<address


type


=


'pci'


domain=


'0x0000'


bus=


'0x00'


slot=


'0x03'


function


=


'0x0'


/>



<


/interface


>


本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/1974226,如需转载请自行联系原作者