(OK) install-ns3——using-testing
install
http://blog.csdn.net/ztguang/article/details/51388366
-----------------------------------------------------------------------------------------------------
https://www.nsnam.org/wiki/Installation
Prerequisites
-----------------------------------------------------------------------------------------------------
yum install gcc gcc-c++ python python-devel mercurial bzr gsl gsl-devel gtk2 gtk2-devel gdb valgrind doxygen graphviz ImageMagick python-sphinx dia texlive texlive-latex
yum install flex bison tcpdump sqlite sqlite-devel libxml2 libxml2-devel uncrustify openmpi openmpi-devel boost-devel goocanvas-devel graphviz graphviz-devel
yum install python-setuptools-devel
yum install easy_install
yum install pygraphviz
yum install python-kiwi pygoocanvas cmake glibc-devel.i686 glibc-devel.x86_64
-----------------------------------------------------------------------------------------------------
download ns-allinone-3.25.tar.bz2
[root@localhost ns-allinone-3.25]# pwd
/opt/tools/network_simulators/ns3/ns-allinone-3.25
[root@localhost ns-allinone-3.25]#
./build.py --enable-examples --enable-tests
cd ns-3.25
./test.py
//to install sphinx-build, then compile to produce document.
easy_install Sphinx
[root@localhost tutorial]# pwd
/opt/tools/network_simulators/ns3/ns-allinone-3.25/ns-3.25/doc/tutorial
[root@localhost tutorial]# make html
-----------------------------------------------------------------------------------------------------
using
-----------------------------------------------------------------------------------------------------
[root@localhost netanim-3.107]# pwd
/opt/tools/network_simulators/ns3/ns-allinone-3.25/netanim-3.107
//左上角File open按钮,选择XML文件,单击播放按钮开始动画。
[root@localhost netanim-3.107]#
./NetAnim
-----------------------------------------------------------------------------------------------------
https://www.nsnam.org/wiki/HOWTO_Use_Linux_Containers_to_set_up_virtual_networks
HOWTO Use Linux Containers to set up virtual networks
-----------------------------------------------------------------------------------------------------
dnf install lxc bridge-utils tunctl
man lxc
man lxc.conf
less /usr/share/doc/lxc/examples/lxc-veth.conf
[root@localhost ns-3.25]# lxc-create -n right -f src/tap-bridge/examples/lxc-right.conf
A template must be specified.
Use "none" if you really want a container without a rootfs.
[root@localhost ns-3.25]#
lxc-create -n left -f src/tap-bridge/examples/lxc-left.conf -t none
lxc-create -n right -f src/tap-bridge/examples/lxc-right.conf -t none
bash: lxc-ls: 未找到命令...
dnf install /usr/bin/lxc-ls
dnf whatprovides /usr/bin/lxc-ls
lxc-ls
lxc-start -n left /bin/bash
lxc-start -n right /bin/bash
lxc-start -n left /bin/bash -F
-----------------------------------------------------------------------------------------------------
[root@localhost ~]# ifconfig
br-left: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet6 fe80::b867:79ff:fe41:64a0 prefixlen 64 scopeid 0x20<link>
ether ba:67:79:41:64:a0 txqueuelen 1000 (Ethernet)
RX packets 1 bytes 76 (76.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3 bytes 258 (258.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
br-right: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 1a:32:41:31:a2:c1 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
inet6 fe80::42:e1ff:fe66:4909 prefixlen 64 scopeid 0x20<link>
ether 02:42:e1:66:49:09 txqueuelen 0 (Ethernet)
RX packets 39537 bytes 2293419 (2.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 44548 bytes 66114210 (63.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp13s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.108.162.164 netmask 255.255.252.0 broadcast 10.108.163.255
inet6 2001:da8:215:828:3e97:eff:fef0:b5bb prefixlen 64 scopeid 0x0<global>
inet6 fe80::3e97:eff:fef0:b5bb prefixlen 64 scopeid 0x20<link>
ether 3c:97:0e:f0:b5:bb txqueuelen 1000 (Ethernet)
RX packets 4355119 bytes 4027064822 (3.7 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2644236 bytes 367587242 (350.5 MiB)
TX errors 0 dropped 47 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 3224 bytes 299084 (292.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3224 bytes 299084 (292.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tap-left: flags=4355<UP,BROADCAST,PROMISC,MULTICAST> mtu 1500
ether ba:67:79:41:64:a0 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tap-right: flags=4355<UP,BROADCAST,PROMISC,MULTICAST> mtu 1500
ether 1a:32:41:31:a2:c1 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:b5:58:ab txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp7s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 9c:d2:1e:a5:e7:f1 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]# brctl show
bridge name bridge id STP enabled interfaces
br-left 8000.ba67794164a0 no tap-left
br-right 8000.1a324131a2c1 no tap-right
docker0 8000.0242e1664909 no
virbr0 8000.525400b558ab yes virbr0-nic
[root@localhost ~]#
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
Building with Waf
------------------------
Up to this point, we have used either the build.py script, or the bake tool, to get started with building ns-3. These tools are useful for building ns-3 and supporting libraries, and they call into the ns-3 directory to call the Waf build tool to do the actual
building. Most users quickly transition to using Waf directly to configure and build ns-3. So, to proceed, please change your working directory to the ns-3 directory that you have initially built.
-----------------------------------------------------------------------------------------------------
[root@localhost ns-3.25]# pwd
/opt/tools/network_simulators/ns3/ns-allinone-3.25/ns-3.25
[root@localhost ns-3.25]#
./waf clean
./waf --build-profile=optimized --enable-examples --enable-tests configure
./waf --help
./test.py -c core
./waf --run hello-simulator
-----------------------------------------------------------------------------------------------------
// ./waf clean
// ./waf configure --enable-examples --enable-tests
// ./waf clean
// ./waf configure --build-profile=optimized --enable-examples --enable-tests
./waf clean
./waf configure --build-profile=debug --enable-examples --enable-tests //use this command
./waf //build the debug versions of the ns-3 programs, will take a long time
------------------------------------------------------
[root@localhost ns-3.25]# pwd
/opt/tools/network_simulators/ns3/ns-allinone-3.25/ns-3.25
[root@localhost ns-3.25]#
cp examples/tutorial/first.cc scratch/myfirst.cc
./waf //Now build your first example script using waf
./waf --run scratch/myfirst
------------------------------------------------------
[root@localhost ns-3.25]# ./waf --run scratch/myfirst
Waf: Entering directory `/opt/tools/network_simulators/ns3/ns-allinone-3.25/ns-3.25/build'
Waf: Leaving directory `/opt/tools/network_simulators/ns3/ns-allinone-3.25/ns-3.25/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (2.072s)
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
[root@localhost ns-3.25]#
------------------------------------------------------
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通