sudo apt-get install gcc g++ python python3 -y
sudo apt-get install gcc g++ python python3 python3-dev -y
sudo apt-get install python3-setuptools git mercurial -y
sudo apt-get install qt5-default mercurial -y
sudo apt-get install gir1.2-goocanvas-2.0 python-gi python-gi-cairo python-pygraphviz python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython ipython3 -y
sudo apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev -y
sudo apt-get install autoconf cvs bzr unrar -y
sudo apt-get install gdb valgrind -y
sudo apt-get install uncrustify -y
sudo apt-get install doxygen graphviz imagemagick -y
sudo apt-get install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils dvipng latexmk -y
sudo apt-get install python3-sphinx dia -y
sudo apt-get install gsl-bin libgsl-dev libgsl23 libgslcblas0 -y
sudo apt-get install tcpdump -y
sudo apt-get install sqlite sqlite3 libsqlite3-dev -y
sudo apt-get install libxml2 libxml2-dev -y
sudo apt-get install cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake -y
sudo apt-get install libgtk2.0-0 libgtk2.0-dev -y
sudo apt-get install vtun lxc uml-utilities -y
sudo apt-get install libboost-signals-dev libboost-filesystem-dev -y
cd
mkdir tarballs
cd tarballs
wget http://www.nsnam.org/release/ns-allinone-3.27.tar.bz2
tar -xjvf ns-allinone-3.27.tar.bz2
cd ns-allinone-3.27
sudo ./build.py
cd ns-3.27
sudo ./waf clean
sudo ./waf -d debug --enable-example --enable-tests configure 执行这个命令解决program 'hello-simulator' not found的问题
sudo ./waf
列出配置
cd ns-3.27
sudo ./waf --run hello-simulator
./test.py -c core #测试所有用例。
执行完后显示,238 of 241 tests passed (238 passed, 3 skipped, 0 failed, 0 crashed, 0 valgrind errors)
如果出现program ‘hello-simulator’ not found; available programs are: [‘scratch-simulator’, ‘scratch/scratch-simulator’, ‘subdir’, ‘scratch/subdir/subdir’, ‘test-runner’, ‘utils/test-runner’, ‘bench-simulator’, ‘utils/bench-simulator’, ‘bench-packets’, ‘utils/bench-packets’, ‘print-introspected-doxygen’, ‘utils/print-introspected-doxygen’, ‘tap-device-creator’, ‘src/fd-net-device/tap-device-creator’, ‘raw-sock-creator’, ‘src/fd-net-device/raw-sock-creator’, ‘tap-creator’, ‘src/tap-bridge/tap-creator’]
资料:
https://zhuanlan.zhihu.com/p/480888425
https://www.nsnam.org/releases/ns-3-27/documentation/下就有API Documentation ,点击进入就可以看到网页版的API文档。release下有不同的发布版本。
doxygen是一种开源跨平台的文档系统,用
./waf-doxygen编译本地doxygen文档,编译结束后在doc目录中出现html目录。
pyViz GUI更新和仿真在2个线程中,每100ms更新一次。pyViz从3.10版本已经集成到ns-3中,模块名为Visualizer。但要支持该模块,还需要安装一些python软件包。python-pygoocanvas是Pyviz可视化软件的依赖组件,从Ubuntu 18.04开始不再支持安装,因此需要使用如下语句进行替换。Unable to locate package python-pygoocanvas 问题解决
ubuntu:
sudo apt-get install python-dev python-pygraphviz python-kiwi python-pygoocanvas python-gnome2 python-gnome2-desktop-dev python-rsvg -y
若出现apt-get install E: 无法定位软件包问题,编辑/etc/apt/sources.list文件,添加源 deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse 即可。修改源后用apt update和apt upgrade更新,再安装。用config命令查看visualizer是否enable,如果没有,红色字体会显示缺少哪个模块,安装即可。显示enable后,./waf重新编译。
sudo ./waf -d debug --enable-example --enable-tests configure
使用方法,添加下列代码到main函数下,编译时,添加 --vis即可。
CommandLine cmd;
cmd.Parse (argc,argv)
如果用mobaxterm,显示MoTTY X11 proxy: Unsupported authorisation protocol。去普通用户目录下拷贝.Xauthority。
cp /home/wei/.Xauthority /root/.Xauthority
默认下载源码,但不编译。NetAnim是独立的基于Qt4的离线动画演示工具,从ns3仿真生成的xml格式的trace文件中获取信息生成数据分组流等动画。
先要安装Qt4,
apt-get install qt4-dev-tools
编译NetAnim
cd netanim
qmake NetAnim.pro
make
使用方法: