FlowVisor介绍

来源:互联网 发布:西安星河网络小贷 编辑:程序博客网 时间:2024/06/06 10:42

简介

FlowVisor是树立在OpenFlow之上的网络虚构化平台,它可以将物理网络分成多个逻辑网络,从而实现开放软件定义网络(SDN)。它为管理员供给了普遍定义规矩来管理网络而不是通过调剂路由器和交流机来管理网络。网络虚拟化的本质是要能够抽象底层网络的物理拓扑,能够在逻辑上对网络资源进行分片或者整合,从而满足各种应用对于网络的不同需求。为了达到网络分片的目的,FlowVisor实现了一种特殊的OpenFlow Controller,可以看作其他不同用户或应用的Controllers与网络设备之间的一层代理。因此,不同用户或应用可以使用自己的Controllers来定义不同的网络拓扑,同时FlowVisor又可以保证这些Controllers之间能够互相隔离而互不影响。

 

安装

安装FlowVisor之前必须先解决FlowVisor的依赖关系,FlowVisor的编译运行需要系统已安装了JDKant,然后通过git获取FlowVisor源码再进行编译、安装和运行。

2.1 安装依赖

l 安装jdk

官网源码包中的INSTALL文件中要求jdk版本要在V1.6及以下,但实际的安装过程中使用OpenJDK V1.7也是完全没有问题的。输入以下命令完成安装:

$sudo apt-get install openjdk-7-jdk openjdk-7-jre openjdk-7-jre-lib

配置环境变量:

$sudo vim /etc/profile

在文件最末位添加以下内容:

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64

export JRE_HOME=/usr/lib/jvm/java-7-openjdk-amd64jre

export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

        export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

 

l 安装ant

INSTALL文件中并没有对ant的版本限制,所以直接输入以下命令:

$sudo apt-get install ant 

l 编译安装FlowVisor

使用git下载源码包:

$git clone git://github.com/OPENNETWORKINGLAB/flowvisor.git

下载完毕之后cdcontroller目录中并编译:

$cd controller

$make 

编译成功之后进行安装:

$sudo make install

下图中的sonoubuntu上原有的用户:

 

 

安装完成之后运行:

$nohup flowvisor /etc/openflow/config.json > /dev/null &

这样就能后台运行(&)将控制台的输出流导入/dev/null(不在控制台输出任何信息)

3 Fvctl命令行工具

3.1 命令参数

l -h 指定主机名,默认“localhost

l -p 指定端口名,默认“8080

l -uFlowVisor的管理用户,默认“fvadmin

l -fFlowVisor的密码文件,默认“none

l -v:版本信息

l --help:帮助信息

3.2 简述:

Fvctl是一个配置、调试、监控、管理运行FlowVisor实例的命令行工具。它可以展示当前FlowVisor的状态信息,包括特点、配置和flowspace条目。

每个FlowVisor示例都会运行一个JSONROC服务并接受以下(命令)API的调用。Fvctl就是一个能够调用这些api的命令行客户端。

3.3 命令

add-flowspace:创建一个流空间(flowspace)规则

add-slice:创建一个切片

get-config:显示通用FlowVisor配置参数

list-datapath-info:显示已连接设备的信息

list-datapath-stats:显示已连接设备统计信息

list-datapaths:显示设备信息

list-flowspace:显示流空间

list-fv-health:报告所有FlowVisor的的健康信息

List-links:显示所有的拓扑结构

List-slice-health:报告所有切片的健康信息

List-slice-info:显示切片信息

List-slice-stats:显示切片的统计信息

List-slices:显示已配置的切片

List-version:显示FlowVisor版本信息

Remove-flowspace:删除一个流空间规则

Remove-slice:删除一个切片

Save-config:保存FlowVisor的配置信息

Set-config:设置通用FlowVisor配置参数

Update-amin-password:更新管理密码

Update-flowspace:改变流空间规则参数

Update-slice:改变切片参数

Update-slice-passwd:改变切片密码

