Chinaunix首页 | 论坛 | 博客
  • 博客访问: 314637
  • 博文数量: 64
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 1972
  • 用 户 组: 普通用户
  • 注册时间: 2012-05-31 21:53
个人简介

文明之精神,野蛮之体魄。

文章分类
文章存档

2015年(4)

2013年(60)

我的朋友

分类: 虚拟化

2013-05-28 11:54:59

准备工作
在Open vSwitch 分布中编译userspace程序,需要下面软件
- A make program, e.g. GNU make. BSD make should also work.
- The GNU C compiler. We generally test with version 4.1, 4.2, or 4.3.
- pkg-config. We test with version 0.22.
- libssl, from OpenSSL, is optional but recommended if you plan to connect the Open vSwitch to an OpenFlow controller. libssl is required to establish confidentiality and authenticity in the connections from an Open vSwitch to an OpenFlow controller. If libssl is installed, then Open vSwitch will automatically build with support for it.

在linux编译内核模块,还需要安装下面的软件。如果你不能建造或安装内核模块,你可以使用userspace-only实现。

The Open vSwitch datapath requires bridging support (CONFIG_BRIDGE) to be built as a kernel module. (This is common in kernels provided by Linux distributions.) The bridge module must not be loaded or in use. If the bridge module is running (check with "lsmod | grep bridge"), you must remove it ("rmmod bridge") before starting the datapath.

操作
安装Open vSwitch之前确保安装了下面的软件
- libc compatible with the libc used for build.
- libssl compatible with the libssl used for build, if OpenSSL was used for the build.
- On Linux, the same kernel version configured as part of the build.
- For optional support of ingress policing on Linux, the "tc" program from iproute2 (part of all major distributions and available at ).

执行
apt-get install build-essential
apt-get install openssl

On Linux you should ensure that /dev/urandom exists. To support TAP devices, you must also ensure that /dev/net/tun exists.
ls -l /dev/urandom
ls -l /dev/net/tun

安装Open vSwitch
1.下载
Openvswitch包下载地址:
root@ubuntu229:~# wget
2.解压
root@ubuntu229:~# tar -xzf openvswitch-1.9.0.tar.gz
3.安装
生成内核模式的Open vSwitch时需指定的内核源码编译目录,基本步骤如下
cd openvswitch-1.9.0/
./configure --with-linux=/lib/modules/`uname -r`/build
make && make install
insmod datapath/linux/openvswitch.ko
补充一下DataPath的概念,OpenFlow就是控制和数据转发分离,而控制端,就叫做Controller Path,比如floodlight等;负责转发数据的数据转发端,就叫做DataPath,也就是支持OpenFlow的硬件或者软件交换机Switch。

配置Open vSwitch

建立OpenVSwitch配置文件和数据库
root@ubuntu229:~# mkdir -p /usr/local/etc/openvswitch
root@ubuntu229:~# ovsdb-tool create /usr/local/etc/openvswitch/conf.db /usr/local/share/openvswitch/vswitch.ovsschema

启动配置数据库
root@bogon:~# ovsdb-server
--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 --bootstrap-ca-cert=db:SSL,ca_cert
--pidfile --detach
如果你built Open vSwitch 没有加SSL 支持,省略--private-key, --certificate, and --bootstrap-ca-cert

查看启动情况
ps -ef | grep ovsdb-server

初始化数据库
root@ubuntu229:~# ovs-vsctl --no-wait init
//仅需在第一次创建数据库时运行,但是每次都运行也没问题
启动Open vSwitch daemon,连接到同样的Unix domain socket上
root@ubuntu229:~# ovs-vswitchd --pidfile --detach
成功后,会有三个进程,一个ovs_workeq进程,一个ovs-vswitchd进程,一个ovsdb-server进程

升级Open vSwitch
升级Open vSwitch的时候,也需要升级数据库架构,步骤如下
1.停止Open vSwitch daemons
kill `cd /usr/local/var/run/openvswitch && cat ovsdb-server.pid ovs-vswitchd.pid`
2.安装新的版本
方法同上,下载,解压,configure make make install
3.升级数据库
两种情况如下
如果数据库没有重要的信息,可以直接删除数据库文件,然后用ovsdb-tool命令重新创建,方法同上。
如果要保留数据库的内容,首先把它备份一下,然后使用ovsdb-tool convert命令升级,
ovsdb-tool convert /usr/local/etc/openvswitch/conf.db
/usr/local/share/openvswitch/vswitch.ovsschema
4.启动Open vSwitch daemon
方法同上

阅读(7574) | 评论(0) | 转发(1) |
0

上一篇:Open vSwitch介绍

下一篇:kvm基本原理

给主人留下些什么吧!~~