티스토리 뷰

Setting up a Network Simulator Station

From DStovall

Jump to: navigation, search

Contents

[hide]

[edit] Introduction

At the MPC Lab, we have a powerful server that we use to run big network simulations. However, I would like to develop my simulations and applications without necessarily being connected to this server. My solution is to create a local version of the server in a VM-Ware image. Ideally, if something works in the virtual machine, then it will work on the server.

I've also found that having this image around is very useful for other purposes... specifically avoiding the head-ache of setting up all these simulators and tools on each person's computer when they join the lab. Since I can just give them an image of a working machine, they are guaranteed to be able to get going. Also, if someone chooses to install all these tools on their local system, the VM can be used as a reference.

These instructions will take a vanilla Ubuntu VMWare image and install the following network simulators and tools on it in a 'shared machine configuration'. If you spot an error or want to suggest a feature, please email me at dstovall@mail.utexas.edu.

[edit] Ubuntu under VMWare

First thing you want to do is re-run the vmware config scripts. Specifically, you can reset the resolution of the "machine's" monitor.

sudo /usr/bin/vmware-config-tools.pl

You should also confirm that you can mount 'shared folders' from the host OS. If the following command give you an error, then you won't be able to mount the host's shared folders. This mean you need to install VMWare Tools (and may mean that you need to rebuild the kernel). Get this working before going any further.

modprobe vmhgfs

[edit] Prepackaged dependencies

This command will get all the dependencies that you need for Omnet/Mobility/NesCT/TinyOS that are available as prepackaged Debian libraries.

sudo apt-get install gcc g++ bison make doxygen imagemagick graphviz giftrans flex xlc libxml2-dev expat java-package binutils-dev alien wget fakeroot cvs perl autoconf unzip tar sysutils libx11-dev tcl8.4-dev tk8.4-dev blt-dev libxmu-dev

After doing this, you might also want to run the synamitic package manager to look for updates to other packages already installed on the system.

[edit] IBM JDK

For now, I'm just biting the bullet and installing the IBM JDK... I would rather use a re-distributable JDK, but I haven't taken the time to figure out how to get the javacomm libraries setup for these other JDK's. If anyone out there has some advice about this, please let me know.

Browse to ibm.com and login/download JDK and javacomm packages (as tgz). This link may or may not work for you...

Once you have the JDK that IBM distributes as a .tgz file, we can use the following commands to install it on Ubuntu:

fakeroot make-jpkg IBMJava2-SDK-142.tgz   # Create a debian package out of the tgz'd IBM jdk
sudo dpkg -i ibm-j2sdk1.4_1.4.2_i386.deb  # Install the new package
sudo update-alternatives --config java    # Update the system to use the new java. (look for 'ibm')
sudo update-alternatives --config javac   # Update the system to use the new java compiler. (look for 'ibm')

Extract the files from the javacomm archive and copy them into /usr/lib/j2sdk1.4-ibm (or whereever the jdk was installed) and change the permissions to match their siblings (chmod a-x file-name). More explicitly, do the following:

