BCA / B.Tech 12 min read

Sending Traffics Through NS2 Links in Hindi

RK

लेखक Ratan Kumawat · संस्थापक, NotesMedia

प्रकाशित:

त्वरित सारांश और मुख्य बिंदु

  • • विषय फोकस: Computer Network & Communication Notes in Hindi | कंप्यूटर नेटवर्किंग और कम्युनिकेशन नोट्स (BCA / B.Tech Syllabus)
  • • मुख्य विषय: Sending Traffics Through NS2 Links in Hindi - General Topics
  • • अवलोकन: Quick Answer: Network Simulator 2 (NS-2) mein wired links ke madhyam se data traffic bhejne ke liye 4-step pipeline follow ki jaati hai: 1) Nodes create...
  • • मुख्य अवधारणाएं: Sending traffics NS2 links, Application FTP start stop Hindi, Packet rate flow id traffics,Sending traffics NS2 links, Application FTP start stop, Packet rate flow id traffics
Quick Answer: Network Simulator 2 (NS-2) mein wired links ke madhyam se data traffic bhejne ke liye 4-step pipeline follow ki jaati hai: 1) Nodes create karke unke beech duplex-link establish karna, 2) Source node par transport agent (jaise Agent/TCP ya Agent/UDP) aur destination par receiving agent (Agent/TCPSink ya Agent/Null) attach karna, 3) Simulator mein $ns connect $src $dst call karna, aur 4) Transport agent ke upar traffic generator application (jaise Application/FTP ya Application/Traffic/CBR) bind karke start aur stop schedule karna.

NS-2 Wired Network Traffic Architecture

Network simulation ka mukhya maksad yah dekhna hota hai ki jab user applications real-world data packets send karti hain, toh physical cables (links) aur intermediate routers/queues par packet loss, delay (latency) aur throughput par kya asar padta hai.

NS-2 mein traffic transmission traditional OSI aur TCP/IP layered architecture ko simulate karta hai. Shuruat karne ke liye aap hamare Creating Links in Wired Network in Hindi aur Nodes and Agents in NS-2 guides refer kar sakte hain.

Advertisement

NS-2 Traffic Generation Pipeline ke 4 Core Layers

  1. Physical Topology (Nodes & Links): Virtual computers (nodes) create hote hain aur unhe bandwidth, delay aur buffer queue policy ke sath links se joda jata hai.
  2. Transport Layer (Agents): Data delivery semantics (reliable connection-oriented TCP ya fast connectionless UDP) decide hoti hai.
  3. Application Layer (Traffic Generators): Real user traffic pattern (jaise bulk file transfer FTP ya continuous media stream CBR) create kiya jata hai.
  4. Simulation Scheduler: Discrete-event clock ke specific timestamps par traffic generation shuru aur band kiya jata hai.

Transport Agents aur unke Pairs

NS-2 mein traffic transmit karne ke liye sender aur receiver agents ka sahi pair hona anivarya hai:

  • TCP Traffic Pair: Sender node par Agent/TCP attach hota hai jo window flow control aur congestion control handle karta hai. Destination node par Agent/TCPSink attach hota hai jo packets receive karke sender ko acknowledgements (ACKs) wapas bhejta hai.
  • UDP Traffic Pair: Sender node par Agent/UDP attach hota hai jo bina handshake ya ACKs ke packets forward karta hai. Destination node par Agent/Null attach hota hai jo aane wale packets ko absorb (consume) kar leta hai.

Traffic Generators ka Comparison: FTP vs CBR vs Exponential

Traffic Generator Compatible Agent Traffic Behavior Primary Real-World Analogy
Application/FTP Agent/TCP Greedy traffic; TCP congestion window jitna allow karti hai utni maximum speed se data pump karta hai. Large file downloads, Google Drive sync, web page downloads.
Application/Traffic/CBR Agent/UDP Constant Bit Rate; ek nishchit samay antral (interval) par fixed packet size bhejta hai. VoIP Internet calls, video conferencing, live audio radio.
Application/Traffic/Exponential Agent/UDP ON/OFF burst traffic; exponential distribution ke hisab se burst mein packets aate hain. Human web surfing, interactive chat sessions.
Application/Traffic/Pareto Agent/UDP Long-tail self-similar burst traffic pattern. Aggregated metropolitan internet traffic backbone.

