Skip to main content

Posts

Showing posts from August, 2011

Installing ns-3.37 and ns-3.35 in Ubuntu | Ubuntu 22.04 | NS3

Multiple Versions of ns3 in Ubuntu 22.04 In this post, we are going to install two versions of ns3 namely ns-3.35 and ns-3.37  My OS is : Ubuntu 22.04 LTS (Long Term Support) ns-3.35 uses waf and (./waf --run scratch/first)  ns-3.37 uses cmake  (./ns3 run scratch/first.cc) So we will install both the packages  Go through the video for complete instructions To start with  $ sudo apt update  $ sudo apt install build-essential autoconf automake libxmu-dev 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  I have downloaded both the versions of ns3 fr

C Interview Questions–to be solved

These programs were asked in various colleges/universities across India. These Questions were in my email dated 1999. So please let me know if any copyright information, so that I will remove it. But these questions are very much helpful for budding Student (engineers and interviewees). //  Carefully study the given program #include <stdio.h> #include <alloc.h> void main(void); typedef struct NType {     int i;     char c;     long x; }NewType; void main(void) {     NewType *c;     c=(NewType*)malloc(sizeof(NewType));     c->i=100;     c->c='C';     (*c).x=100l;     printf("%d,%c,%4ld",c->i,c->c,c->x); } /* What is the output of this program ? a)  It will produce a variable redefinition error b)  It will print some junk c)  It will print 100,C,100 d)  It will print 100,C,l100 */ // Carefully go through the following prog

C programs–For practice (to be solved)

#include <stdio.h> #define A     2 #define B     3 #define C     A - B #define D    4 - C main() {     int x = D;         printf("x = %d\n", x); } ------------------- #include <stdio.h> main() {     int i =3;     printf("%d\n", i++);     printf("%d\n", i++); } --------------- #include <stdio.h> #define A      RAM #define RAM     ram main() {     char *ram = "hello ram!";     printf("%s\n", A); } ------------- #include <stdio.h> main() {     int i = 5, sum = 0;         do {         sum += 1/i;        } while(0 < i--);     printf("%d\n", sum); } ------------- #include <stdio.h> #define max(a,b)    ((a) > (b) ? a : b) main() {     int i=5, j=5;     printf(" max = %d\n", max(++i, j++));     printf("i = %d, j = %d\n", i, j);

Fedora 12 Installation

This post will show you the installation of Fedora along with Windows 7. This Post is mainly for Beginners of Linux those who entered the college just now who don’t have prior working knowledge on Linux Here we go…. I have taken DVD Version of Fedora 12 (32 Bit OS) Step 1: Create a Partition on windows to give space for Fedora, Just 20GB space is enough.. You can store all your files under windows and use it in linux whenever you need. So no extra space needed for Linux. (see the image below) Step 2:  Insert the DVD and boot from the DVD and select the first option (as shown below) “ Install or Upgrade an existing System” Once selected, the system asks you to check the correctness of the media (DVD ROM). if you have doubt with your DVD, please click OK else SKIP it. (see below) Once done, start proceeding with the installation as given in the following images Step 4: Select the language (as given below, If you have doubt, leave with the default and click next) Step 5: Selec

Linux for NS2 (Network Simulator 2)

At many places, I happen to see researchers and students wanted to use Windows for NS2 rather than Linux. The reason may be, Linux is tough It occupies more space and more memory in my Computer Linux uses lot of commands and i am not aware of it Tough to handle dual boot OS (windows and Linux) always wanted to be in the cakewalk. (never try a new thing) etc But here are some basic tips for using NS2 under a Linux Machine. It is enough to know some basic Linux commands to work with NS2 (hardly not more than 20 commands) One should have a basic knowledge of how tree structure in Linux/Unix look like Finally, where to set the PATH information in Linux With all the above three, one can confidentally work on Linux. As for as windows is concerned, upto NS2.27 version is tested under windows and recent versions there is no hope (however it will work fine, but "Use at your Own Risk") Please see this post to install Fedora 12 in your Computer Now we will see some

Tracegraph installation in Windows 7

How to install tracegraph in windows . here are the steps Download it from here Step 1: Unzip the tracegraph202.tar file to C: or D:  (in my case I extracted to D:/tracegraph202) Step 2: copy the path (DLL files) to the environmental variables (in my case the path is D:\tracegraph202\bin\win32 ) Step 3: that’s it run the trgraph.exe file which is available under the tracegraph202/ folder.

NS2.34 installation in Ubuntu 11.04

