Bahan
1. ubuntu 22.04
2. ns-3.36.1
Fyi: Sejak ns-3.36.1 perintah ./waf diganti menjadi ./ns3
Alat, bisa mnggunakan pc'laptop atau vmware yg sdh diinstall ubuntu 22.04.
1. PC/Laptop
2. VMware
Langkah instalasi:
1. $ cd ~ : memastikan posisi di home/user sendiri.
2. $sudo apt update : update apt
3. $ sudo apt install g++ python3 python3-dev pkg-config sqlite3 cmake python3-setuptools git qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools 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 gsl-bin libgsl-dev libgslcblas0 wireshark tcpdump sqlite sqlite3 libsqlite3-dev libxml2 libxml2-dev libc6-dev libc6-dev-i386 libclang-dev llvm-dev automake python3-pip libxml2 libxml2-dev libboost-all-dev
Download ns-allinone-3.36.1.tar.bz2
4. $ wget -c https://www.nsnam.org/releases/ns-allinone-3.36.1.tar.bz2
Extract ns-allinone-3.36.1.tar.bz2
5. $ tar jxvf ns-allinone-3.36.1.tar.bz2
$ ./ns3 configure --enable-examples --enable-tests
Then, use ns3 to build ns-3:
$ ./ns3 build
Once complete, you can run the unit tests to check your build:
$ ./test.py
All tests should either PASS or be SKIPped. At this point, you have a working ns-3 simulator. From here, you can start to run programs (look in the examples directory). To run the first tutorial program, whose source code is located at examples/tutorial/first.cc, use ns3 to run it (by doing so, the ns-3 shared libraries are found automatically):
$ ./ns3 run first
+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
To view possible command-line options, specify the –PrintHelp argument:
$ ./ns3 run 'first --PrintHelp'
To continue reading about the conceptual model and architecture of ns-3, the tutorial chapter Conceptual Overview would be the next natural place to skip to, or you can learn more about the project and the various build options by continuing directly with the Introduction and Getting Started chapters.
7. mengintegrasikan python ke ns-3.36.1. The libraries should get built.
$ cd ns-3.36.1/
$./ns3 configure --enable-python-bindings
8. selesai dan sekarang di tes print "Hello Simulator"
$ ./ns3 run hello-simulator
output:
Hello Simulator
9. Tes file simulasi bahasa C yaitu .cc dan file simulasi bahasa pyhton .py copy file first.cc dan first.py di folder /home/user/ns-allinone-3.36.1/ns-3.36.1/example/tutorial ke folder /home/user/ns-allinone-3.36.1/ns-3.36.1/scratch
9.a. cp -r first.cc /home/user/ns-allinone-3.36.1/ns-3.36.1/example/tutorial /home/user/ns-allinone-3.36.1/ns-3.36.1/scratch
9.b. cp -r first.py /home/user/ns-allinone-3.36.1/ns-3.36.1/example/tutorial /home/user/ns-allinone-3.36.1/ns-3.36.1/scratch
10. Tes file .cc
$ ./ns3 run scratch/first
Output:
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
11. Tes file .py
$ ./ns3 run scratch/first.py
Output:
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
jika first.py tidak berhasil, ganti versi cppyy dari 3.0 ke cppyy 2.4.2
$python3 -m pip install --user cppyy==2.4.2
$./ns3 configure --enable-python-bindings
Install NetAnim
NetAnim, otomatis sudah terinstall saat melakukan instalasi langkah ke 1.
namun kalo gak bisa, coba lakukan hal ini.
1. masuk ke folder netanim
2. ketikan CLI
$make clean
$qmake NetAnim.pro
$make
Kemudian masuk ke aplikasi netanim
arie@RV:~/Downloads/ns-allinone-3.36.1/netanim-3.108$ ./NetAnim
Salam,
Arie Budiansyah
Comments
Post a Comment