ns2 2.27 ubuntu

분류없음 2008.08.23 01:15

Step 0: Prepare neccesary files for installation

  1. NS-2.27 package: ns-allinone-2.27.tar.gz
  2. Patch for compiling NS-2.27 with GCC 4.1.x: ns-2.27-gcc410.patch
  3. MIT’s LEACH extension: mit.tar.gz
  4. LEACH’s Makefile patch: leach_makefile-2.27.patch

Step 1: Download NS-2.27, apply ns-2.27-gcc410.patch, and install it
Under your home directory (~):

  1. wget http://www.isi.edu/nsnam/dist/ns-allinone-2.27.tar.gz
    wget http://www.internetworkflow.com/downloads/ns2leach/ns-allinone-2.27.tar.gz
  2. tar zxvf ns-allinone-2.27.tar.gz
  3. wget http://www.tekno.chalmers.se/~yusheng/reports/ns-2.27-gcc410.patch
  4. patch -p0 < ns-2.27-gcc410.patch
  5. cd ns-allinone-2.27/
  6. ./install

Step 2: Set the environment variables to make NS-2.27 works

  1. cd ~
  2. gedit .bashrc
    # PATH
  3. source .bashrc

Step 3: Download, copy, and extract MIT’s LEACH extension

  1. wget http://www.internetworkflow.com/downloads/ns2leach/mit.tar.gz
  2. cp mit.tar.gz ~/ns-allinone-2.27/ns-2.27/
  3. cd ~/ns-allinone-2.27/ns-2.27/
  4. tar xzvf mit.tar.gz
  5. rm mit.tar.gz

Step 4: Modify NS-2 source code

  1. gedit ~/ns-allinone-2.27/ns-2.27/mac/wireless-phy.cc
    Goto line 59, that is after line 58:
    #define max(a,b) (((a)<(b))?(b):(a))
    #define min(a,b) (((a)>(b))?(b):(a))

Step 5: Add enviroment variables for LEACH extension

  1. gedit ~/.bashrc
    Goto line 59, that is after line 58:
    export RCA_LIBRARY=$NS/mit/rca
    export uAMPS_LIBRARY=$NS/mit/uAMPS
  2. source ~/.bashrc

Step 6: Download and apply patch for Makefile.vc, edit Makefile and re-compile NS-2.27 with LEACH extension

  1. wget http://voyager.ce.fit.ac.jp/wiki/tool/leach_makefile-2.27.patch
  2. patch -p0 < leach_makefile-2.27.patch
  3. gedit Makefile
    • Add -DMIT_uAMPS to the DEFINE list
    • Add -I./mit/rca -I./mit/uAMPS to the INCLUDE list
    • Add the following just prior to the line gaf/gaf.o \
      mit/rca/energy.o mit/rca/rcagent.o \
      mit/rca/rca-ll.o mit/rca/resource.o \
      mac/mac-sensor-timers.o mac/mac-sensor.o mit/uAMPS/bsagent.o \
    • make clean
    • make

Step 7: Test and debug

  1. Modify file test:
    Move line:
    cd ../../
    above line:
    ./leach_test./test You may find the follwing warnings in leach.out: Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
    Use dst_addr_ and dst_port_ instead

    Use this Linux command to search dst_ and replace with dst_addr_ (Note: dst_port_ is 0 by default and we don’t need to search it) :
  2. cd ~/ns-allinone-2.27/ns-2.27/mit/uAMPS/
    perl -pi -w -e ’s/dst_/dst_addr_/g;’ *.tcl
  3. cd ~/ns-allinone-2.27/ns-2.27/mit/uAMPS/sims
    perl -pi -w -e ’s/dst_/dst_addr_/g;’ *.tcl

//RTP 관련 소스 붙여넣기 하고 파일 오픈- 스페이스바- 저장 > make clean > make
Posted by remos

티스토리 툴바