Already this blog posts various titles on installing NS2 in Linux distros. Here is the step for installing in Ubuntu 11.04. 1. Version taken is NS2.34 2. Since ubuntu 11.04 uses GCC-4.5.2, there should be some minor tweeks. 3. Two files should be edited ~ns-2.34/tools/ranvar.cc and ~ns-2.34/mobile/nakagami.cc  as given in the following post http://pradeepkumar.org/2011/06/installing-ns-2-34-in-fedora-14.html 4. Install the following things in Ubuntu sudo apt-get install build-essential autoconf automake libxmu-dev sudo apt-get install gcc-4.4 5. open the file ~ns-2.34/otcl-1.13/configure and change the line number 6304 to SHLIB_LD="gcc -shared" instead of SHLIB_LD="ld -shared" 6. open the file ~ns-2.34/otcl-1.13/Makefile.in and change the line CC    @CC@ to CC    gcc-4.4 7. Set the path in /home/<name>/ .bashrc as in http://pradeepkumar.org/2009/11/installing-ns2-under-ubuntu-910.html 8. After setting the path, sometimes overflow error

Installing Omnet++ in Windows 7

Installing Omnet++ in windows is a very easy task Step 1: Click the following link and download Omnet++ along with MinGW (Minimalist GNU for Windows – this gives the look and feel of Linux inside windows, it is similar like cygwin) http://www.omnetpp.org/omnetpp/doc_download/2218-omnet-41-win32-source–ide–mingw-zip Step 2: Unzip the file to C:/ (Now your folder looks like this C:\omnetpp-4.1) Step 3: Open Command prompt and go to C:\omnetpp-4.1 (The command is cd \ and cd omnetpp-4.1) Now type the command mingwenv.cmd and press enter (Please type the commands as given in the following pic) Step 4 : A new window will be opening which looks like a Linux Shell (as shown in the following pic) Step 5 : Type the command configure (this command will check all the modules and set the path) Type the command make (This will run for at least 10 minutes, but may vary machine to machine) Once everything is done, you will get a successful message and type omnetpp t

Manual tracing–tracefile

Assume you created a tcl file for a wireless simulation and it generates a trace file (usually .tr as extension). If any tracing softwares are not available, how to interpret manually, here is the step ACTION: [s|r|D]: s -- sent, r -- received, D – dropped WHEN: the time when the action happened WHERE: the node where the action happened LAYER: AGT -- application, RTR -- routing, LL -- link layer (ARP is done here) IFQ -- outgoing packet queue (between link and mac layer) MAC -- mac, PHY – physical flags: SEQNO: the sequence number of the packet TYPE: the packet type cbr -- CBR data stream packet DSR -- DSR routing packet (control packet generated by routing) RTS -- RTS packet generated by MAC 802.11 ARP -- link layer ARP packet SIZE: the size of packet at current layer, when packet goes down, size increases, goes up size decreases[a b c d]: a -- the packet duration in mac layer header b -- the mac address of destination c -- the mac address of source d -- the mac t

xgraph Error (dialog.c)

If you are installing ns2 allinone package in fedora or ubuntu or any other linux, all the packages will be installed successfully. Occasionally the recent distributions of Linux flavors failed to install xgraph. Problem: The possible error you may get is [dialog.o] error, Solution: Open the file dialog.c which is available under the folder xgraph-12.1/ (this is in my case) Find out the function getline() (will be at two places), usually line number 780 and 891 or 889, replace getline() function to newgetline() (at the both the places) save the file and at the prompt give ./configure give the command make If there are no errors, xgraph will work now..

Installing Omnet++ in Ubuntu 9.04

Unzip the omnetpp-xxx.zip file in to any folder possibly (/home/pradeepkumar/) Open the shell prompt and then go to the corresponding folder by issuing the command cd /home/pradeepkumar/omnetpp-4.0 Run the command (./configure) If you get any errors, please download the concerned files and again go to step 3. You may get errors like this and execute the command ( sudo apt-get install bison flex byacc swig build-essential tcl8.5 tk8.5 tcl8.5-dev tk8.5-dev ) after installing all the packages, go to step 3 If path information is being asked, then set the path in the /home/pradeepkumar/.bashrc (export PATH=$PATH:/home/pradeepkumar/omnetpp-4.0/bin) Add the following line to your .profile or .bash_profile (provided you use bash): export TCL_LIBRARY=/usr/share/tcltk/tcl8.5 After that logout and login and then go to step 2 and then 3. Execute make command and thats it!!!! After installing this, for running the IDE, you need to install java run time enviro

Xgraph

Xgraph is an X-Windows application that includes: interactive plotting and graphing animation and deritives portability and bug fixes So to plot the characteristics of NS2 parameters like throughput, end to end delay, packets information, etc can be plotted using xgraph The successful installation of NS2 will install xgraph also along with it. To run xgraph from a shell prompt: # xgraph filename.xg inside TCL scripts, xgraph can be written like this exec xgraph filename.xg -geometry 500×500 if there are more xgraph files then, exec xgraph filename1.xg -geometry 500×500 & exec xgraph filename2.xg -geometry 500×500 & The ambersand is mandatory to popup all the graph windows, if & (ambersand) is not there, then only the last xgraph window will be popped up. Sample xgraph file and its contents /*** The xgraph file shows the information about the overhead with size of the network, Overhead is compared with four routing prot

