ofswitch13模块的安装(搭配ns-3.2.6)

安装libns3ofswitch13.a静态库

# 安装需要的库
$ sudo apt-get install build-essential gcc g++ python git mercurial unzip cmake
$ sudo apt-get install libpcap-dev libxerces-c-dev libpcre3-dev flex bison
$ sudo apt-get install pkg-config autoconf libtool libboost-dev
# 下载NetBee并解压
$ wget https://bitbucket.org/ljerezchaves/ofswitch13-module/downloads/nbeesrc.zip
$ unzip nbeesrc.zip
# 编译
$ cd netbee/src/
$ cmake .
$ make
# 复制共享库
$ sudo cp ../bin/libn*.so /usr/local/lib
$ sudo ldconfig
$ sudo cp -R ../include/* /usr/include/
# 拿到ofsoftswitch13代码
$ git clone https://github.com/ljerezchaves/ofsoftswitch13
$ cd ofsoftswitch13
$ git checkout v3.1.x
# 配置然后编译库
$ ./boot.sh
$ ./configure --enable-ns3-lib
$ make
# 然后就会生成静态库 libns3ofswitch13.a

如下图所示:
这里写图片描述

➜  ofsoftswitch13 git:(5e31ed4) mlocate libns3ofswitch13.a                                                                        [21:18:26]
/home/cqq/repos/netbee/src/ofsoftswitch13/udatapath/libns3ofswitch13.a

拿到ns-3.2.6代码

# 3.2.6版本是当前的稳定版
$ hg clone http://code.nsnam.org/ns-3.26
$ cd ns-3.26
# 在配置编译ns-3模拟器之前,先从以下项目中拿到OFSwitch13,然后放到w新的src/ofswitch13目录下
$ hg clone https://bitbucket.org/ljerezchaves/ofswitch13-module src/ofswitch13
$ cd src/ofswitch13
$ hg update 3.1.0
$ cd ../../
# 然后给ofswitch13/utils目录下的代码打补丁
$ patch -p1 < src/ofswitch13/utils/ofswitch13-src-3_26.patch
$ patch -p1 < src/ofswitch13/utils/ofswitch13-doc-3_26.patch

这里写图片描述

The ofswitch13-src-3_26.patch creates the new OpenFlow receive callback at CsmaNetDevice and
virtualNetDevie, allowing OpenFlow switch to get raw packets from these devices. These are the only required
change in the ns-3 code to allow OFSwitch13 usage. The ofswitch13-doc-3_26.patch is optional.

参考:
http://www.lrc.ic.unicamp.br/ofswitch13/ofswitch13.pdf

注意

git clone的时候,如果速度较慢,可以设置代理:

alias git_proxy_local='git config --global http.proxy socks5://192.168.170.1:1086; \
    git config --global https.proxy socks5://192.168.170.1:1086'
alias git_proxy_off='git config --global --unset http.proxy; \
    git config --global --unset https.proxy'

但是注意这只对http/https协议有效,而不是git协议。
详见下图(教训:
这里写图片描述

猜你喜欢

转载自blog.csdn.net/caiqiiqi/article/details/79609924