安装参考:Ubuntu 18.04和16.04 安装 ns-3.29 脚本安装 ns3 和 Pyviz 显示_ns3 3.29-CSDN博客
镜像源替换
安装过程主要麻烦是gc++编译时交换内存不够等等
我放到迅雷了:
分享文件:虚拟机
链接:https://pan.xunlei.com/s/VNx15paUrUEgGxsrjtxi9_iHA1#
提取码:h7n9
vmware 12 + ns3镜像
下载好后:安装好vmware
解压zip文件
点击文件导入Ubuntu_18_64位_NS3镜像.ovf
第一次他会报错,点重试即可
使用流程:
1.打开桌面上的
/home/passlink/桌面/ns-allinone-3.34/ns-3.34 文件夹
2.把写好的test.cc文件放到/home/passlink/桌面/ns-allinone-3.34/ns-3.34/scratch 文件夹
3.在此处打开cmd
4.编译命令 sudo ./waf build
5.运行 ./waf --run ./scratch/test.cc
examples里有很多示例:
下面是一个运行示例,包含图形化
passlink@passlink-virtual-machine:~/桌面/ns-allinone-3.34/ns-3.34$ ./waf build
Waf: Entering directory `/home/passlink/桌面/ns-allinone-3.34/ns-3.34/build'
[2916/3012] Compiling examples/tutorial/first.cc
[2972/3012] Linking build/examples/tutorial/ns3.34-first-debug
Waf: Leaving directory `/home/passlink/桌面/ns-allinone-3.34/ns-3.34/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (4.475s)
Modules built:
antenna aodv applications
bridge buildings config-store
core csma csma-layout
dsdv dsr energy
fd-net-device flow-monitor internet
internet-apps lr-wpan lte
mesh mobility netanim
network nix-vector-routing olsr
point-to-point point-to-point-layout propagation
sixlowpan spectrum stats
tap-bridge test (no Python) topology-read
traffic-control uan virtual-net-device
visualizer wave wifi
wimax
Modules not built (see ns-3 tutorial for explanation):
brite click dpdk-net-device
mpi openflow
passlink@passlink-virtual-machine:~/桌面/ns-allinone-3.34/ns-3.34$ ./waf --run examples/tutorial/first.cc
Waf: Entering directory `/home/passlink/桌面/ns-allinone-3.34/ns-3.34/build'
Waf: Leaving directory `/home/passlink/桌面/ns-allinone-3.34/ns-3.34/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (1.370s)
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
passlink@passlink-virtual-machine:~/桌面/ns-allinone-3.34/ns-3.34$ ./waf --run examples/tutorial/first.cc --vis
Waf: Entering directory `/home/passlink/桌面/ns-allinone-3.34/ns-3.34/build'
[2942/3012] Compiling examples/tutorial/first.cc
[2972/3012] Linking build/examples/tutorial/ns3.34-first-debug
Waf: Leaving directory `/home/passlink/桌面/ns-allinone-3.34/ns-3.34/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (4.584s)
Could not load plugin 'show_last_packets.py': No module named 'kiwi'
Could not load icon applets-screenshooter due to missing gnomedesktop Python module
scanning topology: 2 nodes...
scanning topology: calling graphviz layout
scanning topology: all done.
passlink@passlink-virtual-machine:~/桌面/ns-allinone-3.34/ns-3.34$