Subject: [manet] Problems of loss Mobile IP packets

From: Zhang Wen Zhi <[email-masked]>
Date: Tue, 31 Mar 2009 19:48:19 +0800

I'm using ns2-2.26 the topology is below: two wired nodes, one HA and
three wireless nodes

          ..--------------..
     ..:''                  '':..
   ''                            '.
  |    MANET  running   |
   ..            olsr          .'
     '':..              +---+ /
        ''---+----------|HA|/
                       +----+
                            \
                          ++---+        ++-----++
                          |wired |       |wired    |
                          |node1|-------| node 0 |
                          +---++       ++-------+
We are running NRLOLSR v7.1 and mobile ip in this scenario

the wired nodes and nodes in manet could  transfer CBR, and the cbr
and control message of nrlolsr are normal.

The problem is :
when the control messages of Mobile IP is generated and send to
Routing layer, the TTL of the control message is decreased to 1, thus
couldn't be delivered.

the trace file is below:
s 3.555880716 _3_ AGT  --- 90 udp 52 [0 0 0 0] ------- [4194305:0 -1:0 32 0]
r 3.555880716 _3_ RTR  --- 90 udp 52 [0 0 0 0] ------- [4194305:0 -1:0 32 0]
f 3.555880716 _3_ RTR  --- 90 udp 72 [0 0 0 0] ------- [4194305:0 -1:0 1 0]
r 3.557533187 _2_ RTR  --- 90 udp 72 [0 ffffffff 1 800] -------
[4194305:0 -1:0 1 0]
D 3.557533187 _2_ RTR  TTL 90 udp 72 [0 ffffffff 1 800] -------
[4194305:0 -1:0 0 0]
r 3.557533383 _4_ RTR  --- 90 udp 72 [0 ffffffff 1 800] -------
[4194305:0 -1:0 1 0]
D 3.557533383 _4_ RTR  TTL 90 udp 72 [0 ffffffff 1 800] -------
[4194305:0 -1:0 0 0]
s 3.588122671 _5_ AGT  --- 91 udp 52 [0 0 0 0] ------- [4194307:0 -1:0 32 0]
r 3.588122671 _5_ RTR  --- 91 udp 52 [0 0 0 0] ------- [4194307:0 -1:0 32 0]
f 3.588122671 _5_ RTR  --- 91 udp 72 [0 0 0 0] ------- [4194307:0 -1:0 1 0]
s 3.588708238 _3_ AGT  --- 92 udp 44 [0 0 0 0] ------- [4194305:698
-1:698 255 0]
r 3.588708238 _3_ RTR  --- 92 udp 44 [0 0 0 0] ------- [4194305:698
-1:698 255 0]
f 3.588708238 _3_ RTR  --- 92 ProtolibManetKernel 64 [0 0 0 0] -------
[4194305:698 -1:698 1 0]
r 3.589595040 _4_ RTR  --- 91 udp 72 [0 ffffffff 3 800] -------
[4194307:0 -1:0 1 0]
D 3.589595040 _4_ RTR  TTL 91 udp 72 [0 ffffffff 3 800] -------
[4194307:0 -1:0 0 0]
r 3.589595263 _2_ RTR  --- 91 udp 72 [0 ffffffff 3 800] -------
[4194307:0 -1:0 1 0]
D 3.589595263 _2_ RTR  TTL 91 udp 72 [0 ffffffff 3 800] -------
[4194307:0 -1:0 0 0]

Here is the tcl script, could anyone give tips on how to solve this??
the DSDV and AODV could run very well with mobile IP.

