How to Start Interior Protocol Projects Using NS2
To create an Interior Gateway Protocol (IGP) project using NS2 (Network Simulator 2) has includes the replicating of routing in autonomous system (AS). IGP protocols like as RIP (Routing Information Protocol), OSPF (Open Shortest Path First), and EIGRP (Enhanced Interior Gateway Routing Protocol) fall below this category. Here’s a detailed step-by-step guide:
Steps to Start Interior Protocol Projects Using NS2
- Understand Interior Gateway Protocols and NS2 Capabilities
- Interior Gateway Protocol (IGP):
- Used for routing in a single AS.
- Examples: RIP (distance-vector), OSPF (link-state), EIGRP (hybrid).
- NS2 Features:
- The ns2 Built-in helps for certain IGP protocols such as RIP.
- Extendable for replicate the OSPF or EIGRP by custom execution or external modules.
- Set Up Your Environment
- Install NS2:
sudo apt-get install ns2
- Validate the installation through process for a simple sample:
ns example.tcl
- Define the Project Scope
- Objectives:
- Replicate the routing in AS using the IGP protocol.
- Estimate the parameter metrics such as packet delivery ratio, routing overhead, and convergence time.
- Associate the performance with several IGPs for sample RIP vs OSPF.
- Examples:
- Dynamic network topology is a RIP.
- OSPF in a large-scale network.
- Validate the routing performance below connection failures or high traffic loads.
- Design the Network Topology
- Topology Elements:
- Nodes: Signify the routers or hosts in the AS.
- Links: Explain the connectivity among nodes.
- Example Topology:
- The topology has includes the ten routers forming a mesh or hierarchical structure.
- Implement the Protocol in NS2
- Option 1: Use Built-in Support
- Use the built-in help for RIP in NS2.
- OSPF and EIGRP need the custom execution or extensions.
- Option 2: Extend NS2
- Write the alter modules in C++ for protocols such as OSPF or EIGRP.
- Use the NS2 for external collection or extensions the beneficial protocol replication.
Example TCL Script for RIP Simulation:
# Initialize the simulator
set ns [new Simulator]
# Define trace and NAM files
set tracefile [open igp_trace.tr w]
$ns trace-all $tracefile
set namfile [open igp_simulation.nam w]
$ns namtrace-all $namfile
# Create nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
# Connect nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
$ns duplex-link $n2 $n3 1Mb 10ms DropTail
$ns duplex-link $n3 $n4 1Mb 10ms DropTail
$ns duplex-link $n0 $n4 1Mb 10ms DropTail
# Configure routing protocol
$ns rtproto RIP
# Define traffic
set udp [new Agent/UDP]
$ns attach-agent $n0 $udp
set null [new Agent/Null]
$ns attach-agent $n4 $null
$ns connect $udp $null
# Traffic generation
set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 512
$cbr set interval_ 0.1
$cbr attach-agent $udp
$ns at 1.0 “$cbr start”
$ns at 10.0 “$cbr stop”
# Terminate simulation
$ns at 15.0 “finish”
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam igp_simulation.nam &
exit 0
}
$ns run
- Extend the Simulation for OSPF or EIGRP
- OSPF: Implement link-state advertisements (LSAs) and Dijkstra’s algorithm.
- EIGRP: Encompass the NS2 has involves the structures such as dual distance-vector logic and unequal-cost load balancing.
- Simulate Network Dynamics
- Link Failures: Validate the routing convergence when connections are go down:
$ns rtmodel-at 5.0 down $n1 $n2
$ns rtmodel-at 7.0 up $n1 $n2
- Traffic Variation: Establish the different loads of congestion and validate the protocol effectiveness.
- Run the Simulation
- Implement the TCL script:
ns igp_simulation.tcl
- Visualize the simulation using NAM:
nam igp_simulation.nam
- Analyze Performance Metrics
- Excerpt the metrics from the trace file (igp_trace.tr):
- Packet Delivery Ratio (PDR): Ratio of packets achieved for the delivered in a PDR.
- Routing Overhead: Number of control messages altered in the routing overhead.
- Convergence Time: Duration for the network and stabilize in modify the topology.
Example AWK Script for PDR:
BEGIN {sent=0; received=0;}
{
if ($1 == “s” && $4 == “UDP”) {
sent++;
} else if ($1 == “r” && $4 == “UDP”) {
received++;
}
}
END {
print “Packet Delivery Ratio:”, received/sent;
}
- Enhance the Protocol
- Security: Improve encode or validation to routing bring up-to-date.
- QoS: Encompass the protocol to prioritize the congestion detailed for sample VoIP.
- Energy Efficiency: Estimate the IGP performance in energy-constrained networks such as IoT.
- Document Your Project
- Include:
- It prepares the first with objectives and problem statement.
- After the problem based process in network topology and configurations.
- Then gives the performance based on Simulation results for instance graphs and tables.
- Finally it observations and recommendations.
We demonstrate how the Interior Gateway Protocol (IGP) using the ns2 tool that has define and state the network topology and generate the custom modules then observe the data rate and finally compute the Interior Gateway Protocol (IGP). In case more queries needed we will use another manual.