LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
 
Search this Thread
Old 02-12-2013, 03:53 AM   #1
alexey-bykov
LQ Newbie
 
Registered: Feb 2013
Posts: 2

Rep: Reputation: Disabled
Question ns-2: Modeling of fragmentation in the network with different MTU on routers


There is a simple network model. Transfer a file between host1 to host2. Between hosts several routers with different MTU. Here is the complete OTcL code:

Code:
####################################################################
#                                                                  #
#                               PRESETS                            #
#                                                                  #
####################################################################

# new simulator object
set ns [new Simulator]

# trace file
set allchan [open /ns2/examples/data.tr w]
$ns trace-all $allchan

# for nam
set visio [open /ns2/examples/data.nam w]
$ns namtrace-all $visio

#procedure triggered at finish time
proc finish {} {
    global ns visio allchan

    $ns flush-trace

    close $visio
    close $allchan

    exec nam /ns2/examples/data.nam &   
    exit 0
}

####################################################################
#                                                                  #
#                               LINKS &NODES                       #
#                                                                  #
####################################################################
set god [create-god 6]
for {set i 0} {$i < 6} {incr i} {
    set node_($i) [$ns node]    
}
for {set i 0} {$i < 5} {incr i} {
    $ns duplex-link $node_($i) $node_([expr $i+1]) 2Mb 10ms DropTail
}

#============================= hosts ===============================
$node_(0) color Blue
$node_(5) color Blue
#============================ routers ==============================
$node_(1) color Red
$node_(2) color Red
$node_(3) color Red
$node_(4) color Red

####################################################################
#                                                                  #
#                            AGENTS                                # 
#                                                                  #
####################################################################
set host1 [new Agent/TCP]
$ns attach-agent $node_(0) $host1
$host1 set fid_ 0
$host1 set mtu_ 1500

set router1 [new Agent/TCP]
$ns attach-agent $node_(1) $router1
$router1 set fid_ 1
$router1 set mtu_ 1000

set router2 [new Agent/TCP]
$ns attach-agent $node_(2) $router2
$router2 set fid_ 2
$router2 set mtu_ 800

set router3 [new Agent/TCP]
$ns attach-agent $node_(3) $router3
$router3 set fid_ 3
$router3 set mtu_ 700

set router4 [new Agent/TCP]
$ns attach-agent $node_(4) $router4
$router4 set fid_ 4
$router4 set mtu_ 600

set host2 [new Agent/TCPSink]
$ns attach-agent $node_(5) $host2
$host2 set mtu_ 1500
$ns connect $host1 $host2

####################################################################
#                                                                  #
#                          APPLICATIONS                            #
#                                                                  #
####################################################################
set ftp [new Application/FTP]
$ftp attach-agent $host1
$ftp set type FTP

####################################################################
#                                                                  #
#                           START SIM                              #
#                                                                  #
####################################################################
$ns at 0.1 "$ftp start"
$ns at 10.0 "$ftp stop"

$ns at 11.0 "finish"
$ns run
I want to see the fragmentation of packets, but it is not. What this could be the reason? I suspect that i can not set the MTU.