mkdir tmp
cd tmp
tar xzf IBMJava2-JAVACOMM-142.tgz
chmod a-x IBMJava2-142/jre/bin/libibmcomm.so
chmod a-x IBMJava2-142/jre/lib/javax.comm.properties
sudo cp -R IBMJava2-142/* /usr/lib/j2sdk1.4-ibm/

Now run the commands below to make sure java is in your path (i.e. the command run at all) and that the right jre is being used (i.e. IBM is in the version information). I haven't found a good way to check that javac is the right version, but if java is working, it's a safe bet that javac is working.

java -version

[edit] TinyOS 1.x install

We will be installing the core package at /opt/tinyos-1.x and building the application there. However, users should be able to develop and use tinyos from their home directories. For this install, we will be copying all of the tinyos examples to the user's home directory as a starting point.

[edit] Dependencies

Here we download (wget) a bunch of dependencies that have been pre-built for Red-hat (.rpm). We use a tool (alien) to convert these packages to Debian packages (.deb) and then install them (dpkg).

cd ~
mkdir tmp
cd tmp
wget http://www.tinyos.net/dist-1.2.0/tools/linux/avarice-2.4-1.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/avr-binutils-2.15tinyos-3.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/avr-gcc-3.4.3-1.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/avr-insight-6.3-1.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/avr-libc-1.2.3-1.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/msp430tools-base-0.1-20050607.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/msp430tools-binutils-2.16-20050607.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/msp430tools-gcc-3.2.3-20050607.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/msp430tools-gdb-6.0-20050609.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/msp430tools-gdb-proxy-6.0-20050609.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/msp430tools-jtag-lib-20031101cvs-20050610.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/msp430tools-libc-20050308cvs-20050608.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/msp430tools-python-tools-1.0-1.noarch.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/xscale-elf-binutils-2.15-1.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/xscale-elf-gcc-3.4.3-1.i386.rpm http://www.tinyos.net/dist-1.2.0/tools/linux/xscale-elf-newlib-1.11.0tinyos-1.i386.rpm http://www.tinyos.net/dist-1.2.0/tinyos/linux/nesc-1.2.8-1.i386.rpm http://www.tinyos.net/dist-1.2.0/tinyos/linux/tinyos-tools-1.2.3-1.i386.rpm

fakeroot alien *.rpm
sudo dpkg -i --force-overwrite *.deb

[edit] Port Permission

Allow access to the serial port. I'm using ttyS0, ttyS1, and ttyS2 (COM1, COM2, and COM3) here.

sudo chmod 666 /dev/ttyS0 /dev/ttyS1 /dev/ttyS2

[edit] Get TinyOS from CVS

Download the tinyos source from SourceForge. This first command is just to create a login token, you'll be prompted for a password... just hit enter. The second command downloads the source to TinyOS for the 1.1.15 release. If a new release has occured since I wrote this (doubtful), then just put the new CVS tag in the right place.

cd /opt
sudo cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
sudo cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co -r "tos-1-1-15Dec2005cvs-release" -P tinyos-1.x
cd ~
ln -s /opt/tinyos-1.x/ tinyos

[edit] Environment Changes

Add the following to your .bashrc file (with the comments!). The CLASSPATH line uses a script to programmatically build up the classpath for tinyos. It will include any current classpath value that has already been set. The MIB510 line is used by the program that uploads data to the motes. Use this value for now, and if you later figure out that the programmer is attached to COM2/COM3/COM7, you can update this value. The TINYOS_MAKELOCAL variable allows us configure some things from the user's directory rather then the installation root. The lines that are commented out are there to point people in the right direction if they need more configuration... and hopefully avoid mangling the /opt install.

# Added by <NAME> on <DATE> to support tinyOS 1.x installation
export TOSROOT=/opt/tinyos-1.x
export TOSDIR=$TOSROOT/tos
export CLASSPATH=`$TOSROOT/tools/java/javapath`
export MIB510=/dev/ttyS0
export MOTECOM=serial@COM1:mica2
export TINYOS_MAKELOCAL=~/tinyos-dev/Makelocal
#export TINYOS_MAKEDEFAULTS=  # If needed...
#export TOSMAKE_PATH=         # If needed...

Once these values are saved, close all open shells and open a new shell (to get the new values). Check that everything is correct:

ls $TOSROOT
ls $TOSDIR

Now let's copy the examples to the user directory and replace the Makerules file that comes with it.

sudo cp -R $TOSROOT/apps ~/tinyos-dev
cd ~/tinyos-dev
cp Makerules Makerules.orig
cp $TOSROOT/tools/make/Makerules .

Add these lines to ~/tinyos-dev/Makelocal to avoid headaches later...

DEFAULT_LOCAL_GROUP ?= 0x33
PFLAGS += -DCC1K_DEF_FREQ=916700000
MIB510 ?= COM1

I've seen people use frequencies of 916700000, 916400000. I'm still looking for example frequencies for the 433 MHz range Mica2's.

[edit] Build TinyOS

cd $TOSROOT
sudo make
sudo make install
cd $TOSROOT/tools/java
sudo make

[edit] Verify

TinyOS comes with a script to check the system for consistency. This (obviously) is the first thing to use to verify the install. You can find more information about this on TinyOS's System and Hardware Verification.

$TOSROOT/tools/scripts/toscheck

As of right now, I get these errors:

  • uisp is wrong version (too recent)
  • graphviz is the wrong version (too recent)
  • avr-gdb is wrong version (personally, I don't need this)
  • msp430-gcc is not installed (I won't be able to compile for telos)

There's also some information there under the heading ' Hardware Verification' about verifying your mica-based motes. Do this.

You should also attempt to compile something... might I suggest 'Blink'...

cd $TOSROOT/apps/Blink
make mica2

You should also be able to upload programs to motes... again, I suggest 'Blink', but follow it with 'CntToLeds'...

cd $TOSROOT/apps/Blink
make mica2 install mib510
cd ../CntToLeds
make mica2 install mib510

You won't be able to run tossim, but that's what Omnet++/NesCT is for...

[edit] Omnet Install

Official instructions. These instructions are for installing omnet in /opt and reinstalling the examples in the user's home directory.

[edit] Download / Extract

Get the latest stable source code release as a .tgz file from the Omnet++ Download Page

Extract this archive to you home directory, and create a soft link to it (for easy migration later)

cd /opt
sudo tar xzf ~/Desktop/omnetpp-3.3-src.tgz
cd ~
ln -s /opt/omnetpp-3.3/ omnetpp

[edit] Environment Changes

Add the following to your .bashrc file, with the comment!

# Added by <NAME> on <DATE> to support Omnet 3.x installation
export PATH=$PATH:/opt/omnetpp-3.3/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/omnetpp-3.3/lib
export TCL_LIBRARY=/usr/lib/tcl8.4

Then close your terminal and open another.

[edit] Build / Install

The first step is to run 'configure'. This will check to make sure you have all the pre-req's, so if I forgot something in step 1, this is where it will show up.

cd ~/omnetpp
sudo ./configure

At the end of the configure step, you may get warnings about PATH and LD_LIBRARY_PATH not including specific omnet directories. This is because the root user (via sudo) does not include these directories is his path... which is a good thing. However, you should still check your user's environment to make sure these directories are included:

echo $PATH
echo $LD_LIBRARY_PATH

Configure will also give you a warning that MPI and Akaroa are not installed. These are optional packages that may interfere with the NesCT install later. If you really want MPI or Akaroa, go for it and let me know how it goes...  ;-)

If these are the only warnings that you are getting, go ahead and build the application... but remember that you need those omnet directories in your path in order to build, so we'll do these things as root:

su
export PATH=$PATH:/opt/omnetpp-3.3/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/omnetpp-3.3/lib
make

Now copy the samples to your home directory to make sure you can run them (without sudo).

cp -R /opt/omnetpp-3.3/samples ~/omnet-dev

[edit] Validation

Make and run some samples. The omnet build (that we did as root in /opt/...) already compiled the samples, so when we're doing this bit of validation, it's good to make sure we can actually build the samples as our user. At this point, you just want the application to look pretty and do some animations. (except neddemo... it doesn't do anything)

cd ~/omnet-dev/dyna
make clean
make
./dyna
cd ~/omnet-dev/tokenring
make clean
make
./tokenring
cd ~/omnet-dev/fifo
make clean
make
./fifo
cd ~/omnet-dev/neddemo
make clean
make
./neddemo
cd ~/omnet-dev/tictoc
make clean
make
./tictoc
cd ~/omnet-dev/fddi
make clean
make
./fddi

[edit] Mobility Framework Install

Official instructions

[edit] Download / Extract

Like Omnet above, create a soft link for the mobility distribution

cd /opt
sudo tar xzf ~/Desktop/mobility-fw2.0p3.tgz
cd ~
ln -s /opt/mobility-fw2.0p3 mobility-fw

[edit] Environment Changes

Add the following to your .bashrc file, with the comment!

# Added by <NAME> on <DATE> to support Mobility-Framework installation
export PATH=$PATH:~/omnetpp/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/mobility-fw2.0p3/core/lib:/opt/mobility-fw2.0p3/contrib/lib

Close your shells and open new shells.

[edit] Build

Like before, we want to do this build as root, but we don't want to junk up root's paths with all these values. The following should give a root shell with the required paths to build:

su
export PATH=$PATH:/opt/omnetpp-3.3/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/omnetpp-3.3/lib:/opt/mobility-fw2.0p3/lib
cd /opt/mobility-fw2.0p3
./mkmk
make core
make contrib
make networks

[edit] Validation

Copy the samples to the user's home directory, make sure he can compile and run them... sounds easy eh?

Unfortunately, the build scripts that will come with the samples use relative directories :( Fortunately, they also come with the command line to rebuild them :)

Here are the commands to get everything going:

cd ~
cp -R ~/mobility-fw/networks ~/mfw-dev
cd ~/mfw-dev;          grep -m1 opp_makemake Makefile | cut -c4- | sh
cd 802.11/;            grep -m1 opp_makemake Makefile | cut -c4- | sh
cd ../aloha/;          grep -m1 opp_makemake Makefile | cut -c4- | sh
cd ../baseStationNet/; grep -m1 opp_makemake Makefile | cut -c4- | sh
cd ../csma/;           grep -m1 opp_makemake Makefile | cut -c4- | sh
cd ../floodTest/;      grep -m1 opp_makemake Makefile | cut -c4- | sh
cd ../gilbert-elliot/; grep -m1 opp_makemake Makefile | cut -c4- | sh
cd ../mobileNet/;      grep -m1 opp_makemake Makefile | cut -c4- | sh
cd ../p2p/;            grep -m1 opp_makemake Makefile | cut -c4- | sh
cd ..
make makefile-ins

Now the samples should run. As far as I can tell, the 'mobileNet' simulation is the only one with actuall moving nodes...

cd ~/mfw-dev/mobileNet
make clean
make
./mobileNet

[edit] NesCT Install

Official instructions.

[edit] Environment Changes

Add the following to your .bashrc file, with the comment!

# Added by <NAME> on <DATE> to support NesCT installation
export CLASSPATH=$CLASSPATH:~/nesct-dev/tictoc/java

Close shells...

[edit] Unzip / Build

cd /opt
sudo unzip /home/mpc/Desktop/nesct_src_040307.zip
sudo chmod -R a+r nesct
sudo find nesct -type d | sudo xargs chmod a+x
sudo ./configure
sudo make
cd ~
mkdir nesct-dev
cd ~/nesct-dev
unzip .../nesct_tos_example_220307_.zip
cd tictoc
ln -s /opt/nesct/nesct.exe nesct.exe
# Building default app
./nesct.exe Application.nc
opp_makemake -c config -f
make
./tictoc

[edit] Validation

See the usage page of the site and do a couple examples. Specifically, be sure to do CntToLedsAndRfm.

[edit] NesCT w/ Mobility-Framework Install

Official instructions Can you tell that I'm writing this whole document in one sitting?  ;-)

[edit] Edit config files

Update both .../tictoc/config and .../tictoc/config_mfw for the following values

MOBFW=
NEDC=
OMNETPP_INCL_DIR=
OMNET_LIB_DIR=

[edit] Ns2

To install Ns2 for a 'shared machine', you basically install the "allinone" package in /opt instead of in the user's home directory. The only catch is that the validation tests use a lot of relative paths... so if we want to put the validation tests in the user's home directory, we need to add a bunch of soft links to the elements they depend on.

Ideally, I would come up with a way to go through all the scripts and substitute the relative paths for absolute paths, but I haven't done that yet.

First, download the latest "allinone" package from source forge. Extract it into /opt, creating /opt/ns-allinone-2.xx. Then (per the current install instructions):

cd ns-allinone-2.29
sudo ./install

Second, we need to copy the validation tests to the user's home directory and set up the soft links:

cd ~
mkdir ns-dev
cd ns-dev
cp -r /opt/ns-allinone-2.xx/validate .
ln -s /opt/ns-allinone-2.xx/ns-2.xx/bin bin
ln -s /opt/ns-allinone-2.xx/ns-2.xx/ns ns
mkdir tcl
cd tcl
cp -r /opt/ns-allinone/tcl/test .
ln -s /opt/ns-allinone-2.xx/ns-2.xx/tcl/ctr-mcast ctr-mcast
ln -s /opt/ns-allinone-2.xx/ns-2.xx/tcl/ex ex
ln -s /opt/ns-allinone-2.xx/ns-2.xx/tcl/mcast mcast
ln -s /opt/ns-allinone-2.xx/ns-2.xx/tcl/mobility mobility

Third, let's run the validation tests (takes a long time)

cd ~/ns-dev
./validate

[edit] Other tools

I would also recommend installing:

sudo apt-get install ant
cd /usr/local
sudo tar xzf maven-XXX.tgz
    • Rumor has it that maven can be installed with

[edit] When you're done

When you've got all this stuff working the way you think it should, do the following:

  1. shutdown the virtual machine
  2. double-click the virtual disk, and click the 'defragment' button
  3. take a snapshot (from the 'VM' menu)

This way you can always go back to a working configuration if something gets screwed up.  ;-)

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함