Open vSwitch安装
安装好操作系统
# lsb_release -a LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch:security-4.0-amd64:security-4.0-noarch:security-4.1-amd64:security-4.1-noarch Distributor ID: Ubuntu Description: Ubuntu 14.04.2 LTS Release: 14.04 Codename: trusty
安装依赖包
apt-get install -y build-essential fakeroot debhelper autoconf automake bzip2 libssl-dev openssl graphviz python-all procps python-qt4 python-zopeinterface python-twisted-conch libtool
下载最新版本openvswitch
wget http://openvswitch.org/releases/openvswitch-2.3.1.tar.gz
tar –zxvf openvswitch-2.3.1.tar.gz
cd openvswitch-2.3.1/
可以用# dpkg-checkbuilddeps检查下是否依赖包已经安装完毕
构建安装包
DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary
查看已经构建完成的包
# ls openvswitch-2.3.1 openvswitch-dbg_2.3.1-1_amd64.deb openvswitch-vtep_2.3.1-1_amd64.deb openvswitch-2.3.1.tar.gz openvswitch-ipsec_2.3.1-1_amd64.deb python-openvswitch_2.3.1-1_all.deb openvswitch-common_2.3.1-1_amd64.deb openvswitch-pki_2.3.1-1_all.deb openvswitch-datapath-dkms_2.3.1-1_all.deb openvswitch-switch_2.3.1-1_amd64.deb openvswitch-datapath-source_2.3.1-1_all.deb openvswitch-test_2.3.1-1_all.deb
安装openvswitch 2.3.1
dpkg -i openvswitch-common_2.3.1-1_amd64.deb openvswitch-switch_2.3.1-1_amd64.deb
查看内核模块是否加载
# lsmod | grep open openvswitch 65844 0 gre 13796 1 openvswitch vxlan 37629 1 openvswitch libcrc32c 12644 1 openvswitch
查看openvswitch版本
# ovs-vsctl -V ovs-vsctl (Open vSwitch) 2.3.1 Compiled Mar 14 2015 15:37:45 DB Schema 7.6.2
查看OVS进程是否启动
# ps -ef | grep ovs | grep -v grep root 1526 1 0 07:59 ? 00:00:00 ovsdb-server: monitoring pid 1527 (healthy) root 1527 1526 0 07:59 ? 00:00:00 ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/var/run/openvswitch/db.sock --private-key=db:Open_vSwitch,SSL,private_key --certificate=db:Open_vSwitch,SSL,certificate --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --no-chdir --log-file=/var/log/openvswitch/ovsdb-server.log --pidfile=/var/run/openvswitch/ovsdb-server.pid --detach --monitor root 1536 1 0 07:59 ? 00:00:00 ovs-vswitchd: monitoring pid 1537 (healthy) root 1537 1536 0 07:59 ? 00:00:02 ovs-vswitchd unix:/var/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --no-chdir --log-file=/var/log/openvswitch/ovs-vswitchd.log --pidfile=/var/run/openvswitch/ovs-vswitchd.pid --detach –monitor
Open vSwitch基本操作
创建一个名为br0的网桥
# ovs-vsctl add-br br0
查看创建的网桥
# ovs-vsctl list-br br0
将网卡接口 eth0 加入 br0
ovs-vsctl add-port br0 eth0
如果服务器就一个网卡且是远程操作此时肯定会断网,建议写条语句操作。这边是虚拟机断网之后通过管理窗口进去修改配置文件
# cat /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback auto br0 iface br0 inet dhcp auto eth0 iface eth0 inet manual up ifconfig $IFACE 0.0.0.0 up down ifconfig $IFACE down
重启下网络就可以了。查看信息。以下信息是我添加了br1以及连接controller之后的信息。
# ovs-vsctl show d0a719d3-310d-4863-ab52-b64378f03400 Bridge "br1" Port "br1" Interface "br1" type: internal Bridge "br0" Controller "tcp:192.168.136.129:6653" is_connected: true Port "eth0" Interface "eth0" Port "br0" Interface "br0" type: internal ovs_version: "2.3.1"
Floodlight安装管理
安装jdk和ant软件环境包
apt-get install build-essential default-jdk ant python-dev
一般网上教程都是git clone,我试过ant时编译报错,不知道是系统版本问题不,我就直接在github下载floodlight-master.zip包进行编译启动就没有问题。
下载解压之后
# cd floodlight-master/ # ant # java -jar target/floodlight.jar
运行成功后查看端口
# netstat -ntl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp6 0 0 :::8080 :::* LISTEN tcp6 0 0 127.0.0.1:6642 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 ::1:631 :::* LISTEN tcp6 0 0 :::6653 :::* LISTEN tcp6 0 0 :::6655 :::* LISTEN