How to Start Exterior Gateway Protocol Projects Using NS2
To stimulate an Exterior Gateway Protocol (EGP) project in NS2 (Network Simulator 2) has includes the replicating of routing protocols used among the various autonomous systems (ASes). Sample has involves the BGP (Border Gateway Protocol), the de facto EGP used on the Internet. Here’s a structured guide to help you start:
Steps to Start Exterior Gateway Protocol Projects Using NS2
- Understand EGP and NS2 Capabilities
- Exterior Gateway Protocol Overview:
- EGPs are used to modify the routing information among the autonomous systems (ASes).
- BGP (Border Gateway Protocol) is the most general for EGP and helps the path-vector routing.
- NS2 Features:
- NS2 does not have built-in help for BGP; nevertheless it can be replicate the routing behavior by custom execution or through extending the previous protocols.
- It helps for the AS-level routing replication through extensions.
- Set up Your Environment
- Install NS2:
sudo apt-get install ns2
- Validate the NS2 installation by a simple sample:
ns example.tcl
- Define the Project Scope
- Objective Examples:
- Replicate the routing among several ASes using a BGP-like protocol.
- Examine the performance of EGP routing in dynamic environment for sample AS failures or changes.
- Associate the EGP for internal routing protocols such as RIP or OSPF.
- Scenarios:
- Replicate the AS-level routing in a multi-domain network.
- Launch the failures and estimate the route convergence.
- Design the Network Topology
- Topology Elements:
- Nodes: Signify the ASes or routers in ASes.
- Links: Replicate inter-AS connections through detailed the bandwidth and delay.
- Example Topology:
- The network by 3 ASes, in which every AS is linked at least one other AS.
- Implement EGP in NS2
- Option 1: Extend NS2 for BGP
- Create a custom BGP-like behavior using NS2’s routing agent classes.
- Execute the path-vector routing logic, AS path advertisement, and policy enforcement.
- Option 2: Use Simplified Simulation
- Replicate the EGP-like behavior by alter the congestion forwarding a rules and extensions.
Example TCL Script for EGP Simulation:
# Initialize the simulator
set ns [new Simulator]
# Open trace and NAM files
set tracefile [open egp_trace.tr w]
$ns trace-all $tracefile
set namfile [open egp_simulation.nam w]
$ns namtrace-all $namfile
# Create nodes for three ASes
set AS1_router [$ns node]
set AS2_router [$ns node]
set AS3_router [$ns node]
# Connect AS routers
$ns duplex-link $AS1_router $AS2_router 1Mb 10ms DropTail
$ns duplex-link $AS2_router $AS3_router 1Mb 10ms DropTail
$ns duplex-link $AS3_router $AS1_router 1Mb 10ms DropTail
# Configure custom EGP behavior
proc advertise_routes {node src dest} {
puts “Advertising routes from $src to $dest via $node”
}
# Simulate AS path advertisement
$ns at 1.0 “advertise_routes $AS1_router AS1 AS2”
$ns at 2.0 “advertise_routes $AS2_router AS2 AS3”
$ns at 3.0 “advertise_routes $AS3_router AS3 AS1”
# Add traffic between ASes
set tcp [new Agent/TCP]
set sink [new Agent/TCPSink]
$ns attach-agent $AS1_router $tcp
$ns attach-agent $AS3_router $sink
$ns connect $tcp $sink
# Traffic generation
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 4.0 “$ftp start”
$ns at 10.0 “$ftp stop”
# Terminate simulation
$ns at 15.0 “finish”
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam egp_simulation.nam &
exit 0
}
$ns run
- Simulate Network Dynamics
- Link Failures: Replicate inter-AS connection failures and validate the route convergence.
$ns rtmodel-at 5.0 down $AS1_router $AS2_router
$ns rtmodel-at 7.0 up $AS1_router $AS2_router
- Traffic Patterns: Establish for several congestion flows and estimate the EGP scalability.
- Run the Simulation
- Implement the TCL script:
ns egp_simulation.tcl
- Envision for the network using NAM:
nam egp_simulation.nam
- Analyze Performance
- Excerpt the parameter metrics from the trace file (egp_trace.tr):
- Convergence Time: The convergences are takes the duration for routes to stabilize after a variation.
- Packet Delivery Ratio (PDR): Ratio for achieved the delivered packets in PDR.
- Routing Overhead: Number of control messages is modifying the routing overhead.
Example AWK Script for Packet Delivery Ratio:
BEGIN {sent=0; received=0;}
{
if ($1 == “s” && $4 == “TCP”) {
sent++;
} else if ($1 == “r” && $4 == “TCP”) {
received++;
}
}
END {
print “Packet Delivery Ratio:”, received/sent;
}
- Extend EGP Functionality
- Route Policies: Execute the route filtering and give precedence to AS policies.
- Path Optimization: Replicate the several path selection criteria for sample shortest path, lowest cost.
- Security: Enhance the authentication or encode for BGP-like message modification.
- Document the Project
- Include:
- It starts with objectives and problem statement.
- After process the problem statement based on the Network topology and setting.
- Then process gives the simulation results for sample graphs and tables.
- Finally it provides the observations and recommendations.
Finally, we discussed here about how to integrate the Exterior Gateway Protocol Projects in ns2 environment detailed and also we provide simulation results based on modify routing. If more queries arise we will explain another manual.