Complete Working Script: Dual-Traffic (TCP + UDP) Demonstration

Niche di gayi standard TCL script mein dekhein ki 4 nodes ki topology mein TCP aur UDP traffic simultaneous kaise execute hota hai:

# 1. Simulator object banayein
set ns [new Simulator]

# 2. NAM animation aur trace log files setup karein
set namfile [open wired_traffic.nam w]
$ns namtrace-all $namfile
set tracefile [open wired_traffic.tr w]
$ns trace-all $tracefile

# Visual colors set karein
$ns color 1 Blue
$ns color 2 Red

# 3. 4 Nodes create karein
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]

# 4. Links establish karein (Bottleneck topology)
# Node0 -> Node1 (Access link: 10Mbps, 2ms)
# Node2 -> Node1 (Access link: 10Mbps, 2ms)
# Node1 -> Node3 (Shared bottleneck link: 1.5Mbps, 20ms, DropTail queue)
$ns duplex-link $n0 $n1 10Mb 2ms DropTail
$ns duplex-link $n2 $n1 10Mb 2ms DropTail
$ns duplex-link $n1 $n3 1.5Mb 20ms DropTail

# Queue limit define karein
$ns queue-limit $n1 $n3 20

# 5. Flow 1 Setup: TCP + FTP (Node0 se Node3)
set tcpAgent [new Agent/TCP]
$tcpAgent set fid_ 1
$ns attach-agent $n0 $tcpAgent

set sinkAgent [new Agent/TCPSink]
$ns attach-agent $n3 $sinkAgent

$ns connect $tcpAgent $sinkAgent

set ftpApp [new Application/FTP]
$ftpApp attach-agent $tcpAgent

# 6. Flow 2 Setup: UDP + CBR (Node2 se Node3)
set udpAgent [new Agent/UDP]
$udpAgent set fid_ 2
$ns attach-agent $n2 $udpAgent

set nullAgent [new Agent/Null]
$ns attach-agent $n3 $nullAgent

$ns connect $udpAgent $nullAgent

set cbrApp [new Application/Traffic/CBR]
$cbrApp attach-agent $udpAgent
$cbrApp set packetSize_ 1000
$cbrApp set rate_ 1Mb
$cbrApp set random_ false

# 7. Traffic timing schedule karein
$ns at 0.5 "$cbrApp start"
$ns at 1.0 "$ftpApp start"
$ns at 4.0 "$ftpApp stop"
$ns at 4.5 "$cbrApp stop"

# 8. Simulation termination
$ns at 5.0 "finish"

proc finish {} {
    global ns namfile tracefile
    $ns flush-trace
    close $namfile
    close $tracefile
    exit 0
}

$ns run

Execution ke baad trace file analyze karne ke liye Finish Procedure in NS-2 jarur follow karein.

Advertisement

NS-2 Queue Management Policies ka Comparison

Queue Policy Algorithm Mechanism Congestion Handling Use Case
DropTail (FIFO) First-In First-Out buffer; buffer bharte hi naye packets ko drop kar deta hai. Tail drop se global TCP synchronization ho sakti hai. Default baseline testing, simple router setups.
RED (Random Early Detection) Buffer bharne se pehle average queue length dekh kar randomly packets drop/mark karta hai. Proactive congestion notification; TCP flows ko pehle alert mil jata hai. High-performance modern core IP routers.
FQ (Fair Queueing) Alag-alag flows ko alag logical queues mein daal kar round-robin serve karta hai. Ek aggressive UDP flow doosre TCP flows ko starve nahi kar sakta. Quality of Service (QoS) guarantees.
SFQ (Stochastic Fair Queueing) Hash function use karke traffic ko multiple sub-queues mein randomly baant-ta hai. Low computational overhead ke sath fair bandwidth distribution. Edge routers aur traffic shapers.

