The latest version is ns--2.33 ... usually builds with gcc 4.x.x
on any new system.
Here is the an example on Ubuntu 8.04
"ns-allinone-2.33.tar.gz" has few dependencies, e.g.
Ubuntu 7.10 will need: 'libx11-dev' and 'libxmu-dev'
Ubuntu 8.04 : the same + 'libxmu-headers' and 'libxt-dev'
( I have not yet tested ns2 on Debian, but "latest" would
probably be like Ubuntu 8.04 )
Good Luck !