Computer Networks Record
Computer Networks Record
RECORD NOTE
Name : …………………………………………..
Branch : ……………………………………………..
BONAFIDE CERTIFICATE
Certified that this is the Bonafide record of work done by Mr /
Miss……………………………………………………………..
Reg.No……………………….………. of ................................................................ Sem /
………. Year Department ....................................................................... in
Submitted for the Anna University Practical Examination held at, Arifa
Institute of Technology, Esanoor, on ………………………..
TOTAL MARKS
AVERAGE MARKS
AIM:
To Write the java program for simulating ping and traceout command
ALGORITHM:
import java.io.*;
import java.net.*;
class pingserver
try
String str;
InputStreamReader(System.in));
String ip=buf1.readLine();
Runtime H=Runtime.getRuntime();
InputStream in=p.getInputStream();
InputStreamReader(in));
while((str=buf2.readLine())!=null)
}
}
OUTPUT:
Minimum=1
ms,maximum=4ms,average=2ms
PROGRAM:-TRACEOUT
import java.io.*;
import java.net.*;
import java.lang.*;
class Traceroute
{
public static void main(String args[]){
BufferedReader in;
try{
Runtime r = Runtime.getRuntime();
Process p = r.exec("tracert www.google.com");
in=new BufferedReader(newInputStreamReader(p.getInputStream());
String line;
if(p==null)
System.out.println("could not connect");
while((line=in.readLine())!=null){
System.out.println(line);
//in.close();
}
}
catch(IOException e)
{
System.out.println(e.toString());
}
}
}
OUTPUT:
1 70 ms 55 ms 70 ms 10.228.129.13
2 87 ms 84 ms 10.228.149.14
3 82 ms 85 ms 116.202.226.145
4 95 ms 94 ms 136 ms 10.228.158.82
5 Request timed out.
6 53 ms 55 ms 59 ms 116.202.226.21
7 85 ms 74 ms 82 ms 72.14.205.145
8 76 ms 75 ms 71 ms 72.14.235.69
9 124 ms 114 ms 113 ms 216.239.63.213
10 181 ms 194 ms 159 ms 66.249.95.132
11 285 ms 247 ms 246 ms 209.85.142.51
12 288 ms 282 ms 283 ms 72.14.233.138
13 271 ms 283 ms 274 ms 64.233.174.97
14 Request timed out.
15 269 ms 273 ms 283 ms pc-in-f106.1e100.net [74.125.28.106]
Trace complete.
RESULT:
Thus the commands like tcpdump, netstat, if config, is lookup and traceoute are
used then ping and traceoute PDUs using network protocol is successfully
executed
EX.NO:2 HTTP Web Client program to download a web page
DATE: using TCP Socket
AIM:
ALGORITHM:
5.If your frames reach the server it will send ACK signal to client
CLIENT:
import javax.swing.*;
import java.net.*;
import java.awt.image.*;
import javax.imageio.*;
import java.io.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
Socket soc;
try
Img=ImageIO.read(new
ile("digital_image_processing.jpg"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
soc.getOutputStream();
DataOutputStreamdos=NewDataOutputStream(out);
dos.writeInt(bytes.length);
dos.write(bytes, 0, bytes.length);
dos.close(); out.close();
catch (Exception e)
soc.close();
soc.close();
}
SERVER:
import java.net.*;
import java.io.*;
import java.awt.image.*;
import javax.imageio.*;
import javax.swing.*;
class Server
socket=server.accept();
System.out.println("Client connected.");
InputStream in = socket.getInputStream();
dis.readFully(data);
dis.close();
in.close();
l.setIcon(icon);
f.add(l);
f.pack();
f.setVisible(true);
OUTPUT:
Client Connected
ImageSize:29MB
RESULT:
Thus the HTTP web program to download web page using TCP sockets was
excecuted successfully
EX.NO:3(a) APPLICATION USING TCP SOCKETS LIKE ECHO-
DATE: CLIENT AND ECHO -SERVER
AIM:
Links
ALGORITHM:
5.If your frames reach the server it will send ACK signal to client
EchoServer.java
import java.net.*;
import java.io.*;
ServerSocket s=null;
String line;
DataInputStream is;
PrintStream ps;
Socket c=null;
try
s=new ServerSocket(9000);
catch(IOException e)
System.out.println(e);
try
c=s.accept();
is=new DataInputStream(c.getInputStream());
ps=new PrintStream(c.getOutputStream());
while(true)
line=is.readLine();
ps.println(line);
catch(IOException e)
System.out.println(e);
}
EClient.java
import java.net.*;
import java.io.*;
Socket c=null;
String line;
DataInputStream is,is1;
PrintStream os;
try
InetAddress ia = InetAddress.getLocalHost();
c=new Socket(ia,9000);
catch(IOException e)
System.out.println(e);
try
os=new PrintStream(c.getOutputStream());
is=new DataInputStream(System.in);
is1=new DataInputStream(c.getInputStream());
while(true)
System.out.println("Client:");
line=is.readLine();
os.println(line);
System.out.println("Server:" + is1.readLine());
}}
catch(IOException e)
System.out.println("Socket Closed!");
}
OUTPUT:
Server:
C:\Program Files\Java\jdk1.5.0\bin>
Client:
Client:
Hai Server
Server:Hai Server
Client:
Hello
Server:Hello
Client:
end
Server:end
RESULT:
Thus the application using TCP sockets like Echo-server and Echo-client was
executed successfully
EX.NO:3(b) Application using TCP sockets like chat
DATE:
AIM:
To develop a chat server and client program in Java using TCP socket.
ALGORITHM:
SERVER:
8. Stop.
CLIENT:
5. Stop.
CLIENT PROGRAM:
import java.io.*;
import java.net.*;
InputStream istream=sock.getInputStream();
while(true)
sendmessage=KeyRead.readLine();
pwrite.println(sendmessage);
System.out.flush();
if((receivemessage=receivedread.readLine())!=null)
System.out.println(receivemessage);
SERVER PROGRAM:
import java.io.*;
import java.net.*;
Socket sock=sersock.accept();
InputStream istream=sock.getInputStream();
String receivemessage,sendmessage;
while(true)
if((receivemessage = receivedread.readLine())!=null)
System.out.println(receivemessage);
sendmessage=KeyRead.readLine();
pwrite.println(sendmessage);
System.out.flush();
}
CHATCLIENT:
Nicrosoft Windos tUersion 6.1.7601
Coperight ic) 280 Microsof t Corporat ion.
A11 rights reserved
CENUsers\student d:
D:Nset path-"D:\Java\jdk1.7.0_55";
D:Nset class path="D:\Java\jdk1.7.8_55\lib'"';
D:Ned D:dava\jdk1.?.055Nbin
D:Javajdki.7.0_55Nbin >javac chatclient . java
D:Javajdki.7.8 55 bin>java chatclient
client ready for chatting
e Icone
to
to AIT
CHATSERVER:
RESULT:
Thus the application using TCP sockets like chat was executed successfully
EX.NO:3(c) Application of using TCP sockets like File Transfer
DATE :
AIM:
To write a java program for file transfer using TCP Sockets.
ALGORITHM:
Server:
Step1: Import java packages and create class file server.
Step2: Create a new server socket and bind it to the port.
Step3: Accept the client connection
Step4: Get the file name and stored into the BufferedReader.
Step5: Create a new object class file and realine.
Step6: If file is exists then FileReader read the content until EOF is
reached.
Step7: Stop the program.
Client:
Step1: Import java packages and create class file server.
Step2: Create a new server socket and bind it to the port.
Step3: Now connection is established.
Step4: The object of a BufferReader class is used for storing data content
which has been retrieved from socket object.
Step5: The content of file is displayed in the client window and the
connection is closed.
Step6: Stop the program
FILE CLIENT
Import java.io.*;
Import java.net.*;
Import java.util.*;
Class Clientfile
Try
DataOutputStream
dout=new DataOutputStream(clsct.getOutputStream());
String str=in.readLine();
dout.writeBytes(str+'\n');
String str2=in.readLine();
String str1,ss;
FileWriter f=new
while(true)
{ str1=din.readLine();
if(str1.equals("-1")) break;
System.out.println(str1);
buffer=new char[str1.length()];
str1.getChars(0,str1.length(),buffer,0);
f.write(buffer);
f.close();
clsct.close();
catch (Exception e)
System.out.println(e);
}}}
SERVER
import java.io.*;
import java.net.*;
import java.util.*;
class Serverfile
Try
Socket obj1=obj.accept();
DataOutputStream
dout=new DataOutputStream(obj1.getOutputStream());
String str=din.readLine();
BufferedReader b=new
BufferedReader(f); String s;
while((s=b.readLine())!=null) {
System.out.println(s);
dout.writeBytes(s+'\n');
f.close();
dout.writeBytes("-1\n");
}}
catch(Exception e)
{ System.out.println(e);}}}
OUTPUT:
server
jbsdava jbvuesagv
RESULT:
Thus the java program file transfer application using TCP Sockets was
executed successfully.
EX.NO:4 Simulation of DNS using UDP Sockets
DATE:
Aim
ALGORITHM:
5.If your frames reach the server it will send ACK signal to client
Udpdnsserver.java
import java.io.*;
import java.net.*;
str = str.trim();
if (array[i].equals(str)) return i;
return -1;
while (true)
{
DatagramSocket serversocket=new DatagramSocket(1362);
(receivedata, receivedata.length);
serversocket.receive(recvpack);
String capsent;
senddata = capsent.getBytes();
(senddata, senddata.length,ipaddress,port);
serversocket.send(pack);
serversocket.close();}}}
//UDP DNS Client :
udpdnsclient.java
import java.io.*;
import java.net.*;
InetAddress ipaddress;
if (args.length == 0)
ipaddress = InetAddress.getLocalHost();
else
ipaddress = InetAddress.getByName(args[0]);
Senddata = sentence.getBytes();
clientsocket.send(pack);
DatagramPacketrecvpack=new
DatagramPacket(receivedata,receivedata.length);
clientsocket.receive(recvpack);
clientsocket.close();
}}
OUTPUT:
Server
Client
Found
RESULT:
Thus the simulation of DNS using UDP sockets was successfully executed.
EX.NO:5 Write a code simulating ARP/RARP Protocol
DATE:
AIM:
ALGORITHM:
SERVER:
2. Listen for new connection and when a connection arrives, accept it.
9. Stop.
CLIENT:
.7. Stop.
PROGRAM
CLIENT:
import java.io.*;
import java.net.*;
import java.util.*;
class Clientarp
try
BufferedReaderin=newBufferedReader(new
InputStreamReader(System.in));
DataOutputStreamdout=new
DataOutputStream(clsct.getOutputStream());
String str1=in.readLine();
dout.writeBytes(str1+'\n');
String str=din.readLine();
clsct.close();
}
catch (Exception e)
System.out.println(e);
SERVER:
import java.io.*;
import java.net.*;
import java.util.*;
class Serverarp
try
Socket obj1=obj.accept();
while(true)
DataOutputStreamdout=new
DataOutputStream(obj1.getOutputStream());
String str=din.readLine();
String ip[]={"165.165.80.80","165.165.79.1"};
String mac[]={"6A:08:AA:C2","8A:BC:E3:FA"};
for(int i=0;i<ip.length;i++)
if(str.equals(ip[i]))
dout.writeBytes(mac[i]+'\n');
break;
obj.close();
catch(Exception e)
System.out.println(e);
OUTPUT:
E:\networks>java Serverarp
E:\networks>java Clientarp
165.165.80.80
CLIENT:
import java.io.*;
import java.net.*;
import java.util.*;
class Clientrarp12
try
InetAddress addr=InetAddress.getByName("127.0.0.1");
BufferedReaderin=newBufferedReader(new
InputStreamReader(System.in));
String str=in.readLine();
sendbyte=str.getBytes();
DatagramPacket sender=new
DatagramPacket(sendbyte,sendbyte.length,addr,1309);
client.send(sender);
DatagramPacketreceiver=new
DatagramPacket(receivebyte,receivebyte.length);
client.receive(receiver);
client.close();
catch(Exception e)
System.out.println(e);
SERVER:
import java.io.*;
import java.net.*;
import java.util.*;
class Serverrarp12
try
while(true)
{
byte[] sendbyte=new byte[1024];
DatagramPacket receiver=new
DatagramPacket(receivebyte,receivebyte.length);
server.receive(receiver);
String s=str.trim();
//System.out.println(s);
InetAddress addr=receiver.getAddress();
int port=receiver.getPort();
String ip[]={"165.165.80.80","165.165.79.1"};
String mac[]={"6A:08:AA:C2","8A:BC:E3:FA"};
for(int i=0;i<ip.length;i++)
if(s.equals(mac[i]))
sendbyte=ip[i].getBytes();
DatagramPacket sender=new
DatagramPacket(sendbyte,sendbyte.length,addr,port);
server.send(sender);
break;
catch(Exception e)
System.out.println(e);
}
OUTPUT:
I:\ex>java Serverrarp12
I:\ex>java Clientrarp12
6A:08:AA:C2
RESULT:
AIM:
To Study of Network simulator and Simulation of Congestion Control
Algorithms using NS.
NS FUNCTIONALITIES:
Routing, Transportation, Traffic sources,queuing disciplines, QoS
WIRELESS:
Ad hoc routing, mobile IP, sensor-MAC Tracing, visualization and
various utilitiesNS(Network Simulators) Most of the commercial simulators are
GUI driven, while some network simulators are CLI driven. The network model
/ configuration describe the state of the network (nodes, routers, switchesand
links) and the events (data transmissions, packet error etc.). The important
outputs of simulations are the trace files. Trace files log every packet, every
event that occurred in the simulation and are used for analysis.
Network simulators can also provide other tools to facilitate visual
analysis of trends and potential trouble spots. Most network simulators use
discrete event simulation, in which a list of pending "events" is stored, and those
events are processed in order, with some events triggering future events such as
the event of the arrival of a packet at one node triggering the event of the arrival
of that packet at a downstream node. Simulation of networks is a very complex
task. For example, if congestion is high, then estimation of the average
occupancy is challenging because of high variance. To estimate the likelihood
of a buffer overflow in a network, the time required for an accurate answer can
be extremely large. Specialized techniques such as "control variants" and
"importance sampling" have been developed to speed simulation.
ns (open source)
OPNET (proprietary software)
NetSim (proprietary software)
QUEUE LENGTH:
A queuing system in networks can be described as packets arriving for service,
waiting for service if it is not immediate, and if having waited for service,
leaving the system after being served. Thus queue length is very important
characteristic to determine that how well the active queue management of the
congestion control algorithm has been working.
RESULT:
Thus the study of Network simulator (NS2) was studied
Ex: No:7 STUDY OF TCP/UDP PERFORMANCE USING SIMULATION
DATE: TOOL
The overall idea was to allow one application on one computer to talk to(send data packets)
another application running on different computer.
TCP Header:
1. Source Port-
2. Destination Port-
5. Header Length-
In general,
Connection Establishment –
1. Sender starts the process with following:
Sequence number (Seq=521): contains the random initial sequence number
which generated at sender side.
Syn flag (Syn=1): request receiver to synchronize its sequence number with the
above provided sequence number.
Maximum segment size (MSS=1460 B): sender tells its maximum segment size,
so that receiver sends datagram which won’t require any fragmentation. MSS
field is present inside Option field in TCP header.
Window size (window=14600 B): sender tells about his buffer capacity in which
he has to store messages from receiver.
2. TCP is a full duplex protocol so both sender and receiver require a window for
receiving messages from one another.
Sequence number (Seq=2000): contains the random initial sequence number
which generated at receiver side.
Syn flag (Syn=1): request sender to synchronize its sequence number with the
above provided sequence number.
Maximum segment size (MSS=500 B): sender tells its maximum segment size, so
that receiver sends datagram which won’t require any fragmentation. MSS field is
present inside Option field in TCP header.
Since MSSreceiver < MSSsender, both parties agree for minimum MSS i.e., 500 B to
avoid fragmentation of packets at both ends.
Therefore, receiver can send maximum of 14600/500 = 29 packets.
Since the connection establishment phase of TCP makes use of 3 packets, it is also known
as 3-way Handshaking (SYN, SYN + ACK, ACK).
TCP Socket Options:
Introduction
There are various ways to get and set the options that affect a socket:
The following table lists socket and IP-layer socket options for getsockopt and setsockopt.
clear
timeout
multicast
Basic Command :
filter_none
brightness_4
set a 8
Explanation : In the first line, the variable a is assigned the value 8. In the second line,
the result of the command [expr $a/8], which equals 1, is then used as an argument to
another command, which in turn assigns a value to the variable b. The “$” sign is used
to obtain a value contained in a variable and square brackets are an indication of a
command substitution.
brightness_4
proc factorial fact {
if {$fact <= 1} {
return 1
brightness_4
set testfile [open hello.dat r]
brightness_4
set testfile [open hello.dat w]
To call subprocesses within another process, exec is used, which creates a subprocess
and waits for it to complete.
filter_none
brightness_4
exec rm $testfile
brightness_4
set ns [new Simulator]
The simulator object has member functions which enables to create the nodes and
define the links between them. The class simulator contains all the basic functions.
Since ns was defined to handle the Simulator object, the command $ns is used for
using the functions belonging to the simulator class.
In the network topology nodes can be added in the following manner :
filter_none
brightness_4
set n0 [$ns node]
Traffic agents (TCP, UDP etc.) and traffic sources (FTP, CBR etc.) must be set up if the
node is not a router. It enables to create CBR traffic source using UDP as transport
protocol or an FTP traffic source using TCP as a transport protocol.
CBR traffic source using UDP :
filter_none
brightness_4
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
filter_none
brightness_4
set tcp0 [new Agent/TCP]
Below is the implementation of creating links between the source and destination using
both ftp and tcp :
filter_none
brightness_4
# Create a simulator object
proc finish {}
global ns nf
$ns flush-trace
close $nf
exit 0
$ns at 4.5 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"
# Call the finish procedure after
$ns run
Output :
Conclusion:
Now that we've discussed some of the major components of networks and TCP/IP, you
have the necessary background to examine the more critical issues of security in a
converged environment. Knowing how networks are built gives you a better
understanding of what physical or logical vulnerabilities are introduced by choosing one
particular network design over another. Knowing how packets are formed gives you a
better understanding of how they can be crafted or modified to achieve a specific
purpose. Knowing how packets are transmitted and delivered gives you a better
understanding of what can happen to packets as they travel from source to destination.
A good understanding of the basics of networking and TCP/IP is critical to identifying,
understanding, and correcting vulnerabilities in your converged environment.
CASE STUDY – 2
User datagram protocol is an open systems interconnection (OSI) transport layer protocol for
client- server network applications. UDP uses a simple transmission model but does not
employ handshaking dialogs for reliability, ordering and data integrity. The protocol assumes
that error-checking and correction is not required, thus avoiding processing at the network
interface level.
UDP is widely used in video conferencing and real-time computer games. The protocol
permits individual packets to be dropped and UDP packets to be received in a different
order than that in which they were sent, allowing for better performance.
UDP network traffic is organized in the form of datagrams, which comprise one message
units. The first eight bytes of a datagram contain header information, while the remaining
bytes contain message data. A UDP datagram header contains four fields of two bytes each:
UDP header is 8-bytes fixed and simple header, while for TCP it may vary from 20 bytes to
60 bytes. First 8 Bytes contains all necessary header information and remaining part consist
of data. UDP port number fields are each 16 bits long, therefore range for port numbers
defined from 0 to 65535; port number 0 is reserved. Port numbers help to distinguish
different user requests or process.
1. Source Port : Source Port is 2 Byte long field used to identify port number of source.
2. Destination Port : It is 2 Byte long field, used to identify the port of destined packet.
3. Length : Length is the length of UDP including header and the data. It is 16-bits field.
4. Checksum : Checksum is 2 Bytes long field. It is the 16-bit one’s complement of the
one’s complement sum of the UDP header, pseudo header of information from the IP
header and the data, padded with zero octets at the end (if necessary) to make a
multiple of two octets.
UDP socket routines enable simple IP communication using the user datagram protocol
(UDP).
The User Datagram Protocol (UDP) runs on top of the Internet Protocol (IP) and was
developed for applications that do not require reliability, acknowledgment, or flow control
features at the transport layer. This simple protocol provides transport layer addressing in the
form of UDP ports and an optional checksum capability.
One important topic under the exam number 300-101 route is on how to describe UDP
operations. It comes under the main topic of network principals. We will now in this chapter
try to discuss the many aspects of the topic so that you can clear this section and get a better
score. UDP is user datagram protocol.
What UDP exactly does is that it takes the data from the higher layer protocols and then
places them in the UDP messages. This is then passed down to the internet protocol for
transmission. It is a simple form of TCP/IP. Some of the steps that are followed in
transmission that is UDP based are as follows:
1. As a first step an application will send a message to the UDP software. This is also called the
higher layer data transfer.
2. The higher layer message that was sent in the first step will then be encapsulated into the
data field of the UDP message. After this the header of the UDP messages is filled in. This
includes the source port of the application that sent the data to the UDP as well as the
destination port. This will also help to calculate the checksum value. The checksum value
will allow detecting an error in a transmission if the UDP message was delivered to a wrong
destination.
3. In the last step the message is transferred to the IP. In this the UDP message will be passed
to the IP for further transmission.
The concept of UDP is simple. The UDP will not do the following. As a network
administrator you must be aware of these:
1. The UDP will never show any acknowledgement to prove that the data was received.
2. The UDP will never establish a connection before actually sending the data.
3. The UDP does not give a guarantee that the messages will arrive.
4. The UDP cannot detect the messages that were lost.
5. The UDP will also not assure that the data will be received in the same format as they were
received.
6. The UDP does not have any mechanism that manages flow of data between the devices and
does not handle congestion either.
The UDP messages will have the following parts:
1. Source port - this is a 16 bit port number of the process that initially originated the UDP
message on the source device.
2. Destination port - this is the second part of the message. It is a 16 bit-port number of the
process it is ultimate recipient of the message. This will generally be the port number of the
client.
3. Length -the length means the entire UDP datagram that includes data fields and the
headers.
4. Checksum - as we have already explained it before it is optional and generally 16 bit in size.
5. Data - it is the variable part of the UDP. It encapsulates the higher layer messages that need
to be sent.
Starvation
Generally the UDP based traffic and the TCP based traffic are not mixed for the best
performance of the network. This is done so that these two have different ways of behaving
under a time of congestion. It has been noted that when the TCP flows are combined with the
UDP flows in a single service provider class then congestion is almost inevitable.
This is because the TCP flows will continuously try to lower the transmission rates as a result
the bandwidth to the UDP flow will fall. This process is called TCP starvation or in other
words UDP dominance. This situation will mostly occur if the mission critical data that is
TCP based is assigned to the same service provider class as the UDP based streaming video
as a result the class will experience a sustained congestion.
It must be mentioned here that even the use of WERD cannot help these congestions. This is
mainly because WERD can manage congestion only on TCP based flows.
It is true no doubt that it is not always possible to separate the TCP and the UDP flow.
However, it is advisable that you know of what you can face in case you try to mix the two in
a single service provider class.
Latency
The latency is the interval between the response and the stimulation. The UDP is considered
to be much faster than the TCP. This is because the ACK allows a continuous stream of
packets.TCP on the other hand will recognise only a set of packets that makes it slower.
Some may feel that the UDP is faster and vice versa.
However, some experts belive that whether you go for a UDP or a TCP will depend on the
network features and the network traffic. Some say that TCP can work better in case of small
size writes. The TCP can control congestion but a UDP as we have already discussed do not
have a good congestion control mechanism.
If you want to improve the performance of the TCP throughput when there is UDP traffic
present then you can try one way and that is by opening many TCP connections. This will
ensure that the sum of the throughput of all the TCP connection will be greater than that of
the UDP.
The TCP and the UDP serve different requirements of the applications as a result they both
are mostly used. UDP can be very helpful in video conferencing where TCP is not a great
idea. UDP can also help in multicast. The TCP can keep multiple messages in a wire which is
not easily possible in UDP. The routers generally tend to drop the UDP before the TCP.
In most of the companies the UDP is dropped in order to improve the speed of the TCP. The
research is on to find new ways to balance the conflict between the software and we hope that
we will get a solution soon. Having two different infrastructures is a good idea but it is not
possible always as it will be a very expensive thing to do.
We have tried to discuss almost all the aspects that are important from the CCNP exam point
of view in this particular section. We hope that this chapter will help you to get a clearer
understanding of the topic.
Conclusion:
This thesis presents the client redirection problem and the requirements that should be met
by a good solution. These requirements include: transparency, scalability, maintainability,
and efficiency. Among three popular redirection mechanisms (HTTP redirection, TCP
handoff, and DNS redirection), we conclude that a DNS-based redirection mechanism meets
the four above requirements best.
Our implementation, called NetAirt, proves that with little effort Apache can be made to
service DNS packets, no matter which transport-layer protocol is used: UDP or TCP.
Moreover, our module can easily be integrated with an external replication-managing
component, designed either as a separate Apache module (like Globule, another project of
ours), or as a completely independent program.
We have paid attention to the development of a reasonable set of redirection policies: static
name-to-address mapping, round-robin replica selection, and the AS-path length policy. We
have incorporated them into NetAirt, thus demonstrating its flexibility, and allowing users to
switch between them. We have described in detail how the most advanced one, the AS-path
length policy, can be implemented. Firstly, BGP routing tables can be exploited to associate
an ASN with any IP address, as well as to build a map of the ASes. This map allows to define
the AS-path length metric, which is the base of the AS-path length redirection policy.
We have also conveyed two experiments. The first of them investigates the following three
issues: the impact of the transport protocol on the Round Trip Time (RTT) of a DNS packet,
the overhead introduced by running the round-robin address selection instead of the static
name-to-address mapping, and the correspondence between the number of IP addresses
returned in a single DNS response and the RTT. The results prove that sending DNS queries
over TCP is almost 80% slower than in case of UDP. On the other hand, the overhead
introduced by the round-robin policy, and the cost of responding with additional IP
addresses turn out to be negligible
RESULT:
Thus the study of TCP/UDP has been performed and verified successfully.
EX:NO:8 Simulation of Distance Vector Routing Algorithm
DATE:
AIM:
SOFTWARE REQUIRED:
NS-2
THEORY:
Network for computing shortest path between source and destination. Th Router
is one main devices used in a wide area network. The main task of the router is
Routing. It forms the routing table and delivers the packets depending upon the
initially has information about its all neighbors. Then this information will be
ALGORITHM:
3. Open a nam trace file and define finish procedure then close the trace
proc finish { }
global ns nr nf
$ns flush-trace
close $nf
close $nr
exit 0
$cbr1 attach-agent
$ns rtproto DV
$ns at 45 "finish"
$ns run
OUTPUT:
RESULT:
Thus the Distance vector Routing Algorithm was Simulated and studied.
EX.NO:9 Performance evaluation of routing protocol using
DATE: simulation tool
AIM:
ALGORITHM:
Step 4: open the network animator file in the name of file2 in the write
mode.
Step 5: open the trace file in the name of file 1 in the write mode.
Step 6: set the unicast routing protocol to transfer the packets in network.
Step 8: create the duplex-link between the nodes including the delay
Step 9: give the position for the links between the nodes.
Step 13: down the connection between any nodes at a particular time.
proc finish {} {
$ns flush-trace
close $file1
close $file2
exit 3
$ns rtproto DV
$ns run
OUTPUT:
PROGRAM:-MULTICAST ROUTING PROTOCOL
# Create scheduler
#$ns multicast
#Turn on Tracing
# Create nodes
# Create links
set mproto DM
# Create receiver
# Schedule events
#post-processing
proc finish {} {
global ns tf
$ns flush-trace
close $tf
exit 0
# For nam
# Group 0 source
# Group 1 source
# Animation rate
$ns run
OUTPUT:
RESULT:
AIM:
ALGORITHM:
#include<stdio.h>
#include<stdlib.h>
char data[5];
int encoded[8],edata[7],syndrome[3];
int hmatrix[3][7] = {
1,0,0,0,1,1,1,
0,1,0,1,0,1,1,
0,0,1,1,1,0,1
};
char gmatrix[4][8]={"0111000","1010100","1100010","1110001"};
int main(){
int i,j;
scanf("%s",data);
printf("\nGenerator matrix\n");
for(i=0;i<4;i++)
printf("%s\n",gmatrix[i]);
for(i=0;i<7;i++)
for(j=0;j<4;j++)
encoded[i]+=((data[j]-'0')*(gmatrix[j][i]-'0'));
encoded[i]=encoded[i]%2;
printf("%d ",encoded[i]);
for(i=0;i<7;i++)
scanf("%d",&edata[i]);
for(i=0;i<3;i++)
for(j=0;j<7;j++)
syndrome[i]+=(edata[j]*hmatrix[i][j]);
syndrome[i]=syndrome[i]%2;
for(j=0;j<7;j++)
(syndrome[2]==hmatrix[2][j]))
break;
if(j==7)
printf("\nError free\n");
else
edata[j]=!edata[j];
OUTPUT:
RESULT:
Thus the simulation of error correction code like (CRC) was executed
successfully.