我的平台是centos6.6+xen4.6。由于xen的版本较高,查到陪网桥的资料都是旧版本的xen,多余的配置比较多。自己试了试,可以上网了,虚拟机也能create。我主要是在/etc/sysconfig/network-scripts下修改了ifcfg-eth0,和ifcfg-br0两个文件,如果没有文件,添上即可。
ifcfg-eth0文件如下:
DEVICE=eth0
BRIDGE=eth1
ONBOOT=yes
NM_CONTROLLED=no
HWADDR=00:23:5A:3B:2D:B5
UUID=ce4f28ad-6a6d-4b4c-a077-70ba6b5360b0
ifcfg-br0文件如下:
DEVICE=eth1
BOOTPROTO=dhcp
DELAY=0
ONBOOT=yes
TYPE=Bridge
NM_CONTROLLED=no
写好文件之后
[root@localhost network-scripts]# service NetworkManager stop
[root@localhost network-scripts]# service network restart
Shutting down interface eth1: [ OK ]
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth1:
Determining IP information for eth1... done.
[ OK ]
[root@localhost network-scripts]#
再用ping命令试一下网络,可以上网;用ifconfig查看下网络参数;然后再用xl cre试下能否新建虚拟机,发现再无报错了,虚拟机也新建成功。
[root@localhost network-scripts]# xl list -Z
Name ID Mem VCPUs State Time(s) Security Label
Domain-0 0 2977 2 r----- 896.3 system_u:system_r:dom0_t
1-centos6.4 1 1024 1 -b---- 51.7 system_u:system_r:domU_t