xen的虚拟桥接网络配置
接本博客的上篇博文http://luozhaoyu.iteye.com/blog/1400247
本文讲如何在xen中创建虚拟机之后,通过桥接方式将虚拟主机连接起来。
网络方面xen的主要配置文件有两个,
一个是/etc/xen/xend-config.sxp宿主服务器配置文件。
一个是/etc/xen/xen-test0.cfg虚拟机配置文件。
服务器配置
首先,xen会默认检测宿主服务器的默认网卡(可能是通过默认网关确定)eth0
把eth0的配置复制一份成为veth0,随后把eth0重命名为peth0,把veth0重命名为eth0
在xend-config.sxp中把
(network-script network-bridge)
brctl addif eth0 vif1.1
auto dummy0iface dummy0 inet static address 10.0.0.100 netmask 255.255.255.0
(network-script 'network-bridge netdev=dummy0')
(network-script 'network-bridge bridge=br0test')
(network-script custom-network-bridge)
vif = [ 'ip=10.0.0.101,mac=00:16:3E:87:CD:1D,bridge=br0test','ip=172.16.0.11,mac=00:16:3E:87:CD:1C' ]
brctl addif eth0 vif1.1