# ======================================================================
# Define options
# ======================================================================
set opt(namfile)         out.nam
set opt(tracefile)       out.tr
set opt(x)               500;                #x dimension of the
set opt(y)               500;
set opt(wirelessNodes)   3;                  #mobile nodes
set opt(wiredNodes)      2;                  #hosts and routers
set  gatewayNodes    1;                  #gateways
set val(stop)            60.0;               #simulation time
set val(start-src)       0
set val(stop-src)        60.0
set val(chan)           Channel/WirelessChannel    ;# channel type
set val(prop)           Propagation/TwoRayGround   ;# radio-propagation
set val(netif)          Phy/WirelessPhy            ;# network interface
set val(mac)            Mac/802_11                 ;# MAC type
set val(ifq)            Queue/DropTail/PriQueue    ;# interface queue
set val(ll)             LL                         ;# link layer type
set val(ant)            Antenna/OmniAntenna        ;# antenna model
set val(ifqlen)         50                         ;# max packet in ifq
set val(nn)             3                         ;# number of
set val(rp)             ProtolibManetKernel         ;# routing protocol
# ======================================================================
#---------------------------
#Initialize Global Variables
#---------------------------
#create a simulator object
set ns [new Simulator]
$ns color 0 Brown
#----------------------------------------
#Define The Hierachial Topology Structure
#----------------------------------------
$ns node-config -addressType hierarchical
#Nbr of domains
AddrParams set domain_num_ 2
#Nbr of clusters (=subdomains) in each domain
lappend clusterNbr 2 1
# API fuction
AddrParams set cluster_num_ $clusterNbr
#Nbr of nodes in each cluster
lappend eilastlevel 1 1 4
AddrParams set nodes_num_ $eilastlevel
#create trace objects for ns and nam
#$ns use-newtrace
set nstrace [open $opt(tracefile) w]
$ns trace-all $nstrace
set namtrace [open $opt(namfile) w]
$ns namtrace-all-wireless $namtrace $opt(x) $opt(y)
#create a topology object and define topology (500mx500m)
set topo [new Topography]
$topo load_flatgrid $opt(x) $opt(y)
#create God (General Operations Director)
create-god [expr $opt(wirelessNodes)+$gatewayNodes]
#create wired nodes
set temp {0.0.0 0.1.0}
for {set i 0} {$i < $opt(wiredNodes)} {incr i} {
set host($i) [$ns node [lindex $temp $i]]
}
#--------------------------------------
#Configure for Gateway and Mobile Nodes
#--------------------------------------
#Use hierarchical addresses for GWs and MNs
#configure for mobile nodes and gateways
set chan_1_ [new $val(chan)]
$ns node-config  -mobileIP ON \
           -adhocRouting $val(rp) \
           -llType $val(ll) \
           -macType $val(mac) \
           -ifqType $val(ifq) \
           -ifqLen $val(ifqlen) \
           -antType $val(ant) \
           -propType $val(prop) \
           -phyType $val(netif) \
           -channel $chan_1_ \
           -topoInstance $topo \
           -agentTrace ON \
           -routerTrace ON \
           -macTrace OFF \
           -movementTrace OFF
#configure for gateways
$ns node-config -wiredRouting ON
#create gateway
set gw(0) [$ns node 1.0.0]
set p(0) [new Agent/NrlolsrAgent]
$ns attach-agent $gw(0) $p(0)
$ns at 0.0 "$p(0) startup -tcj .75 -hj .5 -tci 2.5 -hi .5 -d 8 -l
gw.log -hna off"
[$gw(0) set ragent_] attach-manet $p(0)
$p(0) attach-protolibManetKernel [$gw(0) set ragent_]
#set initial coordinates
$gw(0) set X_ 200.0
$gw(0) set Y_ 200.0
$gw(0) set Z_ 0.0
$ns at 0.00 "$gw(0) setdest 200 200 20"

