NS-3 是一个主要由C++编写并兼容python脚本的网络模拟工具。学习它的目的在于模拟那些不容易在物理网络中实现的过程。
我参考的资料是NS3的官方tutorial,主要内容包括:
- 介绍
- 学习资源
- 开始上手
- 基本概念
- 调整(Tweaking)
- 构建拓扑
- 跟踪
- 数据收集
总结
好了,我要开始“愉快”的学习了。
1. Introduction
NS-3是个主要面向研究和教育的离散时间模拟器。这个项目于2006年启动,开源,不与ns-2兼容。本tutorial将构建几个模拟例子,讲解关键概念和特性。
NS-3的特点:
- NS-3由一系列的库组成,这些库关系松散,可以随时引入新的库,例如可视化部分;别的模拟工具往往是一个整体,结合了GUI。
- NS-3的工作环境往往是命令行或程序界面,而不是可视化的
- NS-3主要运行于linux下
2. Resources
2.1. 网站
Official web:http://www.nsnam.org/
Documents:http://www.nsnam.org/documentation/
wiki:http://www.nsnam.org/wiki
sourcecode:http://code.nsnam.org/
2.2. 代码版本控制
使用Mercurial
2.3. 编译/配置工具
使用基于python的waf(据说是适于编译复杂大系统)
2.4. 开发环境
使用c++和python
许多ns-3的API用python写的,但模块都是用C++写的。
C++指南:http://www.cplusplus.com/doc/tutorial/
ns-3使用了GNU toolchain,了解请看http://en.wikipedia.org/wiki/GNU_toolchain
2.5. Socket编程
使用ns-3要了解Socket编程概念,新手可参考书《TCP/IP Sockets in C》Donahoo Michael J. and Calvert Kenneth L. 或其他一些资料。
3. 开始动手
NS-3是一帮闲人自发搞起来的,所以没有包装的很完美。使用前要下载源代码,然后编译部署。
3.1. 下载NS-3
安装向导文档:https://www.nsnam.org/wiki/Installation
其中有关Ubuntu下安装NS-3的部分,摘录如下:
下列程序包在Ubuntu 16.04 release下验证通过,其他版本可能有所不同。
Note: Ubuntu 14.04 LTS release requires upgrade to gcc-4.9 from default gcc-4.8.
minimal requirements for C++ (release):
apt-get install gcc g++ python
minimal requirements for Python (release):
apt-get install gcc g++ python python-dev
minimal requirements for Python (development):
apt-get install mercurial python-setuptools git
Python API scanning support: cmake libc6-dev libc6-dev-i386 g++-multilib.To rescan Python bindings requires gccxml and pygccxml, which are installed by bake. However, for Ubuntu 16.04, gccxml will not build without a patch and a build flag described here: https://www.nsnam.org/bugzilla/show_bug.cgi?id=2451
qt4 development tools are needed for Netanim animator (Note: qt version qt4, not qt5, is required)
apt-get install qt4-dev-tools libqt4-dev
Support for generating modified python bindings
apt-get install cmake libc6-dev libc6-dev-i386 g++-multilib
and you will want to install gccxml and pygccxml as per the instructions for python bindings (or through the bake build tool as described in the tutorial).
Debugging:
apt-get install gdb valgrind
GNU Scientific Library (GSL) support for more accurate WiFi error models
apt-get install gsl-bin libgsl2 libgsl-dev
The Network Simulation Cradle (nsc) r