Vous êtes sur la page 1sur 56

Network Simulator 2

Install

Chao-Ying Chiu
1

Outline

Install Cygwin
Install NS2
Test NS2 Example

Install Environment

Linux

NS2

Windows

Cygwin+NS2
VMWare+NS2

Download Files before Install

Cygwin

/cg/

/ftp%3a%2f%2fcygwin.csie.ntu.edu.tw%2fpub
%2fcygwin/

Files before Install (con.)

Cygwin

http://cygwin.com/

Files before Install (con.)

NS2

http://www.isi.edu/nsnam/dist/ns-allinone-2.27.
tar.gz
55MB

Install Cygwin

Download

Execute setup.exe (20~30 minutes)

Install Cygwin (con.)

Install From Internet

Download From Internet

10

Install From Local Directory

11

Install From Local Directory


(con.)

12

Install From Local Directory


(con.)

13

Install From Local Directory


(con.)

14

Install From Local Directory


(con.)

15

Install From Local Directory


(con.)

16

Install From Local Directory


(con.)

17

Install From Local Directory


(con.)

18

Cygwin

Execute

19

Cygwin (con.)

20

Cygwin (con.)

Type startx

21

22

Install NS2

Download

http://www.isi.edu/nsnam/dist/ns-allinone-2.27.
tar.gz
55MB

23

Install NS2 (con.)

ns2 cygwin/home/

24

Install NS2 (con.)

Type gzip -d -c ns-allinone-2.27.tar.gz | tar


xvf - ( )

25

Install NS2 (con.)

26

Install NS2 (con.)

Type cd ns-allinone-2.27

27

Install NS2 (con.)

Type ./install

28

Install NS2 (con.)

NS2

29

Install NS2 (con.)

30

Install NS2 (con.)

31

Install NS2 (con.)

32

Install NS2 (con.)

33

Install NS2 (con.)

Update your environment variables:

export NS_HOME=`pwd`
export PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/bin:$PATH
export LD_LIBRARY_PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:\
$NS_HOME/otcl-1.8:$NS_HOME/lib:$LD_LIBRARY_PATH
export TCL_LIBRARY=$NS_HOME/tcl8.4.5/library

34

Install NS2 (con.)

To avoid retyping these commands everytime you login you can do the
following, after having updated your environment variables as described
above:

Type pwd at the command prompt


Note what the shell returns: a directory of the form /home/XXX/nsallinone-2.27/ (where XXX is your login name)

Update your ~/.bashrc file by adding the following commands to it:

export NS_HOME=/home/XXX/ns-allinone-2.27/

export PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/bin:$PATH
export LD_LIBRARY_PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:\
$NS_HOME/otcl-1.8:$NS_HOME/lib:$LD_LIBRARY_PATH

export TCL_LIBRARY=$NS_HOME/tcl8.4.5/library

35

Install NS2 (con.)

where you replace /home/XXX/ns-allinone2.27/ by whatever pwd returned. Make sure


you respect the line breaks as shown above.

36

Install NS2 (con.)

37

Install NS2 (con.)

38

Install NS2 (con.)

Type cd ns-2.27

39

Install NS2 (con.)

Type ./validate ( 70~80 )

40

Install NS2 (con.)

41

Install NS2 (con.)

42

Install NS2 (con.)

43

Install NS2 (con.)

44

Install NS2 (con.)

NS2

45

Test NS2 Example (con.)

NS2

C:\cygwin\home\ \ns-allinone-2.27\ns2.27\tcl\ex

46

47

Test NS2 Example (con.)

Type cd tcl/ex

48

Test NS2 Example (con.)

Type startx

49

50

Test NS2 Example (con.)

simple.tcl

Type ns simple.tcl

51

52

53

54

55

Reference

http://www.sims.berkeley.edu/~christin/nscygwin.shtml

56