#configure for mobile nodes
$ns node-config -wiredRouting OFF
#create mobile nodes in the same domain as gw(0)
set temp {1.0.1 1.0.2 1.0.3}
for {set i 3} {$i < $opt(wirelessNodes)+3} {incr i} {
   set mobile($i) [$ns node [lindex $temp [expr $i-3]]]
   #$mobile($i) base-station [AddrParams addr2id [$gw(0) node-addr]]
     set HAaddress [AddrParams addr2id [$gw(0) node-addr]]
   [$mobile($i) set regagent_] set home_agent_ $HAaddress
   $mobile($i) random-motion 1
     set p($i) [new Agent/NrlolsrAgent]
     $ns attach-agent $mobile($i) $p($i)
     $ns at 0.0 "$p($i) startup -tcj .75 -hj .5 -tci 2.5 -hi .5 -d 8
-l mn.log -hna off"
     [$mobile($i) set ragent_] attach-manet $p($i)
     $p($i) attach-protolibManetKernel [$mobile($i) set ragent_]
                       ;# enable random motion
}
$mobile(3) set X_ 100
$mobile(3) set Y_ 300
$mobile(3) set Z_ 0.0
$mobile(4) set X_ 300
$mobile(4) set Y_ 300
$mobile(4) set Z_ 0.0
$mobile(5) set X_ 400
$mobile(5) set Y_ 200
$mobile(5) set Z_ 0.0
puts ""
puts "host0 = [$host(0) node-addr] = [AddrParams addr2id [$host(0) node-addr]]"
puts "host1 = [$host(1) node-addr] = [AddrParams addr2id [$host(1) node-addr]]"
puts "gw0 = [$gw(0) node-addr] = [AddrParams addr2id [$gw(0) node-addr]]"
for {set i 3} {$i < $opt(wirelessNodes)+3} {incr i} {
   puts "mobile($i) = [$mobile($i) node-addr] = [AddrParams addr2id
[$mobile($i) node-addr]]"
}
puts ""
$host(0) color blue
$host(1) color blue
$gw(0) color red
$host(0) shape box
$host(1) shape box
$gw(0) shape hexagon
$ns at 0.0 "$host(0) label \"HOST 0\""
$ns at 0.0 "$host(1) label \"HOST 1\""
$ns at 0.0 "$gw(0) label GATEWAY"
for {set i 3} {$i < $opt(wirelessNodes)+3} {incr i} {
   $ns at 0.0 "$mobile($i) label \"MN $i\""
}
#create links between wired nodes and gateway node
$ns duplex-link $host(0) $host(1) 5Mb 2ms DropTail
$ns duplex-link $host(1) $gw(0) 5Mb 2ms DropTail
$ns duplex-link-op $host(0) $host(1) orient right
$ns duplex-link-op $host(1) $gw(0) orient right-up
#---------------------
#Setup Traffic
#---------------------
#MN5 ==> HOST1
set src [new Agent/UDP]
set dst [new Agent/Null]
$ns attach-agent $host(1) $src
$ns attach-agent $mobile(5) $dst
#$src set fid_ 0
$ns connect $src $dst
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $src
$cbr set packetSize_ 512
$cbr set interval_ 0.1
$ns at $val(start-src) "$cbr start"
$ns at $val(stop-src) "$cbr stop"
$ns at $val(start-src) "$ns trace-annotate \"MN 5 ==> HOST 1 at
t=$val(start-src) s!\""
#---------------------
#Setup Node Movement
#---------------------
$ns at 0.5 "$mobile(5) setdest 100 450 10"
$ns at 0.5 "$ns trace-annotate \"MN 5 starts moving at t=0.5 s.\""
$ns at 0.5 "$mobile(5) add-mark m1 green circle"
#-----------------------------------
#Define Node Initial Position In Nam
#-----------------------------------
#20 defines the node size in nam, must adjust it according to your
#The function must be called after mobility model is defined
for {set i 3} {$i < $opt(wirelessNodes)+3} {incr i} {
   $ns initial_node_pos $mobile($i) 20
}
#-----------------------------------
#Tell Nodes When The Simulation Ends
#-----------------------------------
for {set i 3} {$i < $opt(wirelessNodes)+3} {incr i} {
   $ns at $val(stop).0 "$mobile($i) reset";
}
$ns at $val(stop).0 "$gw(0) reset";
$ns at $val(stop).0001 "stop"
$ns at $val(stop).0002 "puts \"NS EXITING...\" ; $ns halt"
proc stop {} {
   global ns nstrace namtrace opt
   $ns flush-trace
   close $nstrace
   close $namtrace
   exec nam $opt(namfile) &
   exit 0
}
puts "Starting simulation..."
$ns at 0.0 "$ns set-animation-rate 5ms"
$ns run

--
Thanks & Best Regards,

Zhang Wen Zhi(张文治)
Tel: 086-1358-161-4504