ubuntu12.04安装OVS

1.下载openVswitch 

ovs官网

2.运行如下脚本

#!/bin/bash
cd /home/sdn/ovs/openvswitch-2.8.5
rm /usr/local/etc/openvswitch/conf.db


kill `cd /usr/local/var/run/openvswitch&& cat ovsdb-server.pid ovs-vswitchd.pid`

rmmod openvswitch
#./boot.sh
#构建基于Linux内核的交换机。
make clean
./configure --with-linux=/lib/modules/`uname -r`/build 2>/dev/null
#编译并安装OVS 2.3.0。
make

make install 
#我们需要安装并加载构建的内核模块。
make modules_install
#如果需要OVS支持VLAN功能,还需要加载openvswitch.ko模块,如果不需要,此步可以忽略。
# modinfo ./datapath/linux/openvswitch.ko | grep depend
modprobe nf_nat
modprobe nf_nat_ipv6
modprobe nf_nat_ipv4
modprobe gre
modprobe nf_conntrack
modprobe ip_tunnel
modprobe nf_defrag_ipv6
modprobe libcrc32c
modprobe nf_defrag_ipv4

insmod datapath/linux/openvswitch.ko

#insmod datapath/linux/openvswitch.ko

modprobe openvswitch



#使用ovsdb工具初始化配置数据库。
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,Open_vSwitch,manager_options --private-key=db:Open_vSwitch,SSL,private_key --certificate=db:Open_vSwitch,SSL,certificate --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --pidfile --detach --log-file
ovs-vsctl --no-wait init
ovs-vswitchd --pidfile --detach --log-file

3.如果数据库连接失败,执行如下脚本

#!/bin/bash
chmod 777 /usr/var/run/openvswitch/db.sock
ovsdb-server --remote=punix:/usr/var/run/openvswitch/db.sock \
                     --remote=db:Open_vSwitch,Open_vSwitch,manager_options \
             --private-key=de:Open_vSwitch,SSL,private_key\
             --certificate=db:Open_vswitch,SSL,certificate\
             --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert\
                     --pidfile --detach
ovs-vsctl --no-wait init
ovs-vswitchd --pidfile --detach

4.出错位置记录

装数据库那部分,注意创建的文件夹位置要正确

参考链接:安装OVS 

posted @ 2018-12-04 15:03  冲向云霄1998  阅读(560)  评论(0编辑  收藏  举报