NS2 – Wired Networks – Sample Source Code

Wired Network Setup
NS2 includes the components for creation of wired network such as nodes, link of simplex and duplex type. Each link is configured with the parameters such as bandwidth, propagation delay and queue type. Packet limits of the queue can be mentioned. Data communication between nodes is configured with transport and application layer agents that are required to be attached to both sender and receiver nodes.

Protocols and Configuration parameters
Transport layer agents are TCP and its variants, TCPSink, SCTP, XCP, UDP, NULL, and LossMonitor. Application layer agents are CBR, FTP, ExponentialTraffic, ParetoTraffic, RealAudio, Video traffic and they have the options for packet size, data rate, data transmission interval, start and stop time of data transmission. Routing protocols such as RLM (Receiver-driven Layered Multicast) protocol, DV (Distance Vector), LS (Link State) routing protocol are applied in routing layer.

Wired Network Scenarios
Various wired network scenarios such as congestion, link failure, link recovery and attacks can be created dynamically at different instances of the simulation period with event-driven simulation capability of NS2.

Animation of Wired Network
Regarding the animation of wired network, it supports the labeling, coloring and shape of the nodes for differentiation. Similarly, links and packets can be shown with different colors. Orientation of nodes in the network topology can be mentioned in TCL script. It is also possible to drag and drop the nodes in NAM tool to view the network in a desired topological manner. Packets stored in the queue and packet drop can be viewed during animation. Properties of the packets and links can be seen if the links and packets are clicked in NAM. Ongoing network process can be annotated using trace annotate option and it will be displayed at the bottom of network animation window.

Trace file and AWK script for Wired Network

Trace file generated at the end of simulation follows a specific format for wired network that includes event type, time, nodes involved in it, and data specifications. It can be processed using the wired network specific AWK scripts for performance analysis.