Dummynet for Dummys : Dummynet set up in the lab

 

 

Network Diagram:

           

 

 

IP address setup:

 

At Sender : Change the /etc/sysconfig/network-scripts/ifcfg-eth1

             DEVICE=eth1

            IPADDR=192.168.251.100

            NETMASK=255.255.255.0

            NETWORK=192.168.251.0

            BROADCAST=192.168.251.255

            ONBOOT=yes

            NAME=eth1

 

At Receiver : Change the /etc/sysconfig/network-scripts/ifcfg-eth1

 

            DEVICE=eth1

            IPADDR=192.168.250.100

            NETMASK=255.255.255.0

            NETWORK=192.168.250.0

            BROADCAST=192.168.250.255

            ONBOOT=yes

            NAME=eth1

 

 

Ar Router : Change /etc/rc.conf

 

ifconfig_em0="inet 192.168.251.1 netmask 255.255.255.0 broadcast 192.168.251.255"

            inetd_enable="YES"

            ifconfig_em1="inet 192.168.250.1 netmask 255.255.255.0 broadcast 192.168.250.255"

            inetd_enable="YES"

           

 

Sender : Add the default gateway so that all the packts with receiver as the destination  goes through the dummynet             router.

            route add -net 192.168.250.0 netmask 255.255.255.0 gw 192.168.251.1 eth1

 

Sender : Add the default gateway so that all the packts with sender as the destination goes through the dummynet outer.

            route add -net 192.168.251.0 netmask 255.255.255.0 gw 192.168.250.1 eth1

           

 

 

Monitoring tool setup

            Copy the dn_file.tgz  ( contains sys/ user/ and file db_4real.csh] from the current dummynet       setup to /root. Beware !!!!! sources might be changing frequently.

 

            Extract the dn_file.tgz to the root directory [ Now you have /root/dn_files/]

           

            Make sure that /root/dn_files/ contains following files

            -rwxr--r--  1 root  wheel  1558 May 14 08:55 dn_4real.csh

            drwxr-xr-x  7 root  wheel   512 May 14 09:02 sys       

            drwxr-xr-x  7 root  wheel   512 May 14 09:02 user

           

            Move the user directory to /root

            mv /root/dn_files/user /root/     

           

            Execute the /root/dn_files/sys/link.csh

[Please check this file once to make sure hardcorded directory is fine with your setup. This script will setup symbolic link to the original file after backup]

 

Now Make sure that you implement a new system call, fast_instr_dump. To do this, check /usr/src/sys/kern/     

            syscalls.master for

            424     STD     BSD     { int fast_instr_dump (int type, int bytes, \

                                void *ptr); }

 

[When adding a new system call, always add it to the end of the syscalls.master file. Bump up the last number

            of system call]

           

Save that file, then run make init_sysent.c in the /usr/src/sys/kern directory. This will regenerate the        

init_sysent.c, syscalls.c, syscallargs.h, and syscalls.h files, all of which depend on syscalls.master.

 

If you have any doubts please refer to any webpage for "adding syscall to free-bsd" or http://www.onlamp.com 

            /pub/a/bsd/2003/10/09/adding_system_calls.html

           

            Now, You have to compile the bsd kernel....

           

            Change the directory to /usr/src/sys/i386/conf

                    copy the GENERIC file to DUMMYNET

                    Change the following things

ident "debug HZ=1000"
options HZ=1000
 maxusers 256

options DUMMYNET
options IPFIREWALL
options IPFIREWALL_DEFAULT_TO_ACCEPT
options INVARIANTS
options INVARIANT_SUPPORT
 

then type config DUMMYNET ( this will create directory called DUMMYNET in ../compile/

 

           Change the directory to cd /usr/src/sys/i386/compile/DUMMYNET

           

                        type make; make install on the command line.

                        then reboot the system

 

             By default, max number of packets in the queue can be configured as 100. Please copy the old  ipfw binary, from old dummynet to /sbin directory.

          

            After rebooting,

            Change Directory to /root/user and compile the following source

            cc -o fast_instr_dump fast_instr_dump.c

 

            Then set up the Dummynet queues:

            cd /root

./dn_4real.csh  800 2000 [ copy the dn_4real.csh from /root/dn_files. 800 is the bandwidth and 2000 is the      

queue size. If you change the ip address during the initial setup, make sure that you will change this file   

            to reflect the new ipaddress ]

           

           

At Receiver : start the iperf servers :

            iperf -s -i 5 -D -w 32M -p 5000

            iperf -s -i 5 -D -w 32M -p 5001

            iperf -s -i 5 -D -w 32M -p 5002

            iperf -s -i 5 -D -w 32M -p 5003

            iperf -s -i 5 -D -w 32M -p 5004

            iperf -s -i 5 -D -u -p 5005 [ just for UDP testing]

                       

 

Check list:

           

            Sender Side : Make sure that you can ssh to router(192.168.251.1) and receiver (192.168.250.100)

            Receiver : ssh to router(192.168.250.1) and receiver (192.168.251.100)

 

 

 

SSH setup without password:

 

At Sender side:

            Make sure that your SSH daemon has the following lines in its /etc/ssh/sshd_config

               RSAAuthentication yes

               DSAAuthentication yes

 

            ssh-keygen -t rsa1 -f ~/.ssh/id_rsa1  or ssh-keygen -t dsa -f ~/.ssh/id_dsa

            When asked for the password, just type ENTER (i.e. a blank password).

            This will create two files: ~/.ssh/id_rsa1 and ~/.ssh/id_rsa1.pub.

            Remember that you should send to the remote host only the public (id_rsa1.pub) file.

 

            Copy the public key(id_rsa.pub or id_dsa.pub) to the router as remote.host:~/.ssh/authorized_keys

 

            try ssh to dummynet router now without password.

 

 

            [for more info : http://moin.godoy.homeip.net:81/moin/moin.cgi/SSH_20access_20without_20password ]

                       

           

At Sender Side:

            Copy testtool.tgz to /root and extract it

            cd /root/testtool

 

            compile fast_dump.c and fast_clear.c

 

            cc -o fast_dump fast_dump.c

            mv fast_dump to normal_dump

            cc -o fast_clear fast_clear.c

            mv fast_clear to normal_clear

 

            make sure you have right ipaddress on config file.

 

            ./script-generator scenatio config [ make sure you will run for 10 sec for testing ]

            ./test.dynamic.csh

            once you finish running this script

            cd /root/testtool/test and see you have all the files.

 

 

After this Refer to Cheng’s Document at

Shhd confugation file can be found at /etc/inetd.conf

            http://www.cs.caltech.edu/~chengjin/dummynet