Recompiling NS2 (Network Simulator 2)

Assumptions: I have installed my ns-allinone-2.34 under /home/pradeep/ns-allinone-2.34 Path is been set in the .bash_profile (which are located at /home/pradeep/ ) in fedora and .bashrc in ubuntu There are two ways in which the NS2 can be recompiled 1. You modify the existing algorithm (use the same header and the C++ source files) 2. Adding new files (adding new header and C++ source files) In first method, Step 1: open the shell prompt and go to the ns-allinone-2.34/ns-2.34/ folder(there are 3 makefiles, Makefile.vc, Makefile, Makefile.in, for adding any new file should be done at the Makefile.in file) Step 2: Once the existing algorithm is changed (after modifying the existing header and the C++ source file), go to step 1 Step 3: execute the command, make (the make command executes the instructions given in the Makefile.in) and press enter, If you have no errors in your modified code, then the compilation will be success, else you may get errors, which needs to b

NS2.34 installation in Fedora 14

To install Network Simulator Version 2.34 in Fedora 14 has the following limitations. 1. Fedora 14 comes with GCC version 3.5 which has major changes like it accept X() rather than X::X(), So ns also has to modify accordingly. 2. You may get an error for GammaRandomVariable , so that has to be corrected in the following two files ~ns-allinone-2.34/ns-2.34/mobile/nakagami.cc  and ~ns-allinone-2.34/ns-2.34/tools/ranvar.cc (Above pic: The file nakagami.cc has to be opened and there will a change in two line numbers 183 and 185 as given below) (The file ranvar.cc has to be opened and change in line number 219 as given below) Once the above steps done, Go to terminal and install NS2 ( http://pradeepkumar.org/2008/11/installation-instructions-for-network.html ) and refer the video for installing NS2. http://pradeepkumar.org/2011/02/installation-of-network-simulator-2-ns2video.html

Installing NS2 in Ubuntu 8.04 8.10 and 9.04

Step 1: Download NS2 from the following Website, I tried version ns-allinone-2.33.tar.gz . Step 2: Put the file under /home/pradeep/ (my user login is pradeep, you may try with your username) Step 3: go the folder in the shell prompt by issuing the following command cd /home/pradeep/ Step 4: Since installation of NS2 simulator needs some autoconfiguration files which will need to be installed. To download those packages, just execute the following commands $ sudo apt-get install build-essential autoconf automake libxmu-dev it will take some time to download and install. Step 5: Now execute the following steps so that NS2 will be installed tar zxvf ns-allinone-2.33.tar.gz  cd ns-allinone-2.33 ./install After the above three steps, NS2 will give the path information which needs to be set in the PATH variable Step 6: Open the file .bashrc which is available under the folder /home/pradeep/ (if you try to install in root user /root/.bashrc). Use the following command to o

Tracegraph installation in Fedora 12

To Install Tracegraph in Fedora Linux (I used Fedora 12) Step download the Tracegraph software from this link You need to download two files, mglinstaller.gz and tracegraph202.tar.gz Copy the files under /home/pradeep/ (in my case it is /home/pradeep/) Untar the tracegraph202.tar.gz using the command tar zxvf tracegraph202.tar.gz A Folder tracegraph202/ will be created and go to the folder using the command cd tracegraph202 or cd /home/pradeep/tracegraph202 copy the mglinstaller.gz file inside the tracegraph202/ folder now execute the command to unzip the mglinstaller.gz using the following command gzip -d mglinstaller.gz Run the mglinstaller by executing the command ./mglinstaller (see the . in the beginning) The above command will create a folder within the bin folder and set the following lines to the LD_LIBRARY_PATH variable export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/pradeep/tracegraph202/bin/glnx86 The above path will be set to the LD_L

Installation of NS2 in Fedora 12

The ns2 version taken here is 2.34, if you downloaded any other version, please modify your version during installation 1)Uncompress the ns2 tar zxvf ns-allinone-2.34.tar.gz or gzip -d ns-allinone-2.34.tar.gz tar xvf ns-allinone-2.34.tar 2) cd /opt/ns-allinone-2.34 (since /opt is the folder which is unused, so i have selected that folder to install, however you can install that in any folder) 3) ./install (execute the command) 4) If the installation fails in the middle, then try to install the linux packages that are necessary to run NS2. (In any linux (ubuntu or fedora or redhat or suse), install the TCL/TK, Perl packages during the installation of linux…) 5) Once the installation succeeded, then the path information will be provided by the NS2 6) Set the path in the /root/.bash_profile (vi /root/.bash_profile) or If you are a user home/pradeep/.bash_profile (for example, if your the username is pradeep, then execute this command vi /home/pradeep/.bash_prof