Beyond the Sky

The place where surface stop and share the experience of life

Subscribe to RSS feed

Posts tagged with "ns2"

Setup NS2.29 on FC5

,

There are issues on OTCL/TCL/TK which will cause your configuration fail in the middle. I found the patch from the mailing list ( http://www.archivesat.com/post1272327.htm ) After applying the patch, it work as expected.

In case you facing problem installing on FC5 and found no solution, you can follow the simple instruction here.

1. Download ns-allinone-2.29 from the website, extract it at either home directory or opt
2. Download the patch from ns2292-gcc410.patch
3. Copy the patch into ns-allinone-2.29 folder and patch it with:
patch -p1 < ns2292-gcc410.patch


In case it was not working, don't throw the question to me, you will get no solution from me . Throw it back the ns2 mailing list. As I am trying to help here, but I am not expert of this, Good Luck.

Where does tcpdump tap the traffic ?

,

I was wandering, how does tcpdump did the sniffering works, and i find a related paper.

Steven McCanne and Van Jacobson - The BSD Packet Filter: A New Architecture for User-level Packet Capture

Quote from the section 2

BPF has two main components: the network tap and the
packet filter. The network tap collects copies of packets from
the network device drivers and delivers them to listening applications


BPF is Berkery Packet Filter, from the statement above, the packet is tap from the network device. Okay which part of the network interface?

When a packet arrives at a network interface the link
level device driver normally sends it up the system protocol
stack. But when BPF is listening on this interface, the driver
first calls BPF.BPF feeds the packet to each participating process’
filter. This user-defined filter decides whether a packet
is to be accepted and how many bytes of each packet should
be saved.



From here we know, the packet its been duplicated and a copy of the packet is feed to user-defined filter. My question is did the filter discard "unwanted" bits?

Because network monitors often want only a small subset of
network traffic, a dramatic performance gain is realized by filtering out unwanted packets in interrupt context.



From the Ns Manual, chapter 16 Mobile Node, refers to the scematic, there is an tap agent inside the MAC module, which it been described as

Tap Agents Agents that subclass themselves as class Tap defined in mac.h can register themselves with the mac object using method installTap(). If the particular Mac protocol permits it, the tap will promiscuously be given all packets received by the mac layer, before address filtering is done.



Interesting cool

NS2.29 NAM is not functioning

Fgcc post a comment for me, state that nam was not working, finally I discover that it is because the symlink uses relative address instead of absolute address. Refers to here for more info.

I have install at both at PC and notebook, amazingly the ns2 installed at my notebook, nam symlink is using absolute address. Wandering why is that so irked

NS2 updates

The latest version is 2.29, currently the ns2 have its own wiki page, which it links all the ns2 related web page. By the way, they are updating ns2 manual.

Otcl info

, ,

Info is a very good function for otcl classes and object to discover its relations. Check out the Info section for more details
http://www.openmash.org/developers/docs/otcl-doc/doc/object.html
http://www.openmash.org/developers/docs/otcl-doc/doc/class.html

Let me list some interesting examples to shows you how you can fully utilize the info to help you understand NS objects and classes.

The main Class of NS is Simulator, from the terminal, type 'ns' to start.
%set ns [new Simulator]
_o4

Let check see whether the class Simulator have how many instances
%Simulator info instances
_o4

_o4 is the object, check where the object instanciate from
%_o4 info class
Simulator
%$ns info class
Simulator

2 ways gives the same result.

If you investigates the info listed on object and class of the page above, you may discover that object info procs, where class info instprocs. So what is the difference between procs and instprocs. Instprocs of class is actually virtual function, that means the object instanciate from the class, should implement that instprocs, but procs of object is the extra function of the particular object.

% Simulator info instprocs
phyType sleepPower mrtproto-iifs PLMcreate-agent llType clear-mcast asim-getAggrTput link add-isl get-nam-traceall ifqType energyModel attach-tagger LMS link-lossmodel re-rewind-nam halt trace-all-satlinks PGM sat_link_destroy mrtproto makeflowmon snapshot routerTrace trace-queue mobileIP OutgoingErrProc namtrace-queue asim-dump duplex-link make-lan rtmodel topoInstance insert-delayer detach-lossmodel rtmodel-at run-mcast after QS now toraDebug rtmodel-configure PLMcbr_flow_PP log-simstart create-omnimcast-agent asim-getLinkDrop get-node-by-addr satnode-geo-repeater dump-namwireless macTrace multihome-add-interface drop-trace node-config bw_parse set-address-format init-nam puts-nam-config initialEnergy bandwidth set-nix-routing get-number-of-nodes node ifqLen check-smac transitionPower ldp-request-color get-node-id-by-addr gen-map maketbtagger at-now rtmodel-delete IncomingErrProc lossmodel expand-port-field-bits terminate-nam channelType idlePower namtrace-all asim-getLinkTput multicast set-dsr-nodetype get-link-head wiredRouting asim-getFlowDrop flush-trace satnode-polar dumper propInstance create-highspeed-connection create-trace dump-namcolors PLMbuild_source_set get-node-by-id eventtrace-all txPower simplex-link-op ldp-withdraw-color pushback-duplex-link get-ns-traceall create-diffusion-rate-agent create-dumb-agent terminate-all-agents hier-topo abstract-tcp delay_parse get-queue src_rting dump-namlans satnode monitor-agent-trace is-started cost create-diffusion-probability-agent monitor-queue dump-approx-sim-data rewind-nam delete-agent-trace attach-diffapp asim-getFlowTput create-connection-listen multicast? diffusionFilter put-in-list create-dsdv-agent delay compute-flat-routes energy-color-change prepare-to-stop puts-nam-traceall use-newtrace MPLS trace-all rxPower downlinkBW register-nam-linkconfig dump-namnodes rtt rtproto expand-address compute-routes create-tcp-connection run create-satnode adhocRouting all-nodes-list dump-namlinks sat_link_up attach-tbf-agent maybeEnableTraceAll ldp-notification-color queue-limit create-wireless-node dump-routelogic-nh get-color namtrace-all-wireless detach-agent dump-namaddress use-taggedtrace create-aodv-agent get-link antType agentTrace namtrace-config create-flooding-agent remove-nam-linkconfig macType add-first-links asim-getLinkDelay asim-run get-nodetype chk-hier-field-lengths attach-fmon ldp-release-color FECProc namtrace-some mpls-node newsatnode connect set-animation-rate nullagent transitionTime propType nam-end-wireless create_packetformat simplex-connect multihome-attach-agent multihome-connect make-abslan clearMemTrace eotTrace src_rting? movementTrace dump-namversion at trace-annotate color puts-ns-traceall addressType attach-agent add-agent-trace channel create-node-instance get-routelogic create-core-diffusion-rtg-agent compute-algo-routes newLan cancel check-node-num all-links-list initial_node_pos compute-hier-routes dump-namagents use-scheduler ldp-mapping-color stopTime create-manual-rtg-agent simplex-link dumpq LDP-peer duplex-link-op create-connection-list pushback-simplex-link create-tora-agent hier-node init get-AllocAddrBits imep-support set-hieraddress set-address dump-namqueues dump-routelogic-distance satNodeType create-connection create-eventtrace get-nam-config duplex-intserv-link maketswtagger satnode-geo satnode-terminal

The Simulator have a lots of the instprocs, but i just wanna shows you one of the example 'node', to query whether the function 'node' exist, i do as bellow.
% Simulator info instprocs node
node
% _o4 node
_o14

The first line query instprocs node, if it doesn't exist, it will return nothing. _o4 is the object of simulator(can be replace with $ns), the third line is shows the object calls the instproc node, and it returns another object _o14 instance. _o14 is instance of Node class.
% _o14 info class
Node


There is a lots more to discover, let say
Simulator info superclass 

Although Simulator is the main class for NS, but it is not root class.

Network Simulator 2.29 dependencies

The most important parts of this ns2 installation is to solve the dependencies, you can't apt-get ns2, there are no such binaries version available for you to apt-get.

Bellow are the dependencies (packages) i apt-get before i start install.

- gcc
- g++
- tcl8.4
- tcl8.4-dev
- tk8.4
- tk8.4-dev
- make

I extract ns-allinone-2.29.2.tar.gz at my home directories and the rest of the steps is easy
cd ~/
tar -zxvf ns-allinone-2.29.2.tar.gz
cd ns-allinone-2.29
./install


It takes few minutes to compile and install, depend on your processing power. Next you need to set the environment for PATH, LD_LIBRARY, TCL_LIBRARY. For me, i install at my home directory, so i decided to just edit the .bashrc

cd
vi .bashrc


Adding these lines at bellow

#set the ns2 environment
export LD_LIBRARY_PATH=/home/uname/ns-allinone-2.29/otcl-1.11:/home/uname/ns-allinone-2.29/lib
export PATH=$PATH:/home/uname/ns-allinone-2.29/bin:/home/uname/ns-allinone-2.29/tcl8.4.11/unix:/home/uname/ns-allinone-2.29/tk8.4.11/unix
export TCL_LIBRARY=/home/uname/ns-allinone-2.29/tcl8.4.11/


uname is my login name.

The last step, go back to ns-allinone-2.29/ns-2.29 and run ./validate

You may wanna check whats inside ns-allinone-2.29/bin, these are all your binaries for ns2.