List-datapath-flowdb:如果流跟踪开启,显示流数据块的内容

List-datapath-flowrewritedb:显示已经应用的重写或扩展的FlowVisor

Unregisterevent-callback:从FlowVisor注销服务

*注:可以通过“fvctl help <command>”命令获得更多命令细节

3.3.1 slice操作

1)创建slice

使用如下命令创建新的切片,并指向控制器:

$fvctl -p 8888 add-sclice s1 tcp:192.168.119.130:6666 fv@gmail.com

以上命令中的fv@gmail.comadminContent,随便填即可

创建新的切片会要求输入fvadmin密码和设置新的slice密码,后者可不填。

 

(2)查看slice

查看slice的具体信息:

$fvctl -p 8888 list-slice-info s1 s1

 

查看slice的健康信息,如果没有连接到控制器,则会显示500服务器错误:

$fvctl -p 8888 list-slice-health

 

查看slice的统计,这里通过mininet>pingall命令执行之后可以查看到统计信息,若没有数据在网络中传输过,则没有信息。

$fvctl -p 8888 list-sclice-stats

 


(3)修改slice

修改slice的端口和控制器IP地址:

$fvctl -p 8888 update-slice s1 -n 192.168.5.79 -p 6633

 

(4)删除slice

可以批量删除slice,但需要注意的是一个slice只能对应一个控制器:

$fvctl -p 8888 remove-slice s1 s2

 

3.3.2 flowspace操作

(1)Flowspace包含下面字段:

字段名

含义

priority

优先级,0-65535

in_port

进入端口

dl_vlan

Vlan id, 0xffff 表示匹配非vlan包,否则指定为 0 - 4095表示12位的vlan id

dl_vpcp

Vlan优先级,

最外层VLAN头的PCP

dl_src

Ethernet Mac地址

dl_dst

Ethernet 目的Mac地址

dl_type

Ethernet 协议类型采用0 – 65535表示

nw_src

IP地址

nw_dst

目的IP地址

nw_proto

IP协议类型,十进制数0-255

nw_tos

IP Tos位,采用0-255表示

tp_src

TCP/UDP 源端口

tp_dst

TCP/UDP 目的端口

wildcards

匹配规则,掩码

actions

切片行为,指的是slice对这个flowspace拥有的权限, DELEGATE=1, READ=2, WRITE=4.actions的值为这3个的组合,所有取值范围为1-7

priority :值0:2^31

slice-perm:值0:7Delegate=1,Read=2,Write=4

(2)创建flowspace

$fvctl -p 8888 add-flowspace fs1 all 100 dl_dst=78:45:c4:2d:72:51 s1=5(match对应的操作可以使用any来进行全匹配

 

注:flowspace的名字可以重名。

(3)查看flowspace

查看flowspace规则

$fvctl -p 8888 list-flowspace 

 

注:也可以带-s参数,查看指定slcieflowspace

4)修改flowspace

修改fs1priority

$fvctl -p 8888 update-flowspace -p 200 fs1

 

 

(5)删除flowspace

删除多个flowspace

$fvctl -p 8888 remove-flowspace fs1 fs2

 

 

3.4 匹配语法(未完成)

部分fvctl命令可以接受描述一个或多个流的参数,这种流描述包含一系列用逗号隔开的字段=赋值。

下面的字段赋值描述了流如何匹配数据包。如果这些赋值在流语法中省略,这些字段就会被当作通配符;因此,如果所有字段都被省略,所得到的流将匹配所有的数据包。该字符的全部或者部分用来指定一个流,这个流匹配所有的数据包。

 

       The  following  field assignments describe how a flow matches a packet.

       If any of these assignments is omitted from the flow syntax, the  field

       is treated as a wildcard; thus, if all of them are omitted, the result

       ing flow matches all packets.  The string all or any is used to specify

       a flow that matches all packets.

 

       in_port=port_no

              Matches  physical  port  port_no.   Switch ports are numbered as

              displayed by fvctl getDeviceInfo DPID.

 

       dl_vlan=vlan

              Matches IEEE 803.1q virtual LAN tag  vlan.   Specify  0xffff  as

              vlan  to  match  packets that are not tagged with a virtual LAN;

              otherwise, specify a number between 0 and  4095,  inclusive,  as

              the 12-bit VLAN ID to match.

