How to Implement Network Internet Governance in NS2
To implement the Network Internet Governance in NS2 required us to simulate policies, rules and control mechanisms that control how the internet performs. Since NS2 is mainly a network simulator, governance characteristics like access control, traffic management, Quality of service (QoS), resource allocation and security measures can be prototyped by using various network set ups, routing mechanisms and traffic shaping strategies. This manual shows the details on how to govern the internet using ns2:
Step-by-Step Implementation:
Key Aspects of Internet Governance that Can Be Simulated in NS2:
- Access Control: Who can access particular network resources like specific servers or nodes, and under what conditions.
- Traffic Management: Preferring, shaping, or throttling traffic in terms of governance policies (for instance: net neutrality or traffic prioritization).
- Quality of Service (QoS): Making certain that particular kinds of traffic (such as video, voice) have guaranteed performance and bandwidth.
- Resource Allocation: Regulating the distribution of network resources (bandwidth, queue sizes) to various users or applications.
- Security Policies: Execution encryption, firewalls, or policies to limit unauthorized access or mischievous activities.
- Simulating Access Control Policy in NS2
We will replicate a network where only legal users are permitted to access a server, and unauthorized users are limited. This simulates governance policies like access control and network restrictions.
Example TCL Script for Access Control Policy:
# Create a new simulator instance
set ns [new Simulator]
# Define output trace file for logging events
set tracefile [open access_control.tr w]
$ns trace-all $tracefile
# Define the animation file for NAM (optional)
set namfile [open access_control.nam w]
$ns namtrace-all $namfile
# Create network nodes (3 users and 1 server)
set user1 [$ns node]
set user2 [$ns node]
set unauthorized_user [$ns node]
set server [$ns node]
# Create duplex links between users and the server
$ns duplex-link $user1 $server 10Mb 10ms DropTail
$ns duplex-link $user2 $server 10Mb 10ms DropTail
$ns duplex-link $unauthorized_user $server 10Mb 10ms DropTail
# Define TCP agents for the authorized users (user1 and user2)
set tcp_user1 [new Agent/TCP]
$ns attach-agent $user1 $tcp_user1
set tcp_user2 [new Agent/TCP]
$ns attach-agent $user2 $tcp_user2
# Define TCP Sink agent for the server
set sink [new Agent/TCPSink]
$ns attach-agent $server $sink
# Connect TCP agents for the authorized users to the server
$ns connect $tcp_user1 $sink
$ns connect $tcp_user2 $sink
# Define FTP applications to generate traffic from user1 and user2 to the server
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp_user1
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp_user2
# Schedule the FTP traffic for the authorized users
$ns at 0.5 “$ftp1 start”
$ns at 1.0 “$ftp2 start”
# Access control policy: unauthorized_user is not allowed to connect to the server
# We do not connect the unauthorized user to the server, simulating the denial of access
# Define a TCP agent for the unauthorized user
set tcp_unauthorized [new Agent/TCP]
$ns attach-agent $unauthorized_user $tcp_unauthorized
# Define an FTP application for the unauthorized user (attempting to connect)
set ftp_unauthorized [new Application/FTP]
$ftp_unauthorized attach-agent $tcp_unauthorized
# Start the unauthorized traffic, but it won’t be connected to the server
$ns at 1.5 “$ftp_unauthorized start”
# Schedule the end of the simulation
$ns at 3.0 “finish”
# Finish procedure to close trace files and run NAM visualization
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam access_control.nam &
exit 0
}
# Run the simulation
$ns run
Explanation of the Script:
- Network Topology:
- Three users (user1, user2, unauthorized_user) and one server are designed. Links are accomplished amongst all users and the server.
- Access Control:
- User1 and User2 are granted to access the server, so their TCP agents are linked to the server.
- Unauthorized_user is not permitted access, so while traffic is developed from this user, it is not linked to the server, replicated an access control policy where the user is denied access.
- Traffic Generation:
- FTP traffic is produced from User1 and User2 to the server, while unauthorized_user generates traffic that is congested.
- Outcome:
- The trace file (access_control.tr) will show that only User1 and User2 are able to transfer and receive packets, while unauthorized_user‘s packets are not sent.
- Simulating Traffic Management and Net Neutrality
In internet governance, net neutrality states to the principle that all internet traffic should be treated equally deprived of prioritization. Yet, in some cases, traffic management policies prefer special types of traffic like video or voice, over others.
Example TCL Script for Traffic Prioritization:
# Create a new simulator instance
set ns [new Simulator]
# Define output trace file
set tracefile [open traffic_management.tr w]
$ns trace-all $tracefile
# Define the animation file (optional)
set namfile [open traffic_management.nam w]
$ns namtrace-all $namfile
# Create network nodes (users and ISP)
set user1 [$ns node] # Video streaming user
set user2 [$ns node] # Web browsing user
set isp [$ns node] # ISP node
set server [$ns node] # Content server
# Create duplex links between users and ISP, and ISP to the server
$ns duplex-link $user1 $isp 10Mb 10ms DropTail
$ns duplex-link $user2 $isp 5Mb 20ms DropTail
$ns duplex-link $isp $server 15Mb 10ms DropTail
# Define UDP agent for video streaming traffic (User1)
set udp_stream [new Agent/UDP]
$ns attach-agent $user1 $udp_stream
# Define TCP agent for web browsing traffic (User2)
set tcp_browse [new Agent/TCP]
$ns attach-agent $user2 $tcp_browse
# Define Null agent as the sink at the server (for both types of traffic)
set null_sink [new Agent/Null]
$ns attach-agent $server $null_sink
# Connect the agents to the server
$ns connect $udp_stream $null_sink
$ns connect $tcp_browse $null_sink
# Define CBR traffic for video streaming (User1) and FTP for web browsing (User2)
set video_stream [new Application/Traffic/CBR]
$video_stream attach-agent $udp_stream
$video_stream set packetSize_ 1000 # Large packets for video streaming
$video_stream set rate_ 8Mb # Higher rate for video streaming
set ftp_browse [new Application/FTP]
$ftp_browse attach-agent $tcp_browse
# Schedule the traffic flows
$ns at 0.5 “$video_stream start” # Video streaming starts first
$ns at 1.0 “$ftp_browse start” # Web browsing starts later
# End the simulation at 3.0 seconds
$ns at 3.0 “finish”
# Define finish procedure to close trace files and run NAM
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam traffic_management.nam &
exit 0
}
# Run the simulation
$ns run
Explanation of the Script:
- Traffic Management:
- User1 sends video streaming traffic (UDP with a higher rate of 8Mb).
- User2 sends web browsing traffic (TCP with a lower rate).
- Net Neutrality:
- This script mimics a situation where video streaming is preferred over web browsing traffic, reflecting a violation of net neutrality.
- Outcome:
- The trace file will display that User1’s video streaming traffic utilizes more bandwidth, capably starving User2’s web browsing traffic, violating net neutrality principles.
- Simulating Security Policies and Resource Allocation
In addition to access control and traffic management, internet governance encompasses securing the network and handling resources. You can imitate firewalls, encryption, or prioritization according to the security measures or user profiles.
We were successfully accomplished the Network Internet Governance by simulating Access Control Policy, Security mechanisms and Resource allocation into the ns2 environment. We also showcased the brief details for it including examples with snippet codes in the approach.
For implementing Internet governance in the NS2 tool, connect with us for top-notch guidance. Our team is fully equipped to provide you with excellent support and timely delivery.