NS-2 Trace File (wired_traffic.tr) mein Traffic Events samajhna

Traffic run hone par NS-2 ek comprehensive text trace log generate karta hai. Har line mein 12 columns hote hain:

+ 1.000000 0 1 tcp 1040 ------- 1 0.0 3.0 0 0
- 1.000000 0 1 tcp 1040 ------- 1 0.0 3.0 0 0
r 1.002832 0 1 tcp 1040 ------- 1 0.0 3.0 0 0
d 1.543200 1 3 cbr 1000 ------- 2 2.0 3.0 45 120
  • + (Enqueue): Packet link ki transmission queue mein add hua.
  • - (Dequeue): Packet queue se nikal kar physical wire par transmit hua.
  • r (Receive): Target node ne packet successfully receive kar liya.
  • d (Drop): Queue full hone ya error ke karan packet drop ho gaya.

Exam के लिए Important Questions

Short Questions

  1. NS-2 mein duplex-link command ke 5 mandatory arguments kaunse hain?
    Syntax: $ns duplex-link <node1> <node2> <bandwidth> <delay> <queue_type> (e.g., $node1 $node2 10Mb 10ms DropTail).
  2. CBR aur FTP traffic generators mein kya antar hai?
    CBR (Constant Bit Rate) fixed packet size aur fixed time interval par packets bhejta hai (UDP ke sath), jabki FTP dynamic variable window flow control follow karta hai (TCP ke sath).
  3. Agent/TCPSink aur Agent/Null mein kya antar hai?
    TCPSink incoming TCP packets receive karke sender ko ACKs wapas bhejta hai, jabki Null agent UDP packets ko silently absorb kar leta hai bina kisi response ke.
  4. Trace file mein 'd' event ka kya matlab hota hai?
    'd' ka matlab Packet Drop hota hai, jo router buffer queue full hone ya packet transmission fail hone par record hota hai.

Long Questions

  1. NS-2 mein wired links ke madhyam se traffic send karne ke complete mechanism ko layered architecture, agents aur application generators ke sath detail mein describe karein.
  2. Ek complete TCL script likhiye jismein 3-node topology ho, TCP/FTP aur UDP/CBR flows concurrent chal rahe hon, aur link failure ya bottleneck queue drop demonstrate ho raha ho.
  3. NS-2 mein prayukt hone wali alag-alag Queue Management Policies (DropTail, RED, Fair Queueing) ka comparative vishleshan kijiye.

Frequently Asked Questions (FAQs)

Q1: Kya hum bina connect command chalaye data send kar sakte hain?
Ans: Nahi, $ns connect $srcAgent $dstAgent call karna zaroori hai. Iske bina sender agent ka destination address aur port set nahi hota, isliye packets sahi receiving agent (TCPSink/Null) tak nahi pahunchte.

Q2: packetSize_ aur rate_ parameters kis application mein use hote hain?
Ans: Ye parameters Application/Traffic/CBR mein use hote hain jahan bytes mein packet size (e.g. 1000) aur data generation rate (e.g. 1Mb ya 512Kb) specify kiya jata hai.

Q3: fid_ (Flow ID) set karna kyu helpful hota hai?
Ans: $agent set fid_ 1 set karne se Network Animator (NAM) mein us flow ke packets alag-alag colors (Blue, Red) mein display hote hain jisse visual debugging aasan ho jaati hai.

Q4: Trace file se Throughput kaise calculate karte hain?
Ans: AWK script ya Python script se trace file mein se 'r' (receive) events filter kiye jaate hain, total received bytes count kiye jaate hain aur unhe total simulation time se divide kiya jata hai.

अक्सर पूछे जाने वाले प्रश्न (FAQs)

