There are times when we may encounter a problem with installing the two NS version at the same time, such as I study wimax/802.16, because the protocol is too complex to use the WiMAX patch of Chang Gung University and NIST. Chang Gung University's WiMAX patch was developed under ns2 , NIST's WiMAX patch can be used on multiple NS versions, but porting on ns2.31 is the simplest. So if you can use two versions at the same time of course the best, in fact, this can be achieved.
We use the./install after installation, no environment variables are set on the terminal that cannot use the NS command unless you are under the ns-2~/folder. Oh, actually this has told us a solution to the two version of the same scenario, that is, do not set the environment variables, when we need to execute the simulation code A.TCL, specify the path of the NS command:/home/ns-allinone-2.29/ns-2.29/ns A.TCL or/ Home/all-inone-2.31/ns-2.31/ns A.TCL (my ns is installed in the home folder).
If you set one of the environment variables on the. BASHRC, such as ns2.31, your terminal will be able to use the ns2.31 version of the NS command, and the other one will still have to specify the path name to use.
Is there any other better way? Some! In fact, after the installation of our NS2 is not installed in the Linux system, the NS command is implemented through the link ns-allinone-2.~/ns-2~/ns. This is good to do, because it is afraid that in the two NS version has set the environment variables, we can only recognize one of the terminal-typed NS command. Knowing the story, we can change the name of the command NS by re-creating the link, for example we could change the 2.29 ns command to ns2.29 and change the 2.31 ns command to ns2.31 so that the name conflict can be avoided.
The specific implementation is: If we first install ns2.29, directory is/home/ns-allinone-2.29/, under Linux installed ns2.29 and set the environment variables, open the Ns-allinone-2.29/bin directory, with the file NS View link relationship, get the NS link under the Bin folder is linked to:/home/ns-allinone-2.29/ns-2.29/ns, you can delete this link: RM NS, rebuild a connection: Ln-s/home/ Ns-allinone-2.29/ns-2.29/ns ns2.29, so ns2.29 version of the simulation command becomes the ns2.29, you in the terminal into the NS to see if it is an unknown command? Then hit a ns2.29 to see, there is a% number out of it! Use this method to reconstruct the link between Nam and xgraph and change them to nam2.29 and xgraph2.29. Then install ns2.31, environment variables can be set up at the same time, after you hit the terminal in the NS command is actually executed 2.31,nam and Xgraph is also 2.31, for the convenience of memory, you can also imitate the above way to the NS, NAM, xgraph the connection to change to ns2.31, nam2.31, xgraph2.31. Then, to execute the script, you want to use the ns2.29 version of NS: Ns2.29 A.TCL.
Note1: Other distributions I haven't tried, but it should be possible to install multiple NS versions using the above method.
Note2: Add a note that when setting environment variables for two versions of NS2, only one Ld_library_path setting can take effect, usually one of the first settings, However, there may be 2.29 and 2.31 library files do not have a lot of changes, one of the library another can be called normally, in my use of the process did not find the problem.
"NS2" Ubuntu installation and simultaneous use of different versions of NS2 (reprinted)