OVS安装

根据官网(www.openvswitch.org)上的文档做了个记录

1.安装针对LINUX和FreeBSD,如果是其他的环境可以阅读以下文档

    - INSTALL.Debian

    - INSTALL.Fedora

    - INSTALL.REHL

    - INSTALL.XenServer

2.编译需要的准备

    <1>

    - make                          GNU/BSD make都可

    - GNU C 编译器          匹配版本4.1,4.2,4.3

    - pkg-config                 已测试版本0.22

    - libssl                          可选,但是如果需要openflow就建议使用。由OpenSSL提供

    <2>必须安装列表

    - linux内核:          

        需要bridge功能,但是在使用OVS的datapath时要保证bridge不被使用

        入口流量管理需要内核配置选项NET_CLS_BASIC, NET_SCH_INGRESS, NET_ACT_POLICE,又或者built-in or as modules.  (NET_CLS_POLICE is
      obsolete and not needed.)

        如果GRE隧道被使用,那么推荐编译支持IPV6的内核

        为了更好的支持HTB,HFSC,需要启动各自的配置服务

        如需要支持TAP devices(a virtual ethernet device),需要启动CONFIG_TUN(a tun device is a virtual IP point-to-point device),两者区别:http://blog.csdn.net/clydezhou/article/details/6936701

    - 源码编译:        

        automake 1.10+,autoconf 2.64+,python 2.4+

    - 如果要修改ovsdbmonitor

        pyuic4 from PyQt4 (http://www.riverbankcomputing.co.uk).

    - 如果要修改the vswitchd database schem,E-R图(ovs-vswitchd.conf.db)要适当更新

        "dot" from graphviz (http://www.graphviz.org/).
        Perl.  Version 5.10.1 is known to work.  Earlier versions should also work.
        Python 2.x, for x >= 4.

    - 以下有利于编译ovs时更好的获取warnings

       "sparse" version 0.4.4 or later
      (http://www.kernel.org/pub/software/devel/sparse/dist/).
       GNU make.

3.安装需要的准备

    <1>安装的机器必须有以下软件:

    - 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
      http://www.linux-foundation.org/en/Net:Iproute2).

    <2>在linux中,必须确保/dev/urandom存在。为了支持TAP,必须确保/dev/net/tun存在

    <3>为了运行ovsdbmonitor tool

    - Python 2.x, for x >= 4.
    - Python Twisted Conch.
    - Python JSON.
    - PySide or PyQt4.
    - Python Zope interface module.

4.具体的编译安装

    <1>在代码目录运行:

      ./boot.sh

    <2>packet配置

       一般可以直接运行:./configure

       默认安装路径为/usr/local和/usr/local/var,如果需要修改,譬如改为/usr和/var,可使用如下参数:

          ./configure --prefix=/usr --localstatedir=/var

       还可指定编译器

          ./configure CC=gcc-4.2

       针对linux内核编译,如果是linux最好使用这一步

          ./configure --with-linux=/lib/modules/`uname -r`/buil 

       不使用系统默认架构时

          ./configure --with-linux=/path/to/linux KARCH=mips

    <3>make

       在BSD,需要使用gmake

    <4>make install

       安装可执行程序和联机手册至系统(默认是/usr/local下)

以下可能需要root权限!!!

    <5>加载核心模块

       insmod datapath/linux/openvswitch.ko

       注意:

       你可能需要为insmod指定完整的路径,/sbin/insmod。

       你可以通过/sbin/lsmod查看openvswitch是否存在来确认模块已经被载入。

       如果载入失败,可以通过命令:dmesg | tail来查看分析原因.以下是一些常见的错误。

       openvswitch: exports duplicate symbol br_should_route_hook (owned by bridge) ------bridge模块已经载入,执行/sbin/rmmod bridge,如果指令执行失败,并提示没有bridge模块存在,那么bridge安装在了系统内核中,需要从新配置系统并安装。

       openvswitch: exports duplicate symbol dp_ioctl_hook (owned by ofdatapath) ------ofdatapath已加载,需要去掉:/sbin/rmmod ofdatapath.

       最有可能出现的问题是,你所建立的openvswitch和你所希望建立的系统环境不一致,可以运行下面两条命令:

       /sbin/modinfo openvswitch.ko       (openvswitch.ko可能需要制定路径)
       /sbin/modinfo /lib/modules/`uname -r`/kernel/net/bridge/bridge.ko

       比较两条命令执行后显示的vermagic内容。如果不一致,那么安装错误。

    <6>make modules_install 安装一些可选模块,可不做

    <7>初始化数据库配置,在安装根目录下

      mkdir -p /usr/local/etc/openvswitch
      ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema

5.启动

      <1>在启动ovs-vswitchd之前,要先启动database和ovsdb-server。

     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

     如果没有安装SSL,省略:--private-key, --certificate, --bootstrap-ca-cert

     <2>初始化database(安装完后必须执行一次)

      ovs-vsctl --no-wait init

     <3>启动daemon进程,并让其连接到linux domain socket

     ovs-vswitchd --pidfile --detach

     2013-02-18T23:49:56Z|00001|reconnect|INFO|unix:/usr/local/var/run/openvswitch/db.sock: connecting...
     2013-02-18T23:49:56Z|00002|reconnect|INFO|unix:/usr/local/var/run/openvswitch/db.sock: connected

     <4>接下来就可以创建bridge和ports了。例如,创建一个bridge和两个ports

      ovs-vsctl add-br br0
      ovs-vsctl add-port br0 eth0
      ovs-vsctl add-port br0 vif1.0







                  





 


       




发布了22 篇原创文章 · 获赞 2 · 访问量 5万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章