pof(Protocol Oblivious Forwarding)环境的搭建(原创,转载请注明)

 

 

Pof环境的搭建

一.总体概述

wps3107.tmp

架构如图:pc1为控制器,pc2为交换机。Pc3为server/client(一台装有两个虚拟机的pc,需将网络连接方式设为桥接。自行按照实验室的网段来分配ip,后面章节有详述),在本搭建教程中,controller为宿主机,pc2和pc3为宿主机上的两台虚拟机。

二.Java环境的配置

(一)Java环境配置

由于控制器是floodlight版本修改而来,所以作为控制器的宿主机必须要有java的开发环境。配置方法如下:

1. 在浏览器中打开http://www.oracle.com/technetwork/java/javase/downloads/index.html,中找到jdk download并点击(版本要在1.7以上,即java se7u**)这里选择如图:

wps3118.tmp

2. 选择accept,然后根据自己的linux版本下载对应的jdk,如64位,就下载红框中的第四个压缩包,32位就在下红框中的第二个压缩包,如图所示:

wps3128.tmp

3. 下载完成后,cd到文件下载的文件夹,(此教程都是默认下载目录:下载 文件夹)并解压,如图所示输入命令:

wps3139.tmp

4. 在/usr下创建java文件夹,并将解压后的文件夹mv过去,

wps313A.tmp

5. 编辑/etc/profile 文件,将以下命令添加到文件尾部,保存并关闭.请将jdk1.7.0_71改为自己对应的解压后的文件夹名称:

export JAVA_HOME=/usr/java/jdk1.7.0_71

export JRE_HOME=$JAVA_HOME/jre

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

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

wps313B.tmp

wps313C.tmp

6. 注销并重新登录,在终端里输入:java -version,如果输出如下,则证明配置成功:

wps314D.tmp

(二)eclipse安装

1. 在浏览器中打开http://www.eclipse.org/downloads/,找到Eclipse IDE for Java EE Developers,按照linux位数进行下载:

wps314E.tmp

2. 点击download进行下载,保存到下载文件夹:

wps314F.tmp

3. 下载完成后,cd到下载文件夹,输入以下命令进行解压:

wps3150.tmp

并将/opt文件夹赋予777权限,将解压缩的文件mv过去:

wps3151.tmp

至此,java环境的安装配置已经完成。

三.虚拟机的安装配置

(一)virtualbox的安装与启动

1. 在终端中输入 sudo apt-get install virtualbox,进行安装:

wps3161.tmp

2. 安装完成后在终端中输入 virtualbox 来启动virtualbox:

wps3162.tmp

(二)虚拟机的安装与启动

在总体概述中的架构中,已经提到需要两台虚拟机,一台switch和一台server/client。下面先说switch的安装:

1. 在启动virtualbox后,点击新建,然后依次输入名称这里为:pof_swich,类型和版本(根据自己的iso镜像,这里是ubuntu13.10 64bit),然后点击下一步:

wps3163.tmp

2. 内存大小,默认512M,点击下一步:

wps3174.tmp

3. 虚拟硬盘,选择现在创建虚拟硬盘,然后点击创建:

wps3184.tmp

4. 文件类型,默认第一个,然后点击下一步:

wps3185.tmp

5. 选择:动态分配,点击下一步:

wps3196.tmp

6. 文件位置和大小,默认名字就行,然后点击创建:

wps31A7.tmp

7. 左键选中刚才创建的虚拟机,然后点击设置:

wps31A8.tmp

8. 依次左键选中 存储,控制器IDE:没有盘片,然后点击分配光驱右侧的小光盘图标来加载镜像,选择镜像所在位置(这里是13.10,红框所示),点击打开:

wps31B8.tmpwps31B9.tmp

9. 左键依次选择 网络,连接方式选择:桥接网卡,界面名称选择eth0,然后点击确定:

wps31CA.tmp

10. 点击启动,启动虚拟机,出现选择启动盘界面,由于之前选择好了,直接点击启动就行:

