Wired Networks
In this post:
Introduction to Wired Networks
Tcl scripts for various wired networks
Wired networks are easier to set up as they need a physical link between the nodes and hence they form a network by having a duplex or simplex link. Also, we have seen an example of a two-node network in Chapter 1 that shows how to connect two nodes in a network with a duplex link.
This chapter tells about the various wired networks supported in ns2 and provides examples to showcase these networks.
This wiredexample sets the shape for the nodes and also sets labels for the nodes. Each node can be differentiated using labels like client, server. Etc. There are 3 shapes supported by NS2, they are hexagon, square and circle. Once the shape is fixed, the shape can't be changed during the simulation.
$node shape hexagon
Also, the nodes can be colored using the colouring values; there are so many colours supported by n,s and some of them are blue, red, green, orange, magenta, etc.
$node color name
The following examples depict three nodes that are either colored, shaped and labelled. The following network does not have any traffic generation or simulation. Its just informs the attributes of the node.
Sometimes the node can be marked with a colour and a shape with a name. The syntax is
$node add-mark name color shape
The above listing just shows two clients and a server and there was no traffic and it is just to create a topology and Fig 4.1 shows this
Fig 4.1 – A simple Wired network with three nodes
Tcp Source and the Sink Agent
This example shows the simple Tcp with FTP Traffic. Since in wired networks, Tcp is a connection oriented transport protocol which needs an acknowledgment for every packet it sents. The following network shows that. There are 4 nodes, and two nodes are exchanging packets between them and an intermediate node is forwarding the packet to the destination node. The performance characteristics of this network is analysed in the next section.
The C++ source code relevant to Tcp is available in the ~ns-2.35/tcp/tcp.cc. Also it involves various parameters during the simulation like congestion window, duplicate acknowledgement, and sequence no, etc.
Also this network used a FTP (File Transfer Protocol) for the traffic.
Fig 4.2 – A Wired network with Four nodes with FTP Traffic
The Listing 4.2 shows a simple wired network with four nodes that just involves in a FTP Traffic. The Fig 4.2 shows this.
Wired network with various traffic
NS supports various traffic that may be employed in Tcl scripts to test. Some examples are
CBR Traffic
FTP Traffic
Exponential Traffic
Telnet Traffic
SMTP
These traffic can be simulated in TCP or UDP Agents.
The following Listing depicts these traffics. For example, SMTP (Simple Mail Transfer protocol) traffic is more like exponential traffic and this can be simulated using Application/Traffic/Exponential.
Fig 4.3 – Wired network with CBR, SMTP, Telnet and FTP Traffic
The Listing 4.3 shows some new things in ns, they are
Different applications like
FTP Traffic - Application/FTP
CBR Traffic - Application/Traffic/CBR
SMTP Traffic - Application/Traffic/Exponential
Telnet Traffic - Application/Telnet
This script uses the trace-annotate command that uses to display string during the animation as shown in Fig 4.3
This script also uses procedure with parameters. Four procedures were used with two parameters as the node names.
Also node creation is done using For loop and the nodes are named as array values. Ex. node0, node1, etc.
Printing the properties of Tcp Reno Agent
The following listing prints the congestion window of the TcpReno agent and plots it using xgraph. Xgraph is third party software that comes with the ns allinone package.
Congestion window size is a major factor in predicting the performance of a TCP Network. NS2 handles the Congestion window using a variable cwnd_ and it can be printed to a graph and as well printed as values at various intervals of time.
The following Tcl script will let you understand the working of the network (TCP Reno Protocol) and also helps you in plotting the characteristics of Congestion window value.
Fig 4.4 – Congestion window of a Tcp Reno Agent
Listing 4.4 has the facility of printing the congestion window in a graph and Figure 4.4 shows this. As in Fig 4.4, the congestion window is initially at a value of 1 and increases periodically over a period of time.
Listing 4.5 uses the following:
There are total of 11 nodes, 8 client nodes and 3 router nodes
The links are colored
All the nodes were labelled
They use TCP Agents with FTP Flow with altered parameters like packetSize_, maximum congestion window specification, rate of transfer and flow id.
The script uses the set_flow_id and raw2xg_sctp binaries provided by ns2, and it uses Perl script to plot the characteristics of data sent, data drop etc.
The Network Animation window and the related graphs are shown below.
The following figure shows the data sent, forwarded, received and dropped at all the links. The graph shows green color as dense dots as data generation is huge compared to the data forwarded, received or lost.
Conclusion:
This chapter shows the packet types, agents, and applications used in various wired protocols. Most of them are unicast routing, and multicast routing is discussed in detail in Chapter 10.
Comments
Post a Comment