NS2是研究所時候玩的一個Network Simulator,今天忽然心血來潮的回味一下,下載網址。
我下載了ns-allinone-2.35-RC4,解開後執行裡面的install即可。安裝過程中,我只有遇到can't find X includes:
checking for X11 header files can't find X includes otcl-1.14 configuration failed! Exiting ... Please check http://www.isi.edu/nsnam/ns/ns-problems.html for common problems and bug fixes. 透過安裝libsx-dev即可解決 sudo apt-get install libsx-dev
安裝成功後應該會出現一些重要的訊息,包含將執行目錄加到您的PATH中:
Please put ns-allinone-2.35/bin:ns-allinone-2.35/tcl8.5.8/unix:ns-allinone-2.35/tk8.5.8/unix into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph. IMPORTANT NOTICES: (1) You MUST put ns-allinone-2.35/otcl-1.14, ns-allinone-2.35/lib, into your LD_LIBRARY_PATH environment variable. If it complains about X libraries, add path to your X libraries into LD_LIBRARY_PATH. If you are using csh, you can set it like: setenv LD_LIBRARY_PATH <paths> If you are using sh, you can set it like: export LD_LIBRARY_PATH=<paths> (2) You MUST put ns-allinone-2.35/tcl8.5.8/library into your TCL_LIBRARY environmental variable. Otherwise ns/nam will complain during startup. After these steps, you can now run the ns validation suite with cd ns-2.35; ./validate For trouble shooting, please first read ns problems page http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive for related posts.
接下來就是執行一下ns2內建的一些tcl檔:
brook@ubuntu:~/src/ns2$ PATH=/home/brook/src/ns2/ns-allinone-2.35/bin:/home/brook/src/ns2/ns-allinone-2.35/tcl8.5.8/unix:/home/brook/src/ns2/ns-allinone-2.35/tk8.5.8/unix:$PATH brook@ubuntu:~/src/ns2$ ns ns-allinone-2.35/ns-2.35/tcl/ex/simple.tcl 210 0.0037499999999999999 running nam...