Quick Answer: Network Simulator 2 (NS-2) mein wired links ke madhyam se data traffic bhejne ke liye 4-step pipeline follow ki jaati hai: 1) Nodes create karke unke beech duplex-link establish karna, 2) Source node par transport agent (jaise Agent/TCP ya Agent/UDP) aur destination par receiving agent (Agent/TCPSink ya Agent/Null) attach karna, 3) Simulator mein $ns connect $src $dst call karna, aur 4) Transport agent ke upar traffic generator application (jaise Application/FTP ya Application/Traffic/CBR) bind karke start aur stop schedule karna.
Computer Network & Communication Notes in Hindi | कंप्यूटर नेटवर्किंग और कम्युनिकेशन नोट्स के पाठ्यक्रम में Sending Traffics Through NS2 Links in Hindi एक महत्वपूर्ण अध्याय है। यह मुख्य सिद्धांतों, परीक्षा प्रश्नों और सूत्रों को समझने के लिए अत्यधिक आवश्यक है।
हाँ, NotesMedia पर आपको Sending Traffics Through NS2 Links in Hindi के महत्वपूर्ण प्रश्नोत्तर, हल किए गए उदाहरण और नोट्स बिल्कुल मुफ्त मिलेंगे। अधिक अभ्यास के लिए आप हमारा ऐप भी डाउनलोड कर सकते हैं।
Advertisement

In this Chapter

Sending Traffics Through NS2 Links in Hindi
Auto Configuration Anycast in Hindi
Modified EUI-64 in Hindi | Modified EUI-64 क्या है?
Architecture of Mobile Computing in Hindi
Wireless LAN in Hindi | Wireless LAN क्या है?
Wireless User Devices in Hindi
MAC Protocol in Hindi | MAC प्रोटोकॉल क्या है?
IEEE 802.11 in Hindi | IEEE 802.11 क्या है
Mobile IP in Hindi | Mobile IP हिंदी में
Wireless TCP IP in Hindi
Unicast & Multicast Communication in Hindi
Bluetooth in Hindi | Bluetooth क्या है?
NS2 & NAM in Hindi | NS2 और NAM क्या है?
Purpose & installation of NS2 & NAM in Hindi
Background of NS2 & NAM in Hindi
Architecture of NS2 & NAM in Hindi
Interface of OTcl & C++ in Hindi
Trace Files & Formats in Hindi
Protocol Support of NS2 in Hindi
Simulation Object of NS2 & NAM in Hindi
Basic Syntax of NS2 & NAM in Hindi
Node Creation of NS2 & NAM in Hindi
Running NS2 & NAM in Hindi
Finish Procedure NS2 & NAM in Hindi
Invoking external commands within NS2 in Hindi
Nodes & Agents of NS2 & NAM in Hindi
NS2 Commands in Hindi
Creating Links in Wired Network in Hindi
Setting Link Parameters in Hindi
Routing Protocol Support of NS2 in Hindi
Scenarios in Hindi
Additional Parameters in Hindi
Setting node positions in Hindi
God object & topography in Hindi
Protocol Support in Hindi
Scenarios in Wireless Network in Hindi
Internet क्या है? Intranet और Extranet के बीच अंतर
इंटरनेट के प्रकार | Types of Internet in Hindi
OSI Model in Hindi - OSI मॉडल क्या है और इसकी लेयर हिंदी में
Computer Network (CN) All Important Questions and Answers in Hindi (MDSU)
BCA | Computer Network | 2025 Paper | MDSU Exam Paper
Importance of Layer Model in Hindi
Network Classification in Hindi
Network Topology in Hindi
Network Switching & Component in Hindi
Ethernet in Hindi
Token Ring in Hindi
Basic working & Cabling in Hindi
What is Computer in Hindi | कंप्यूटर क्या है?
Bridges in Hindi
Router in Hindi
Gateway in Hindi
Public & Private Network in Hindi
FDMA in Hindi
BCA | CN(Computer Network) Paper | MDSU 2023 Exam Paper
What is WWW in Hindi and Introduction of WWW
CDMA,SDMA,TDMA in Hindi
Personal communication system in Hindi | PCS क्या है
IPv4 in Hindi | IPv4 क्या है?
Subnetting IPv4 address in Hindi
Casting in Hindi | कास्टिंग हिंदी में
Private IPv4 Addressing in Hindi
IPv4 Address Scheme in Hindi
IPv6 Addressing Scheme in Hindi
Types of IPv6 Addressing in Hindi