NS3安装(Windows+VMware+Kali) 2022.2

文章目录

  • NS3安装(Windows+VMware+Kali) 2022.2
    • VMware安装
    • 导入kali
    • 换源
    • 环境搭建
    • NS3下载与安装
      • visualizer 相关
      • build NS3
        • 常见错误
      • build结果
    • 测试与运行NS3

VMware安装

导入kali

换源

进入root模式

sudo su

配置源

vim /etc/apt/sources.list

注释原本的源,换成国内源地址(下列代码采用阿里云)

ies/
#deb http://http.kali.org/kali kali-rolling main contrib non-freedeb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
# Additional line for source packages
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free
~
~

其他源

官方源
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
中科大源
deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
阿里云源
deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
清华大学源
deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
浙大源
deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
东软大学源
deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
deb-src http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
新加坡kali源
deb http://mirror.nus.edu.sg/kali/kali/ kali main non-free contrib
deb-src http://mirror.nus.edu.sg/kali/kali/ kali main non-free contrib
163 Kali源
deb http://mirrors.163.com/debian wheezy main non-free contrib
deb-src http://mirrors.163.com/debian wheezy main non-free contrib

更新索引、软件

apt-get update
apt-get upgrade

环境搭建

官方tutorial给出

ns-3 has various optional extensions, but the main features just require a C++ compiler (g++ or clang++), Python (version 3.6 or above), CMake and a build-system (e.g. make, ninja, Xcode). We focus in this chapter only on getting ns-3 up and running on a system supported by a recent C++ compiler and Python runtime support.

 apt-get install gcc g++ python python3  apt-get install gcc g++ python python3 python3-dev  apt-get install python3-setuptools git mercurial  apt-get install qt5-default mercurial  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  apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev  apt-get install autoconf cvs bzr unrar  apt-get install gdb valgrind  apt-get install uncrustify  apt-get install doxygen graphviz imagemagick  apt-get install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils texlive-lang-portuguese dvipng latexmk  apt-get install python3-sphinx dia  apt-get install gsl-bin libgsl-dev libgsl23 libgslcblas0  apt-get install tcpdump  apt-get install sqlite sqlite3 libsqlite3-dev  apt-get install libxml2 libxml2-dev  apt-get install cmake libc6-dev libc6-dev-i386 libclang-dev llvm-dev automake  apt-get install python-pip
pip install cxxfilt  apt-get install libgtk2.0-0 libgtk2.0-dev  apt-get install vtun lxc  apt-get install libboost-signals-dev libboost-filesystem-dev  apt-get install python-dev python-pygraphviz python-kiwi python-pygoocanvas python-gnome2 gir1.2-goocanvas-2.0 python-rsvg

NS3下载与安装

使用git速度非常快,以git下载为例
git只能下载ns本体,如果想要同时安装NetAnim,则下载官网的软件包。然后用build.py 来build(而不是waf)

$ git clone https://gitlab.com/nsnam/ns-3-dev.git

如果想要使用最新版本,可以选择切换分支(202202最新版本为3.35)

$ git checkout -b ns-3.35-branch ns-3.35

个人切换成了最新版本

在正式bulid NS3前可以使用以下代码检查所需的环境是否齐全

$ ./waf configure --enable-examples --enable-tests

如果没有更新成最新版本,从git下载的内容没有waf文件,取代它的是ns3,以上代码改为

./ns3 configure --enable-examples --enable-tests

下面是一些可选模块的安装情况

