network_simulation.tcl
Create a simulator object
set ns [new Simulator]
Create two nodes (node1 and node2)
set node1 [ns node]
Create a link between the nodes with bandwidth, delay, and queue size
node1 $node2 1Mb 10ms DropTail
Create a TCP connection from node1 to node2
set tcp [new Agent/TCP]
node1 $tcp
Create a sink (receiver) on node2
set sink [new Agent/TCPSink]
node2 $sink
Set up a TCP connection between the nodes
tcp $sink
Set the start and stop times for the simulation
tcp ns at 5.0 "finish"
Run the simulation
$ns run
Define the traffic pattern (for example, a simple TCP flow)
proc start-traffic {tcp sink} {
$tcp send 1000
}