How to Simulate Non Adaptive Routing Projects Using NS2

To simulate non-adaptive routing projects utilizing NS2, we would concentrate on a routing protocol in which the routing decisions are predetermined and do not modify according to the current network conditions such as link failures, congestion, or changing traffic patterns. Non-adaptive routing is also called as static routing in which paths are predefined and do not fine-tune dynamically.

Steps to Simulate Non-Adaptive (Static) Routing in NS2

  1. Install NS2

If NS2 is not already installed on the computer then we download it from the NS2 Official Website and install it.

  1. Create a TCL Script for Non-Adaptive Routing

In a non-adaptive routing configuration, the routing paths among the nodes are manually described and remain fixed all over the simulation. The following instance displays how to configure a basic network with static routes.

Example TCL Script for Non-Adaptive (Static) Routing:

# Create a new simulator instance

set ns [new Simulator]

# Define trace and NAM files for analysis and visualization

set tracefile [open “non_adaptive_trace.tr” w]

set namfile [open “non_adaptive_simulation.nam” w]

$ns trace-all $tracefile

$ns namtrace-all $namfile

# Create nodes in the network

set n0 [$ns node]

set n1 [$ns node]

set n2 [$ns node]

set n3 [$ns node]

set n4 [$ns node]

# Define links between nodes with bandwidth and delay (these links are static)

$ns duplex-link $n0 $n1 1Mb 10ms DropTail

$ns duplex-link $n1 $n2 1Mb 20ms DropTail

$ns duplex-link $n2 $n3 1Mb 30ms DropTail

$ns duplex-link $n3 $n4 1Mb 10ms DropTail

$ns duplex-link $n0 $n2 1Mb 25ms DropTail

$ns duplex-link $n1 $n3 1Mb 15ms DropTail

# Set up static routes manually (non-adaptive)

$n0 rtproto Static

$n1 rtproto Static

$n2 rtproto Static

$n3 rtproto Static

$n4 rtproto Static

# Define manual routes (these are static, non-adaptive)

$n0 add-route-to 3 1

$n1 add-route-to 4 2

$n2 add-route-to 0 1

$n3 add-route-to 4 1

$n4 add-route-to 1 3

# Create UDP agents for sending and receiving traffic

set udp0 [new Agent/UDP]

set udp1 [new Agent/UDP]

# Attach the UDP agents to nodes

$ns attach-agent $n0 $udp0

$ns attach-agent $n4 $udp1

# Create a Constant Bit Rate (CBR) traffic generator and attach it to the source node

set cbr0 [new Application/Traffic/CBR]

$cbr0 set packetSize_ 512

$cbr0 set rate_ 1Mb

$cbr0 attach-agent $udp0

# Connect the UDP agents between the source (n0) and destination (n4)

$ns connect $udp0 $udp1

# Schedule the traffic flow

$ns at 1.0 “$cbr0 start”

$ns at 4.5 “$cbr0 stop”

# Set up the finish procedure

proc finish {} {

global ns tracefile namfile

$ns flush-trace

close $tracefile

close $namfile

exit 0

}

# End the simulation at 5.0 seconds

$ns at 5.0 “finish”

# Run the simulation

$ns run

  1. Run the Simulation

We can save the script as non_adaptive_simulation.tcl and execute it in NS2:

ns non_adaptive_simulation.tcl

  1. Visualize the Simulation Using NAM

We can open the generated .nam file within the Network Animator (NAM) tool to envision the static routing behavior:

nam non_adaptive_simulation.nam

  1. Analyze the Trace File

The trace file (non_adaptive_trace.tr) will encompass details of the packet transmissions that we can investigate to:

  • Check that the routing paths remain fixed throughout the simulation.
  • Calculate the performance parameters like packet delivery ratio, end-to-end delay, and throughput.
  • Verify that the routing decisions do not alter even when there are alternative paths is obtainable.
  1. Modify the Simulation
  • Change Static Routes: We can manually describe diverse static routes by modifying the add-route-to commands.
  • Link Failures: Replicate link failures and monitor that non-adaptive routing will not change the path (unlike dynamic/adaptive routing).
  • Traffic Patterns: Insert more traffic flows among distinct node pairs to monitor how non-adaptive routing manages several routes.

Optional Enhancements:

  • Comparison with Adaptive Routing: Replicate dynamic routing protocols like AODV or OSPF autonomously to compare the performance of non-adaptive against the adaptive routing.
  • Large-Scale Topologies: Prolong the network topology to contain additional nodes and routes, and observe how non-adaptive routing manages more complex networks.
  • Congestion Scenarios: Launch congestion on specific links and monitor how non-adaptive routing performs under high-traffic conditions.

In this manual, you will obtain and improve your knowledge on how to approach and replicate the Non-Adaptive (static) routing projects, which were executed and evaluated in NS2 environment. More details will be offered later. To receive expert simulation assistance for your Non-Adaptive Routing Projects, simply provide us with the project details. Our specialists at phdprime.com are equipped to address current network conditions, including link failures, congestion, and evolving traffic patterns, ensuring you receive the most relevant support for your projects.

Opening Time

9:00am

Lunch Time

12:30pm

Break Time

4:00pm

Closing Time

6:30pm

  • award1
  • award2