# NS-3 介绍

The ns-3 project, started in 2006, is an open-source project developing ns-3.

ns3 全称:Network Simulator3(官方网址). 其是一个离散事件驱动的网络仿真器,全部采用 C++ 语言编写,也支持 Python 开进行开发。主要在 Linux 平台上运行.

# 官方资料

Primary documentation for the ns-3 project is available in five forms:

  • ns-3 Doxygen: Documentation of the public APIs of the simulator
  • Tutorial (this document), Manual, and Model Library for the latest release and development tree
  • ns-3 wiki

# NS-3 安装

系统为 Ubuntu 20.04 ,安装 ns-allinone-3.30.1

# 视频教程

视频链接:【Installation tutorial --- NS3】

# 参考文档

# 依赖包安装

sudo apt-get install g++ python3
sudo apt autoremove
sudo apt-get install python3-dev pkg-config sqlite3
sudo apt-get install python3-setuptools git mercurial
sudo apt-get install qt5-default mercurial
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
sudo apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev
sudo apt-get install autoconf cvs bzr unrar
sudo apt-get install gdb valgrind
sudo apt-get install uncrustify
sudo apt-get install doxygen graphviz imagemagick
sudo apt-get install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils dvipng latexmk
sudo apt-get install python3-sphinx dia
sudo apt-get install gsl-bin libgsl-dev libgsl23 libgslcblas0
sudo apt-get install tcpdump
sudo apt-get install sqlite sqlite3 libsqlite3-dev
sudo apt-get install libxml2 libxml2-dev
sudo apt-get install cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake python3-pip
sudo apt-get install libgtk-3-dev
sudo apt-get install vtun lxc uml-utilities
sudo apt-get install libboost-filesystem-dev

# ns-3 安装

mkdir workspace
cd workspace
wget https://www.nsnam.org/release/ns-allinone-3.30.tar.bz2
tar xjf ns-allinone-3.30.tar.bz2 
rm ns-allinone-3.30.tar.bz2
cd ns-allinone-3.30
sudo ./build.py --enable-examples --enable-tests

# 软件无法定位解决方法

解决方案

# 编译

首次编译通过 build.py 来完成,其编译后的目录下方的 waf 命令脚本就可以使用。当对源代码进行修改之后,需要 ./waf configure 来对源代码进行重新编译。
配置选项

  • --enable-examples :同时编译目录下方的示例脚本(主目录下方和 src 下方的示例脚本)
  • --enable-test :同时编译 src 下方的测试脚本
  • --build-profile :修改编译模式( debugoptimized
    ns-3 有两种编译模式,分别是 debugoptimized 模式, debug 模式为默认模式,当需要切换模式时,首先需要清除之前的编译结果:
    ./waf clean
    ./waf configure --build-profile=optimized
Edited on Views times

Give me a cup of [coffee]~( ̄▽ ̄)~*

Value WeChat Pay

WeChat Pay