GnutellaSim package is available for downloading by HTTP:
1. the packages for ns2.1b9 and ns2.1b7a include patches for pdns , but building pdns and the pdns version of GnutellaSim has a slightly different process which is described in the next subsection. If you have already installed pdns, see the following subsection "Manually add GnutellaSim".
The package for ns2.26 does _not_ include patches for pdns , you will have to install the pdns patch for ns2.26 _before_ installing the GnutellaSim package,
2. patches are created on Linux. The program has been built with gcc 2.95.3 and gcc 3.1.1 and tested on Linux 2.4.18.
mv gnutella-ns2.26-v1.0.tgz ~/ns-allinone-2.26/ns-2.26 # move the package to the ns source code directory
tar xvfz gnutella-ns2.26-v1.0.tgz # uncompress the package
chmod +x install.sh
./install.sh # install the patch and rebuild ns2
( Sample pdns scripts adapated from George Riley's pdns sample scripts to run GnutellaSim can be found pdns.tcl , smpboot.pdns.tcl)
The packages listed in the previous section include the source code of pdns, however, pdns is not automatically built by the install.sh script. To build and run GnutellaSim on pdns , you will first need to get libsynk , which is used by pdns. To build pdns and GnutellaSim (after the install.sh script has been run), the following steps need to be followed:
1. add "-DPDNS" to the "DEFINE" clause in the Makefile for the compilation of gnutella/*.o files
2. make gnusimclean
3. make pdns (make sure that $KITHOME in the Makefile points correctly to the libsynk directory before the "make")
To run GnutellaSim on pdns, you will need to have a script that does the following:
1. setup pdns network topology and simulator. A large scale network topology is divided into subnets in pdns, each of which is simulated by a physical machine (process). For more details on the setup of pdns topology, see pdns homepage .
2. create bootstrap servers
Option 1: to use the simple bootstrap server, create a pdns version of SmpBootServer, PDNSBootServer on each physical node. With PDNSBootServer, the change of online/offline status of a local peer is broadcast to PDNSBootServer on other physical nodes, such that the bootstrap servers can provide to its local servents of peers on other physical nodes.
set localbootserver [new SockApp/SmpBootServer/PDNSBootServer $srvaddr ]
Notice that unlike SmpBootServer, a $srvaddr (in converted ip address format) is needed for PDNSBootServer communicate with each other.
To establish inter-bootserver communications:
set newsock [[Simulator instance] create-sock $converted-ip-of-peer $localbootserver -1 1]
$ns at $ctime "$localbootserver add-bootsrv $newsock $peer-ip 6734"
set localbootserver [new PeerApp/GnutellaApp $bootsrvIP 1 1] #use the converted IP address (IP address converted to integer, used in pdns) of a bootstrap server
3. create Gnutella servents
set p_($i) [PeerApp/GnutellaApp $i 0 1] #the parameters to the create procedure of GnutellaApp are: node identifier, whether it is a bootstrap server, whether the identifier is a pdns IP address or an ns2 node ID
$p_($i) use-smpbootserver $localbootserver
$p_($i) use-bootserver "srv.info" # bootstrap server addresses in "srv.info" are IP addresses
4. set up other properties of Gnutella servents as for GnutellaSim in ns2
To add GnutellaSim manually (in case you have changed some ns2 code so that the patch does not apply cleanly), the following steps are to be followed:
1. download the gnutella source code (for ns2.1b7, ns2.1b9 and ns2.26, notice though that the difference among them is only in the tcp-sock.cc file)
2. cd ~/ns-allinone-2.26/ns-2.26
3. tar xvfz gnusrc2.26.tgz
4. change agent.cc, agent.h, tcp.h, tcl/ns-default.tcl and tcl/lib/ns-lib.tcl according to the revised files (for ns2.1b7, ns2.1b9, or ns2.26). For ns2.1b9 and ns2.26, you will also need to change the FullTcpAgent:: foutput() method in tcp-full.h to be virtual. Look for comments start with "Qi" in the code.
5. change Makefile according to the revised one (for ns2.1b7, ns2.1b9, or ns2.26). Look for comments start with "Qi" in the file.
6. make sure that you do NOT use the "-O2" option for gcc compilation (CCOPT in the Makefile)
If you do not have pdns currently and want to install pdns with GnutellaSim, try to apply pdns patch to your ns2 first and then follow the above instructions.
If you have pdns already, make sure that you have the most recent one.
[prev section] [next section] [home ]