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

 

 

Pof环境的搭建

一.整体概述

wps3107.tmp

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

二.Java环境的配置

(一)Java环境配置

因为控制器是floodlight版本修改而来,因此做为控制器的宿主机必需要有java的开发环境。配置方法以下:java

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

wps3118.tmp

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

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/jreoracle

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

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测试环境已经安装完毕,本教程仅限于此。测试教程在下一篇。如需文档,请留言邮箱

相关文章
相关标签/搜索