KVM之网桥创建(ubuntu 环境)
1、创建网桥的目的是为了让KVM虚拟机连接到这个网桥,从而使虚拟机可以和物理网络通信
2、当然,安装完kvm后,会自动建立一个网桥virbr0,这个网桥应该是nat模式
一、DHCP网桥创建
vim /etc/network/interfaces
这是interfaces配置文件的内容:
- #Thisfiledescribesthenetworkinterfacesavailableonyoursystem
- #andhowtoactivatethem.Formoreinformation,seeinterfaces(5).
- #Theloopbacknetworkinterface
- autolo
- ifaceloinetloopback
- #Theprimarynetworkinterface
- autoeth0
- ifaceeth0inetdhcp物理网卡也为DHCP
- autobr100
- ifacebr100inetdhcp配置br100网桥为DHCP
- bridge_portseth0配置br100建立在物理网卡eth0上
- bridge_stpoff
- bridge_fd
创建完成后,重启网络
静态网桥
vim /etc/network/interfaces
- #Thisfiledescribesthenetworkinterfacesavailableonyoursystem
- #andhowtoactivatethem.Formoreinformation,seeinterfaces(5).
- #Theloopbacknetworkinterface
- autolo
- ifaceloinetloopback
- #Theprimarynetworkinterface
- autoeth0
- ifaceeth0inetstatic
- address192.168.89.3
- gateway192.168.89.2
- netmask255.255.255.0
- network192.168.89.0
- broadcast192.168.89.255
- autobr100
- ifacebr100inetstatic
- bridge_portseth0
- bridge_stpoff
- bridge_fd0
- bridge_maxwait0
- address192.168.89.3
- network192.168.89.0
- netmask255.255.255.0
- broadcast192.168.89.255
- gateway192.168.89.2
创建完成后,重启网络