---- Summary of optional NS-3 features:
Build profile                 : debug
Build directory               :
BRITE Integration             : not enabled (BRITE not enabled (see option --with-brite))
DES Metrics event collection  : not enabled (defaults to disabled)
DPDK NetDevice                : not enabled (libdpdk not found, $RTE_SDK and/or $RTE_TARGET environment variable not set or incorrect)
Emulation FdNetDevice         : enabled
Examples                      : enabled
File descriptor NetDevice     : enabled
GNU Scientific Library (GSL)  : not enabled (GSL not found)
Gcrypt library                : not enabled (libgcrypt not found: you can use libgcrypt-config to find its location.)
GtkConfigStore                : not enabled (library 'gtk+-3 >= 3.22' not found)
MPI Support                   : not enabled (option --enable-mpi not selected)
NS-3 Click Integration        : not enabled (nsclick not enabled (see option --with-nsclick))
NS-3 OpenFlow Integration     : not enabled (OpenFlow not enabled (see option --with-openflow))
Netmap emulation FdNetDevice  : not enabled (needs net/netmap_user.h)
Network Simulation Cradle     : not enabled (NSC not found (see option --with-nsc))
PlanetLab FdNetDevice         : not enabled (PlanetLab operating system not detected (see option --force-planetlab))
PyViz visualizer              : not enabled (Python Bindings are needed but not enabled)
Python Bindings               : not enabled (PyBindGen missing)
Real Time Simulator           : enabled
SQLite stats support          : not enabled (library 'sqlite3' and/or semaphore.h not found)
Tap Bridge                    : enabled
Tap FdNetDevice               : enabled
Tests                         : enabled
Threading Primitives          : enabled
Use sudo to set suid bit      : not enabled (option --enable-sudo not selected)
XmlIo                         : enabled
'configure' finished successfully (3.546s)

visualizer 相关

因为我非常想安装visualizer 模块,所以我继续安装

PyViz visualizer              : not enabled (Python Bindings are needed but not enabled)
Python Bindings               : not enabled

首先解决pyBindings

pip install pybindgen
PyViz visualizer              : not enabled (Missing python modules: gi.repository.GooCanvas)
Python API Scanning Support   : not enabled (Missing 'pygccxml' Python module)
Python Bindings               : enabled

在源中增加

deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse

并更新索引、软件

安装后,虚拟机可能出现无法与物理机共享剪切板的情况,此时reboot即可

apt-get install gi.cairo
apt-get install gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3

其他人的解决方法

#安装依赖包(

sudo apt install g++ python3 python3-dev pkg-config sqlite3 python3-setuptools git qt5-default mercurial gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gdb valgrind uncrustify doxygen graphviz imagemagick tcpdump sqlite sqlite3 libsqlite3-dev libxml2 libxml2-dev libgtk-3-dev vtun lxc uml-utilities libboost-filesystem-dev python3-pip cmake libc6-dev libc6-dev-i386 automake -y
#安装Python依赖库
sudo pip3 install PyBindGen pygccxml castxml -i https://pypi.douban.com/simple
#build
./build.py

PyViz环境ok!

PyViz visualizer              : enabled
Python API Scanning Support   : not enabled (Missing 'pygccxml' Python module)
Python Bindings               : enabled
Real Time Simulator           : enabled

build NS3

$ ./waf build

常见错误

build中可能存在内存问题(status 4)

法1

sudo dd if=/dev/zero of=/swapfile bs=64M count=16
sudo mkswap /swapfile
sudo swapon /swapfile

编译完成后可以选择撤销该操作(也可以不做)

sudo swapoff /swapfile
sudo rm /swapfile

法2

直接修改内存为4G(或者更高)

status 1的解决方法

CXXFLAGS="-Wall" ./waf configure --enable-examples --enable-tests

然后build

build结果

测试与运行NS3

测试NS3

$ ./test.py

所有的测试要么通过,要么被跳过。如果这样,说明NS3模拟器运行正常。

可以开始运行程序,以系统自带的first.cc为例

$ ./waf --run first
└─# ./waf --run first                                                1 ⨯ 1 ⚙
Waf: Entering directory `/home/kali/Desktop/ns-3-dev/build'
Waf: Leaving directory `/home/kali/Desktop/ns-3-dev/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (1.309s)
At time +2s client sent 1024 bytes to 10.1.1.2 port 9
At time +2.00369s server received 1024 bytes from 10.1.1.1 port 49153
At time +2.00369s server sent 1024 bytes to 10.1.1.1 port 49153
At time +2.00737s client received 1024 bytes from 10.1.1.2 port 9

如果想要获得更多信息,可以输入

$ ./waf --run 'first --PrintHelp'