wps31DB.tmpwps31DC.tmp

11. 语言选择中文简体,然后点击安装ubuntu,然后不要选择安装中下载更新,点击继续:

wps31EC.tmp

wps31FD.tmp

12. 选择默认的:清除整个磁盘并安装ubuntu,然后点击现在安装:

wps31FE.tmp

下面的步骤就是点击下一步即可,其中有步骤需要你创建用户名和密码,此处不再截图赘述。

13. 在安装好之后启动虚拟机,进行网络的配置(如果实验室是dhcp,忽略此步骤,此步骤针对无DHCP的情况)在登录进入系统之后,点击左侧的设置图标,然后左键点击网络,然后点击有线,选项:

wps320E.tmp

wps320F.tmp

14. 网络配置:选择IPV4设置,在方法里选择手动,然后点击添加,依次输入地址,子网掩码和网关,最后输入DNS服务器,点击保存:

wps3220.tmp

由于server/client虚拟机的安装方法一样,只需在第一步中更改名字为pofclient(自定义即可),此处不再赘述。

至此,所需的基本设施已经搭建好,下面进行pof环境的安装。


四.pof测试环境的搭建

(一)controller的安装与启动

我们将宿主机作为controller,controller的不需要配置,直接下载代码,导入eclipse启动即可:

1. 在浏览器中打开:http://www.poforwarding.org/downloads,下载POFController Source Code:

wps3221.tmp

2. Cd到下载文件夹,然后解压缩,在终端中输入下图所示代码:

wps3232.tmp

3. 打开/opt/eclipse文件夹,双击eclipse可执行文件,启动eclipse,选择好workspace后,进入工作台,在左侧空白处点击右键选择import,出现如下界面,依次选择General,Existiing Projects into Workspace,点击next:

wps3233.tmp

4. 选择刚才解压过的POFController文件夹,点击确定,然后点击finish:

wps3243.tmp

wps3254.tmp

5. 启动controller,在左侧工程栏里选中POFController并且右键,选择“Run As à Java Application ”,出现如下界面,在matching items里选择 “Main – net.floodlightcontroller.core”,点击ok启动:

wps3255.tmp

当出现如下界面表示controller运行成功:

wps3266.tmp

(二)switch的安装与启动

1. 启动虚拟机pofswitch,登录进入界面后,在浏览器中打开:http://www.poforwarding.org/downloads 下载POFSwitch Source Code:

wps3267.tmp

2. Cd到下载文件夹,解压缩下载的代码,如图所示输入如下代码:

wps3268.tmp

3. Cd到解压后的源码文件夹,进行配置,编译安装步骤,如图所示依次输入如下代码:

注:在输入之前,如果没有安装过build-essential,那么在终端里运行下:sudo apt-get install build-essential,再进行下面的步骤。

wps3269.tmp

wps326A.tmpwps326B.tmpwps326C.tmp

此时,Pofswitch已经安装好。


(三)server/client的配置

Server/client的主要作用是构造一个包,发送并且分析,所以不需要太多的配置。配置如下:

1.安装wireshark。打开虚拟机,登录进入界面,打开终端,在终端里输入如下图代码:

wps327C.tmp

会出现如下提示,输入Y,敲击确定键:

wps327D.tmp

直至结束,wireshark已经安装完毕,在终端输入sudo wireshark 即可运行。

wps327E.tmp

2.安装ostinato。Ostinato是一个专业的发包工具,可以构造数据包。安装方法如下:根据自己的版本号找到对应的代码,依次输入。

For xUbuntu 14.10 run the following:

sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/pstavirs:/ostinato/xUbuntu_14.10/ /' >> /etc/apt/sources.list.d/ostinato.list"sudo apt-get updatesudo apt-get install ostinato

You can add the repository key to apt. Keep in mind that the owner of the key may distribute updates, packages and repositories that your system will trust (more information). To add the key, run:

wget http://download.opensuse.org/repositories/home:pstavirs:ostinato/xUbuntu_14.10/Release.keysudo apt-key add - < Release.key 

