How to Start Classful Protocol Projects Using NS2
To start Classful routing protocols using NSW which is functioning deprived of sending subnet mask data within routing updates such as RIP (Routing Information Protocol) and IGRP (Interior Gateway Routing Protocol). NS2 is directly supports for RIP through executions of routing table updates, but we will want to prolong or replicate the behaviours of certain classful protocol. Below is a simple strategy to get started a classful protocol project using NS2:
Steps to Start Classful Protocol Projects in NS2
- Understand Classful Protocols
Following is classful protocols’ crucial features:
- Fixed Subnet Boundaries: Classful protocols don’t directly support for Variable Length Subnet Masking (VLSM).
- Default Network Classes:
- Class A: 0.0.0.0 to 127.255.255.255
- Class B: 128.0.0.0 to 191.255.255.255
- Class C: 192.0.0.0 to 223.255.255.255
- Subnet Mask Assumptions: Subnet masks are extrapolated from the IP address.
- Limitations:
- Ineffective use of IP address space which is a restriction of classful protocol.
- It cannot manage the irregular subnets.
- Define Your Project Goals
We can describe the project objectives like:
- Simulate Classful Protocol Behavior:
- Estimate the routing protocols behaviour in classful addressing.
- Performance Analysis:
- We will need to equate the classful and classless protocols effectiveness.
- Protocol Extension:
- Fine-tune a classful protocol for extension, integrating the support for classless routing.
- Scenario Analysis:
- Experiment the RIP or IGRP in certain scenarios like large or fragmented networks for analysis.
- Set Up NS2
- Install NS2:
- We can set up NS2 using NS2.35 on suitable OS like Linux for compatibility.
- Verify Installation:
- Execute a simple simulation, verifying the installation to make sure that it installed properly.
- Implement Classful Protocol Behavior
While NS2 doesn’t directly support for distinguish among the classful and classless routing using protocols such as RIP but we need to replicate the behaviour of classful by means of limiting subnet mask exchanges or to apply the predefined subnets.
Example: Classful RIP Simulation
- Set Up the Network Topology:
- Make a network topology with RIP which is a routing protocol:
set ns [new Simulator]
# Define trace and animation files
set tracefile [open classful_rip.tr w]
$ns trace-all $tracefile
set namfile [open classful_rip.nam w]
$ns namtrace-all $namfile
# Create nodes
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
# Create links between nodes
$ns duplex-link $n1 $n2 2Mb 10ms DropTail
$ns duplex-link $n2 $n3 2Mb 10ms DropTail
- Configure RIP:
- Configure RIP that is a routing protocol:
set val(rp) RIP ;# Specify RIP as the routing protocol
- Define Classful Subnet Behavior:
- Make use of pre-defined IP classes and limit the usage of VLSM for describing the behavior of classful subnet:
$n1 set addr_ 10.0.0.1 ;# Class A
$n2 set addr_ 172.16.0.1 ;# Class B
$n3 set addr_ 192.168.0.1 ;# Class C
- Add Traffic Sources:
- We can integrate the traffic sources like UDP or TCP for replicating data exchange:
set udp [new Agent/UDP]
$ns attach-agent $n1 $udp
set null [new Agent/Null]
$ns attach-agent $n3 $null
$ns connect $udp $null
set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 512
$cbr set interval_ 0.1
$cbr attach-agent $udp
- Run the Simulation:
- Now, we will want to compile the project and execute the simulation using following command line:
$ns at 50.0 “finish”
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam classful_rip.nam &
exit 0
}
$ns run
- Analyze Results
Measure the behavior of the protocol to apply the trace file as classful_rip.tr.
Metrics to Evaluate:
- Routing Overhead:
- Measure the volume of RIP updates that are transmitted for routing overhead in the course of the simulation:
awk ‘{if ($7 == “RIP”) count++} END {print “Routing Overhead:”, count}’ classful_rip.tr
- Packet Delivery Ratio (PDR):
- Compute the rate of packets, which are effectively distributed:
awk ‘{if ($1 == “r” && $4 == “AGT”) recd++; if ($1 == “s” && $4 == “AGT”) sent++} END {print “PDR:”, recd/sent*100 “%”}’ classful_rip.tr
- Delay:
- We can examine the delays that are launched with the support of routing.
- Routing Table Efficiency:
- Verify routing table updates for redundant or unused routes by reason of the classful mechanisms.
- Extend the Project
Example: Implement Classful IGRP
IGRP isn’t contained within NS2 environment thus we can prolong it by way of altering the NS2 source code.
- Add IGRP Packets:
- Fine-tune packets as packet.h for describing the IGRP packet structures:
struct hdr_igrp {
int metric;
int delay;
// Other IGRP fields
};
- Implement IGRP Logic:
- Integrate the IGRP routing logic within rtproto.cc or we can make a new protocol file.
- Recompile NS2:
- After topology changes, we can recompile the NS2:
make clean
make
- Compare Classful vs. Classless Protocols
- Replicate the classless protocols such as RIP including VLSM or OSPF.
- We can equate the following metrics:
- Efficiency in handling disjoints subnets.
- Convergence time.
- Routing overhead.
- Scalability in large networks.
- Document Your Work
It has detailed insights that contain:
- Define clear project goals and problem definition.
- Specify the simulation setup and configurations.
- Assess the simulation outcomes and performance analysis.
- Finally, it offers conclusions.
Example Project Ideas
- Performance Comparison of Classful vs. Classless Protocols:
- We will need to equate the RIP (classful) including OSPF (classless) such as scalability and efficiency.
- Classful Protocol Optimization:
- Prolong the classful protocol RIP for minimizing overhead within dense networks.
- Scenario Analysis:
- Experiment the classful protocols within fragmented or discontinuous subnet scenarios for analysis.
- Classful Routing in IoT:
- Replicate the classful routing protocols RIP or IGRP for IoT networks and examine the performance.
- Security in Classful Protocols:
- Integrate the basic RIP verification for secured routing updates within classful protocols.
This manual contains detailed simulation process and more insights with sample coding for replicating and analysing the Classful Protocol Projects using NS2 environment. We can also provide advanced project ideas and extension process of this protocol in NS2 as required.