【NS3】NS3安装 visualizer模块安装 (Windows+VMware+Kali) 2022.2相关推荐

  1. python怎么安装turtle_Turtle模块安装

    python3.7.0中,Turtle海龟模块安装指南 1.查看是否安装turtle 查看Python中已经安装的模块,在cmd命令行输入:pip3 list 如果没有找到turtle,就进行安装 D ...

  2. Adobe Acrobat Pro安装许可模块安装失败

    1.问题描述: 若出现"Acrobat 许可模块安装失败",请先删除AAM文件目录后再安装. C:\Program Files (x86)\Common Files\Adobe\O ...

  3. python模块安装_Python模块安装问题

    目录 ------------------------------------------------------ 安装工具setuptools(及基本使用) 安装工具pip(及基本使用)(plus: ...

  4. python安装rarfile模块_python windows下安装pip及rarfile

    python之所以被广泛使用,倒不见得是本身语法简单,而是而nodejs/javascript一样把三方库的依赖管理简化了,而不用和java一样非得通过maven管理,而且还得打包后在classpat ...

  5. python安装及模块安装

    总结文档 一. 环境配置 1. Python3.6:https://www.python.org/downloads/windows/ 2. Meld源码: https://gitlab.gnome. ...

  6. Node.js安装-yarm安装及环境配置-Windows篇

    一.安装环境 1.电脑系统:Windows 10 (64位) 2.Node.js:v15.5.1(64位) 3.NPM版本:7.3.0 二.安装Node.js步骤 1.Node.js版本下载: htt ...

  7. OpenCV SFM模块安装

    OpenCV SFM模块安装 SFM模块安装 依存关系 安装 必需的依存关系 Ceres Solver SFM模块安装 依存关系 Motion的结构模块取决于某些开源库. Eigen 3.2.2 或更 ...

  8. python第三方插件pip是什么_Python怎么安装第三方模块?

    原标题:Python怎么安装第三方模块? Python中有哪几种方法安装第三方模块,安装Python第三方模块的方法有很多,这里介绍三种方法安装第三方模块. [方法一]: 通过setuptools来安 ...

  9. geohash 模块安装及使用(Anaconda.Python 2)

    1 安装场景 在 anaconda多内核环境中,实现 由 经纬度 得到 geohash 编码 . 实现方式: 安装 Geohash 模块 安装方式 通过 命令行 安装 在 Anaconda Promp ...

最新文章

  1. Faas 和无服务器架构
  2. 一般屏幕的3D模型是公开的吗?
  3. C++的一些知识点摘抄(创建基本类 高级类)
  4. VHDL编码器和译码器的设计
  5. DB2 常用操作命令集合
  6. mysql 导致iis 假死_php使用MySql函数导致Apache(iis)崩溃的问题解决方案
  7. 【嵌入式Linux】嵌入式Linux应用开发基础知识之串口应用编程
  8. 缅柬泰之色---彩图大串联 一 (缅甸篇)
  9. 矢量网络分析仪测试软件,ZND 矢量网络分析仪
  10. 微信公众号模板消息推送问题汇总
  11. Android新浪微博授权提示:文件不存在 C8998 的终极解决方法
  12. 饿了么:业务井喷时,订单系统架构这样演进
  13. linux克隆后静态ip,Centos7克隆后配置静态ip无法上网
  14. 调出夕阳日落照片效果
  15. [导入]雨音唱片-《音乐诗画 4CD》四季系列 320k/mp3(亲传)
  16. 用python来编写TSP问题
  17. 时序数据库:TimescaleDB的安装
  18. 使用DBLINK查询时报ORA-00600: internal error code, arguments: [kzdlk_zt2 err]
  19. 智能车图像部分——摄像头寻迹
  20. apipost生成word格式的接口文档,接口文档合并操作

热门文章

  1. 什么是嵌入式 如何理解嵌入式系统开发
  2. DEVC++的几个实用小技巧
  3. 计算广告学习笔记1.2 广告的基础知识-广告的有效性模型
  4. 开放申请 | 2020年百度奖学金正式启动
  5. VS2019 配色_NBA球员上脚:基德穿AJ13湖人配色,莫兰特的保罗乔治4代
  6. 如何正确的设置使用代理IP?
  7. 【金三银四】 一文弄懂 js 数据类型、堆栈内存、作用域(链)、闭包知识拓展 (一)
  8. echarts中y轴设置刻度_ECharts中y坐标轴刻度的属性
  9. LeetCode刷题(python)——476. 数字的补数
  10. 截至2022年12月共计451个信息安全国家标准汇总