For xUbuntu 14.04 run the following:

sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/pstavirs:/ostinato/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/ostinato.list"sudo apt-get updatesudo apt-get install ostinato

You can add the repository key to apt. Keep in mind that the owner of the key may distribute updates, packages and repositories that your system will trust (more information). To add the key, run:

wget http://download.opensuse.org/repositories/home:pstavirs:ostinato/xUbuntu_14.04/Release.keysudo apt-key add - < Release.key 

For xUbuntu 13.10 run the following:

sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/pstavirs:/ostinato/xUbuntu_13.10/ /' >> /etc/apt/sources.list.d/ostinato.list"sudo apt-get updatesudo apt-get install ostinato

You can add the repository key to apt. Keep in mind that the owner of the key may distribute updates, packages and repositories that your system will trust (more information). To add the key, run:

wget http://download.opensuse.org/repositories/home:pstavirs:ostinato/xUbuntu_13.10/Release.keysudo apt-key add - < Release.key 

For xUbuntu 13.04 run the following:

sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/pstavirs:/ostinato/xUbuntu_13.04/ /' >> /etc/apt/sources.list.d/ostinato.list"sudo apt-get updatesudo apt-get install ostinato

You can add the repository key to apt. Keep in mind that the owner of the key may distribute updates, packages and repositories that your system will trust (more information). To add the key, run:

wget http://download.opensuse.org/repositories/home:pstavirs:ostinato/xUbuntu_13.04/Release.keysudo apt-key add - < Release.key 

For xUbuntu 12.10 run the following:

sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/pstavirs:/ostinato/xUbuntu_12.10/ /' >> /etc/apt/sources.list.d/ostinato.list"sudo apt-get updatesudo apt-get install ostinato

You can add the repository key to apt. Keep in mind that the owner of the key may distribute updates, packages and repositories that your system will trust (more information). To add the key, run:

wget http://download.opensuse.org/repositories/home:pstavirs:ostinato/xUbuntu_12.10/Release.keysudo apt-key add - < Release.key 

For xUbuntu 12.04 run the following:

sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/pstavirs:/ostinato/xUbuntu_12.04/ /' >> /etc/apt/sources.list.d/ostinato.list"sudo apt-get updatesudo apt-get install ostinato

You can add the repository key to apt. Keep in mind that the owner of the key may distribute updates, packages and repositories that your system will trust (more information). To add the key, run:

wget http://download.opensuse.org/repositories/home:pstavirs:ostinato/xUbuntu_12.04/Release.keysudo apt-key add - < Release.key 

如13.10版本:在终端里依次输入:sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/pstavirs:/ostinato/xUbuntu_13.10/ /' >> /etc/apt/sources.list.d/ostinato.list"sudo apt-get update

wps327F.tmp

会提示如下错误,然后根据上面给的代码依次输入

wget http://download.opensuse.org/repositories/home:pstavirs:ostinato/xUbuntu_13.10/Release.keysudo apt-key add - < Release.key

wps3280.tmp

wps3291.tmp

然后如图所示再输入 sudo apt-get update

           sudo apt-get install ostinato

wps3292.tmpwps3293.tmp

3.安装完毕之后,在终端里输入 sudo ostinato,启动软件,如图:

wps3294.tmp

wps32A4.tmp


五.POFController和POFSwitch连接

在第四节中的安装controller中,我们已经启动了controller。接下来我们要启动switch来连接上controller。

1. 在虚拟机pofswitch的终端里,输入:sudo pofswitch -p 6633 -i IPADDR,然后敲击确定键。

这里的-p表示端口,IPADDR表示controller的ip地址,如10.10.16.199

wps32A5.tmp

2.   如果出现如下提示则表示连接成功:

wps32A6.tmp

六.总结

Pof测试环境已经安装完毕,本教程仅限于此。测试教程在下一篇。如需文档,请留言邮箱

posted @ 2014-12-01 20:14  山沟  阅读(2483)  评论(4编辑  收藏  举报