dl_src=mac

              Matches  Ethernet  source address mac, which should be specified

              as 6 pairs of  hexadecimal  digits  delimited  by  colons,  e.g.

              00:0A:E4:25:6B:B0.

 

       dl_dst=mac

              Matches Ethernet destination address mac.

 

       dl_type=ethertype

              Matches Ethernet protocol type ethertype, which should be speci

              fied as a integer between 0 and 65535, inclusive, either in dec

              imal  or  as a hexadecimal number prefixed by 0x, e.g. 0x0806 to

              match ARP packets.

 

       nw_src=ip[/netmask]

              Matches IPv4 source address ip, which should be specified as  an

              IP  address,  e.g.  193.168.1.1.   The  optional  netmask allows

              matching only on an IPv4 address prefix.  The netmask is  speci

              ficed "CIDR-style", i.e., 193.168.1.0/24.

 nw_dst=ip[/netmask]

              Matches IPv4 destination address ip.

 

       nw_proto=proto

              Matches  IP  protocol type proto, which should be specified as a

              decimal number between 0 and 255, inclusive, e.g. 6 to match TCP

              packets.

 

       nw_tos=tos/dscp

              Matches  ToS/DSCP  (only  6-bits, not modify reserved 2-bits for

              future use) field of IPv4 header tos/dscp, which should be spec

              ified as a decimal number between 0 and 255, inclusive.

 

       tp_src=port

              Matches transport-layer (e.g., TCP, UDP, ICMP) source port port,

              which should be specified as a  decimal  number  between  0  and

              65535  (in  the case of TCP or UDP) or between 0 and 255 (in the

              case of ICMP), inclusive, e.g. 80 to match  packets  originating

              from a HTTP server.

tp_dst=port

              Matches transport-layer destination port port.

 

DPID

       The  datapath  identifier  (DPID)  is  a unique ID to name and identify

       OpenFlow devices.  With fvctl, DPIDs are 8 bytes and can  be  specified

       as  a decimal number or as 8 hex octets, e.g., 00:00:00:23:10:35:ce:a5.

       The DPID ff:ff:ff:ff:ff:ff:ff is a "wildcard"  DPID  that  matches  all

       DPIDs.  It can be specified using any of the following short cuts: all,

       any, or ALL_DPIDS.

 

SLICE-PERM

       Slice actions is a comma separated list of  slices  that  have  control

       over  a  specific  FlowSpace.   Slice  actions  are of the form "slice

       name1=perm[slicename2=perm[...]]".  Each slice can have three types  of

       permissions  over  a flowspace: DELEGATE, READ, and WRITE.  Permissions

       are currently a bitmask  specified  as  an  integer,  with  DELEGATE=1,

       READ=2, WRITE=4.  So, "alice=5,bob=2" would give Alice's slice DELEGATE

       and WRITE permissions (1+4=5), but Bob only READ permissions.   Improv

       ing this interface is on the TODO list.  For example,

fvctl add-flowspace myflowspace all 2 any slice1=4,slice2=2

 

       DELEGATE

              A slice can delegate control of this flowspace to another slice.

              It also has permissions to un-delegate/reclaim the flowspace.

 

       READ   A slice receives packet_in's matching this flow entry, can  send

              LLDP messages and stats to switches in this flow entry, but can

              not write to or change the switch's flow table.  This is  useful

              for implementing a monitoring slice.

 

       WRITE  A slice has all of the permissions of READ but can also write to

              the flow table if the flow_mod matches this flow entry.  FlowVi

              sor will try to rewrite a flow_mod (if necessary) as the logical

              intersection of a slice's flow_mod and the union of  its  FlowS

              pace.

 



0 0