¡@
¦bwin9x / 2000/ xp Àô¹Ò¤U¦w¸ËNS2¼ÒÀÀ³nÅé
(a) ¦w¸Ëcygwin
³s¨ì http¡G//www.cygwin.com¡AÂI¿ï Install or Update now (using setup.exe)¡C
°õ¦æsetup.exe¡C
«ö¤U¤@¨B¡C
¿ï¾ÜInstall from Internet¡A¨Ã«ö¤U¤@¨B¡C
¦bRoot Directory¤¤¡A¥i¥H¿ï¾Ü¦w¸Ëªº¥Ø¿ý¡A«Øij¨Ï¥Î¤º©wªº¸ô®| c¡G\cygwin¡C¨ä¥¦¥t¥~¨âӿﶵ¤]¨Ï¥Î¤º©wȧY¥i¡C«ö¤U¤@¨B¡C
Local Package Directory¡A¥Î¨Ó³]©w¤U¸ücygwin©ÒnÀɮתº¥Ø¿ý¡C
¨Ï¥ÎªÌ¥i¥H¦Û¦æ§ó§ï¸ô®|©ÎªÌ¨Ï¥Î»P¦w¸Ëµ{¦¡setup¬Û¦Pªº¸ô®|(¤º©wÈ)¡C
«ö¤U¤@¨B¡C
¿ï¾Üºô»Úºô¸ô³s½uªº¤è¦¡¡C²Ä¤@ºØ¬Oª½±µ³s½u¡A²Ä¤GºØ¬O¨Ï¥ÎIE5ªº³]©w¡A²Ä¤TºØ¬O¨Ï¥ÎHTTP/FTP Proxyªº¤è¦¡¡C
Y¨Ï¥ÎªÌ¬O¾Ç®Õªº¾Ç¥Í¡A«Øij±Ä¥Î²Ä¤TºØ¤è¦¡¡A¥i¥H¼W§Ö¤U¸üªº³t«×¡C
¥Hì§@ªÌ¦b¦¨¥\¤j¾Ç¤U¸üµ{¦¡¡A³]©w¦p¤U¡C
«ö¤U¤@¨B¡C
¿ï¾Ü¤U¸üªº¦aÂI¡A¦b³o¸Ì§ÚÌ¿ï¾Ü±q¥æ³q¤j¾ÇªºFTP¯¸¤U¸ü¡C«ö¤U¤@¨B¡C
¿ï¾Ün¦w¸Ëªº³nÅé®M¥ó¡C¦b³oÃä¥i¥H¥ýÂI¿ïView¡A¨Ï±o®ÇÃ䪺CategoryÅܦ¨Full¡A³o¼Ë´N¥i¥H¹ï©ó²Ó³¡ªº¿ï¶µ°µ¿ï¾Ü¡C
n¿ï¾Üªº¦³XFree86-base¡B XFree86-bin¡BXFree86-prog¡BXFree86-lib¡BXFree86-etc¡Bmake¡Bpatch¡Bperl¡Bgcc¡Bgcc-g++¡Bgawk¡Bgnuplot¡Btar©Mgzip¡C
¥H¤U¹Ï¬°¨Ò¡AÂI¿ïXFree86-base¡A¥i¥H¨Ï±oª¬ºA±qnew§ïÅܦ¨4.3.0-11¡C
«ö¤U¤@¨B¡C
¶}©l¤U¸ü¨Ã¦w¸Ë¡C
§¹¦¨«á¡A·|¸ß°Ý¨Ï¥ÎªÌ¬O§_·Qn²£¥Í¤p¹Ï¥Ü©ó®à±©M¶}©l¿ï³æ¡C«ö§¹¦¨¥Hµ²§ô¦w¸Ëµ{¦¡¡CY¬OÁÙ¦³»Ýn¦w¸Ë¨ä¥¦ªº³nÅé®M¥ó»Ýn¦w¸Ë¡A¥i¥H«·s°õ¦æsetup¦w¸Ë§Y¥i¡C
(b) ¦w¸Ëns2
ÂI¿ï®à±¤Wªº¤p¹Ï¥Ü¡C
²Ä¤@¦¸°õ¦æªº®ÉÔ¡A·|®Ú¾Ú¥Ø«e¹q¸£ªº¨Ï¥ÎªÌ©M¹q¸£ªº¦WºÙµ¥¸ê°T¡A¦b cygwinªºhomeªº¥Ø¿ý¤U²£¤@ӨϥΪ̪º¸ê®Æ§¨¡A¨Ã©ñ¤JÀô¹ÒÅܼƳ]©wµ¥¬ÛÃöÀÉ®×(.bashrc¡B.bashrc_profile©M.inputrc)¡C¥H§Ú¬°¨Ò¡A§Ú¦b xp§@·~¨t²Î¤Uªº¨Ï¥ÎªÌ¦WºÙ¬°Leo¡A¦Ó¨Ï¥Î¹q¸£¦WºÙ¬°IBM-X31¡A«hcygwin·|¬°Leo¦bhomeªº¥Ø¿ý¤U«Ø¥ß¤@Ó®a¥Ø¿ý(/home/Leo)¡A¨ä¹ïÀ³©óC¼Ñªº¸ô®|¬°c¡G\cygwin\home\Leo¡F
¦Ó¿é¤J´£¥Ü²Å¸¹«h¬°Leo@ IBM-X31~ $¡C
±µ¤U¨Ó¨ìhttp¡G//www.isi.edu/nsnam/dist/ns-allinone-2.27.tar.gz¡A¤U¸üNS2µ{¦¡½X¡A¨Ã¦s©ñ¨ì¦Û¤vªº®a¥Ø¿ý¤º¡C
©Ò¤U¸üªºAllinone package¥]¬A¥H¤U®M¥ó¡G
„h TCL release 8.4.5 (required component)
„h TK release 8.4.5 (required component)
„h Otcl release 1.8 (required component)
„h TclCL release 1.15 (required component)
„h Ns release 2.27 (required component)
„h Nam release 1.10 (optional component)
„h Xgraph version 12.1 (optional component)
„h CWeb (optional component)
„h SGB (optional component)
„h Gt-itm (optional component)
„h Zlib version 1.1.4 (optional¡A but required when Nam is used)
¨Ï¥Îtar xvfz ns-allinone-2.27.tar.gz¸Ñ¶}©Ò¤U¸üªºÀ£ÁYÀÉ¡C
¶i¤Jns-allinone-2.27ªº¥Ø¿ý(¿é¤Jcd ns-allinone-2.27)¡A
¨Ã¶}©l¦w¸Ëns2(¿é¤J ./install)¡C
¦b¦w¸Ëªº¹Lµ{¤¤¡A¥Ñ©ó§Ų́S¦³¦w¸Ëdiff¡A©Ò¥H¦w¸Ëµ{¦¡·|°Ý¨Ï¥ÎªÌn¤£nÄ~Äò¡A¿ï¾ÜyÄ~Äò¦w¸Ë¡C
¦b¦w¸Ëªº¹Lµ{¤¤¡A»Ýnªá¤@¨Ç®É¶¡¡A©Ò¥H½Ð¨Ï¥ÎªÌ@¤ßªºµ¥«Ý¦w¸Ë§¹¦¨¡C
§¹¦¨¹Ï¡C
§¹¦¨ns2ªº½sĶ«á¡An¶}©l³]©wÀô¹ÒÅܼơC
½Ð½s¿è®a¥Ø¿ý¤Uªº.bashrc¡A§âns2¬ÛÃöªº¸ô®|¥[¤JPATH¤¤¡C
(¨Ï¥ÎUltraEdit)
export NS_HOME=`pwd`/ns-allinone-2.27
export PATH=$NS_HOME/tcl8.4.5/unix¡G$NS_HOME/tk8.4.5/unix¡G$NS_HOME/bin¡G$PATH
export LD_LIBRARY_PATH=$NS_HOME/tcl8.4.5/unix¡G$NS_HOME/tk8.4.5/unix¡G$NS_HOME/otcl-1.8¡G$NS_HOME/lib¡G$LD_LIBRARY_PATH
export TCL_LIBRARY=$NS_HOME/tcl8.4.5/library
[example] ÀËÅçns©Mnam¡C
¦b©R¥O¦C¤¤¿é¤Jstartxwin.bat¡A·|²£¥Í¤@Ó·sªºµøµ¡¡C¦b²£¥Í·sªºµøµ¡¿é¤J
cd ns-allinone-2.27/ns-2.27/ns-tutorial/examples
ns example2.tcl
¼ÒÀÀµ²§ô«á¡Ans·|¥h°õ¦ænam¡C
«ö¤@¤Unamªº°õ¦æ¡C´N¥i¥H¬Ý¨ì¼ÒÀÀ¹Lµ{ªºµøı¤Æ¡C