debian etch에 ns2 설치

http://www.isi.edu/nsnam/ns/ns-build.html 참조. 하나씩 깔때. (all-in-one을 쓰면 그냥 주욱 되지만 데비안 패키지로 깔 수 있는 건 깔고 싶어서..)

물론 g++ make 같은 기본 빌드 패키지는 깔려있어야 합니다.

  • tcl 설치

$ sudo apt-get install tcl8.4-dev tk8.4-dev

  • otcl 설치

$ wget http://nchc.dl.sourceforge.net/sourceforge/otcl-tclcl/otcl-src-1.13.tar.gz
$ tar zxvf otcl-src-1.13.tar.gz
$ ./configure
$ make
$ sudo make install
$ install -c libotcl.so /usr/local/lib/

~/.bash_profile에
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
추가

  • tclcl 설치

$ wget http://nchc.dl.sourceforge.net/sourceforge/otcl-tclcl/tclcl-src-1.19.tar.gz

$ tar zxvf tclcl-src-1.19.tar.gz
$ cd tclcl-1.19/
$ ./configure
$ make
$ sudo make install

  • NS2 설치

$ wget http://nchc.dl.sourceforge.net/sourceforge/nsnam/ns-2.33.tar.gz
$ tar zxf ns-2.33.tar.gz
$ ./configure
$ make
$ sudo make install

make 오래걸립니다. make -j 로하면 멀티 프로세스로 컴파일하는데 대신 중간에 에러날 때도 있음. 에러나면 다시 실행하면 되긴 되니 전 그렇게 했습니다.

  • nam 설치

$ wget http://nchc.dl.sourceforge.net/sourceforge/nsnam/nam-src-1.13.tar.gz
$ tar zxvf nam-src-1.13.tar.gz
$ cd nam-1.1.3
$ ./configure
$ make
$ sudo make install

 

간단한 테스트

http://csl.changwon.ac.kr/ref_doc/ns2/etri/ 의 예제를 실행해봤습니다.

새로 로긴하여서

$ ns

%

프롬프트상에서 다음과 같이 입력.

set ns [new Simulator]

set n0 [$ns node]

set n1 [$ns node]

$ns namtrace-all [open ex.nam w]

$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail

set tcp [$ns create-connection TCP $n0 TCPSink $n1 0]

set ftp [new Application/FTP]

$ftp attach-agent $tcp

$ns at 0.2 “$ftp start”

$ns at 1.2 “exit”

$ns run

금발 실행이 끝나고 현재 디렉토리에 ex.nam 이란 파일이 생겨있습니다.

이제 nam으로 애니메이션을 봅니다.

$ nam ex.nam

플레이버튼을 누르면 실행됩니다. 0.2초 지점부터 ftp 전송이 되는 걸 볼 수 있음.

image

Tags: ,

2 Responses to “debian etch에 ns2 설치”

  1. umang말하길

    Dear Sir,
    I was getting error to install ns-allinone-2.1b9a of tclcl1.0b12.So i have installed tclcl-src-1.19.tar.gz.
    following command was working successfully
    tar zxvf tclcl-src-1.19.tar.gz
    $ cd tclcl-1.19/
    $ ./configure
    But
    Following commands are not working:

    $ make
    $ sudo make install
    Error
    [root@umang tclcl-1.19]# make
    make: *** No targets specified and no makefile found. Stop.
    [root@umang tclcl-1.19]# sudo make install
    make: *** No rule to make target `install’. Stop.
    please let me know.
    regards,
    Umang

  2. Daniel말하길

    I think you should consult with README and the messages of ./configure
    the message “make: *** No targets specified and no makefile found. Stop.”
    –> means ./configure failed obviously. :-)

    I don’t remember what tclcl-1.19 requires.
    But I think there should be missing packages you need to build it. :-)

Leave a Reply