[关闭]
@NewWorld 2015-12-23T15:11:39.000000Z 字数 1583 阅读 2720

Ubuntu14.04安装OpenvSwitch

SDN


1、下载安装 Ubuntu14.04 到虚拟机,这里我下的是32位

2、先更新一下源,顺便装个 vim 和 ssh server

  1. apt-get update
  2. apt-get -y install vim openssh-server

3、安装依赖条件

  1. apt-get -y install automake autoconf libssl-dev gcc uml-utilities libtool build-essential git pkg-config linux-headers-`uname -r`

4、下载 openvswitch-2.4.0.tar.gz

  1. wget http://openvswitch.org/releases/openvswitch-2.4.0.tar.gz

5、解压到当前目录,然后编译安装

  1. tar zxvf openvswitch-2.4.0.tar.gz
  2. cd openvswitch-2.4.0
  3. ./boot.sh
  4. ./configure --with-linux=/lib/modules/`uname -r`/build
  5. make && make install

6、载入内核模块

  1. # 查看 openvswitch 依赖的模块
  2. modinfo ./datapath/linux/openvswitch.ko
  3. # 发现 openvswitch.ko 依赖于 libcrc32c 模块,于是先载入 libcrc32c
  4. modprobe libcrc32c
  5. # 载入 openvswitch 模块
  6. insmod ./datapath/linux/openvswitch.ko
  7. # 查看模块载入情况,可看到 openvswitch 和 libcrc32c
  8. lsmod|grep open

7、配置 OVS

  1. # 创建 ovsdb 数据库
  2. mkdir -p /usr/local/etc/openvswitch
  3. ovsdb-tool create /usr/local/etc/openvswitch/conf.db ./vswitchd/vswitch.ovsschema
  4. # 配置启动 ovsdb 数据库
  5. ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
  6. --remote=db:Open_vSwitch,Open_vSwitch,manager_options \
  7. --private-key=db:Open_vSwitch,SSL,private_key \
  8. --certificate=db:Open_vSwitch,SSL,certificate \
  9. --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \
  10. --pidfile --detach
  11. # 初始化数据库
  12. ovs-vsctl --no-wait init
  13. # 开启 openvswitch 守护进程
  14. ovs-vswitchd --pidfile --detach

8、看到类似以下几行消息,表明 openvswitch 配置完毕

2015-11-27T07:41:59Z|00001|ovs_numa|INFO|Discovered 0 NUMA nodes and 0 CPU cores
2015-11-27T07:41:59Z|00002|reconnect|INFO|unix:/usr/local/var/run/openvswitch/db.sock: connecting...
2015-11-27T07:41:59Z|00003|reconnect|INFO|unix:/usr/local/var/run/openvswitch/db.sock: connected

9、根据下载的 openvswitch 版本的不同,配置命令略有差异,附上 官网配置地址

注:以上操作是在root账户下进行,普通账户请注意切换权限

配置命令介绍

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注