一 :测试环境介绍:
host1: ubuntu13.04
(uanme -r ) 3.8.0-16-generic
cat /etc/network/interfaces
auto eth0
iface eth0 inet static
address 10.100.5.241
netmask 255.255.0.0
broadcast 10.100.255.255
gateway 10.100.0.254
dns-nameservers 10.1.0.3
host2:
ubuntu13.04
(uanme -r ) 3.8.0-16-generic
cat /etc/network/interfaces
auto eth0
iface eth0 inet static
address 10.100.5.247
netmask 255.255.0.0
network 10.100.0.0
broadcast 10.100.255.255
gateway 10.100.0.254
dns-nameservers 10.1.0.3
( 二 至五步骤host1 和host2 操作相同。字体有颜色的地方两台机器不同之处)
二: 编译安装openvwitch和libvirt 源码:
1 编译安装openvswitch:
(参考: http://networkstatic.net/configuring-vxlan-and-gre-tunnels-on-openvswitch/ )
apt-get update
apt-get install -y git automake autoconf gcc uml-utilities libtool build-essential git pkg-config linux-headers-`uname -r`
wget http://openvswitch.org/releases/openvswitch-1.10.0.tar.gz
tar zxvf openvswitch-1.10.0.tar.gz
cd openvswitch-1.10.0
./boot.sh
./configure --with-linux=/lib/modules/`uname -r`/build
make && make install
make modules_install
insmod datapath/linux/openvswitch.ko
mkdir -p /usr/local/etc/openvswitch
ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
ovsdb-server -v --remote=punix:/usr/local/var/run/openvswitch/db.sock \
--remote=db:Open_vSwitch,manager_options \
--private-key=db:SSL,private_key \
--certificate=db:SSL,certificate \
--pidfile --detach --log-file
ovs-vsctl --no-wait init
ovs-vswitchd --pidfile --detach
ovs-vsctl show
2 编译安装并启动libvirt
( 参考: http://blog.csdn.net/u011740215/article/details/10064527 )
三: 配置网桥并设置VXLAN:
ovs-vsctl add-br br0
ovs-vsctl add-port br0 eth0