Part of data.tr -
Code:
+ 0.1 0 1 tcp 40 ------- 0 0.0 5.0 0 0
- 0.1 0 1 tcp 40 ------- 0 0.0 5.0 0 0
r 0.11016 0 1 tcp 40 ------- 0 0.0 5.0 0 0
+ 0.11016 1 2 tcp 40 ------- 0 0.0 5.0 0 0
- 0.11016 1 2 tcp 40 ------- 0 0.0 5.0 0 0
r 0.12032 1 2 tcp 40 ------- 0 0.0 5.0 0 0
+ 0.12032 2 3 tcp 40 ------- 0 0.0 5.0 0 0
- 0.12032 2 3 tcp 40 ------- 0 0.0 5.0 0 0
r 0.13048 2 3 tcp 40 ------- 0 0.0 5.0 0 0
+ 0.13048 3 4 tcp 40 ------- 0 0.0 5.0 0 0
- 0.13048 3 4 tcp 40 ------- 0 0.0 5.0 0 0
r 0.14064 3 4 tcp 40 ------- 0 0.0 5.0 0 0
+ 0.14064 4 5 tcp 40 ------- 0 0.0 5.0 0 0
- 0.14064 4 5 tcp 40 ------- 0 0.0 5.0 0 0
r 0.1508 4 5 tcp 40 ------- 0 0.0 5.0 0 0
+ 0.1508 5 4 ack 40 ------- 0 5.0 0.0 0 1
- 0.1508 5 4 ack 40 ------- 0 5.0 0.0 0 1
r 0.16096 5 4 ack 40 ------- 0 5.0 0.0 0 1
+ 0.16096 4 3 ack 40 ------- 0 5.0 0.0 0 1
- 0.16096 4 3 ack 40 ------- 0 5.0 0.0 0 1
r 0.17112 4 3 ack 40 ------- 0 5.0 0.0 0 1
+ 0.17112 3 2 ack 40 ------- 0 5.0 0.0 0 1
- 0.17112 3 2 ack 40 ------- 0 5.0 0.0 0 1
r 0.18128 3 2 ack 40 ------- 0 5.0 0.0 0 1
+ 0.18128 2 1 ack 40 ------- 0 5.0 0.0 0 1
- 0.18128 2 1 ack 40 ------- 0 5.0 0.0 0 1
r 0.19144 2 1 ack 40 ------- 0 5.0 0.0 0 1
+ 0.19144 1 0 ack 40 ------- 0 5.0 0.0 0 1
- 0.19144 1 0 ack 40 ------- 0 5.0 0.0 0 1
r 0.2016 1 0 ack 40 ------- 0 5.0 0.0 0 1
+ 0.2016 0 1 tcp 1040 ------- 0 0.0 5.0 1 2
- 0.2016 0 1 tcp 1040 ------- 0 0.0 5.0 1 2
+ 0.2016 0 1 tcp 1040 ------- 0 0.0 5.0 2 3
- 0.20576 0 1 tcp 1040 ------- 0 0.0 5.0 2 3
r 0.21576 0 1 tcp 1040 ------- 0 0.0 5.0 1 2
+ 0.21576 1 2 tcp 1040 ------- 0 0.0 5.0 1 2
- 0.21576 1 2 tcp 1040 ------- 0 0.0 5.0 1 2
r 0.21992 0 1 tcp 1040 ------- 0 0.0 5.0 2 3
+ 0.21992 1 2 tcp 1040 ------- 0 0.0 5.0 2 3
- 0.21992 1 2 tcp 1040 ------- 0 0.0 5.0 2 3
r 0.22992 1 2 tcp 1040 ------- 0 0.0 5.0 1 2
+ 0.22992 2 3 tcp 1040 ------- 0 0.0 5.0 1 2
- 0.22992 2 3 tcp 1040 ------- 0 0.0 5.0 1 2
r 0.23408 1 2 tcp 1040 ------- 0 0.0 5.0 2 3
+ 0.23408 2 3 tcp 1040 ------- 0 0.0 5.0 2 3
- 0.23408 2 3 tcp 1040 ------- 0 0.0 5.0 2 3
r 0.24408 2 3 tcp 1040 ------- 0 0.0 5.0 1 2
+ 0.24408 3 4 tcp 1040 ------- 0 0.0 5.0 1 2
- 0.24408 3 4 tcp 1040 ------- 0 0.0 5.0 1 2
r 0.24824 2 3 tcp 1040 ------- 0 0.0 5.0 2 3
+ 0.24824 3 4 tcp 1040 ------- 0 0.0 5.0 2 3
- 0.24824 3 4 tcp 1040 ------- 0 0.0 5.0 2 3
r 0.25824 3 4 tcp 1040 ------- 0 0.0 5.0 1 2
+ 0.25824 4 5 tcp 1040 ------- 0 0.0 5.0 1 2
- 0.25824 4 5 tcp 1040 ------- 0 0.0 5.0 1 2
r 0.2624 3 4 tcp 1040 ------- 0 0.0 5.0 2 3
+ 0.2624 4 5 tcp 1040 ------- 0 0.0 5.0 2 3
- 0.2624 4 5 tcp 1040 ------- 0 0.0 5.0 2 3
r 0.2724 4 5 tcp 1040 ------- 0 0.0 5.0 1 2
+ 0.2724 5 4 ack 40 ------- 0 5.0 0.0 1 4
- 0.2724 5 4 ack 40 ------- 0 5.0 0.0 1 4
r 0.27656 4 5 tcp 1040 ------- 0 0.0 5.0 2 3
...
How to simulate the fragmentation? I would be very grateful for the information.
 
Old 02-12-2013, 07:44 AM   #2
alexey-bykov
LQ Newbie
 
Registered: Feb 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
I suspect, that either the model is not correct, or MTU can not be repeatable. There are examples of OTcL -scripts for ns-2, in which i can see the fragmentation of packets?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ask] Enabling jumbo frame and various MTU on a network slack32 Linux - Networking 1 08-11-2012 02:31 AM
[SOLVED] Assign MTU value for network interface. need help deepclutch Debian 1 05-18-2011 03:52 AM
two routers, one network jaymoney Linux - Networking 4 09-14-2007 03:08 PM
Help with network slowdown (fragmentation?) c4onastick Linux - Networking 7 07-11-2007 11:34 PM
Testing MTU for fragmentation murphaph Linux - Networking 2 04-09-2004 06:53 PM


All times are GMT -5. The time now is 10:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration