CN Lab Record
CN Lab Record
ARNI
[CS3591]-COMPUTER
NETWORKS LABORATORY
DEPARTMENT
OF
COMPUTER SCIENCE AND ENGINEERING
SRI BALAJI CHOCKALINGAM ENGINEERING COLLEGE
A.C.S Nagar (Irumbedu), Arni, T.V.Malai Dt. – 632 317.
DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING
BONAFIDE CERTIFICATE
REGISTER NO :
PAGE
EX. NO DATE NAMEOFTHE EXPERIMENT SIGNATURE
NO
LEARNINGANDANALYSING
1
NETWORKING COMMANDS
2 DOWNLOADINGWEBPAGE
3 (A) ECHOCLIENTANDECHOSERVER
3 (B) CHAT
5
WIRESHACK PACKETS
STUDYOFNETWORKSIMULATOR(NS)
7 AND SIMULATION OF CONGESTION
CONTROL ALGORITHMS USING NS
SIMULATION OF DISTANCE
9(A)
VECTOR ROUTING
ALGORITHM
SIMULATIONOFERRORCORRECTION
10
CODE
ExNo1
DATE:
Aim:
ToLearntheuseofcommandsliketcpdump,netstat,ifconfig,nslookupandtraceroute.
Capturepingand traceroutePDUsusinganetworkprotocol analyzerandexamine.
NETWORINGCOMMANDS
1. TCPDUMP
Tcpdumpis a commonpacket analyserthat runs under thecommand line. It allows the user to
displayTCP/IPand other packets being transmitted or received over a network to which the computer is
attached.Tcpdump works on most Unix-like operating systems: Linux, Solaris, FreeBSD, DragonFly
BSD, NetBSD, OpenBSD, OpenWrt, macOS, HP-UX 11i, and AIX. In those systems, tcpdump uses
the libpcap library to capture packets. The port of tcpdump for Windows is called WinDump; it uses
WinPcap, the Windows port of libpcap.
Tcpdump was originally written in C Programming Language. Tcpdump prints the contents of
network packets. It can read packets from a network interface card or from a previously created saved
packet file. tcpdump can write packets to standard output or a file.
It is also possible to use tcpdump for the specific purpose of intercepting and displaying the
communications of another user or computer. A user with the necessary privileges on a system acting
as a router or gateway through which unencrypted traffic such as Telnet or HTTP passes can use
tcpdump to view login IDs, passwords, the URLs and content of websites being viewed,
ExampleofavailablecaptureinterfacesonaLinuxsystem:
$tcpdump -D 6. nfqueue(Linuxnetfilterqueue(NFQUEUE)
1. eth0 [Up, Running] interface)
2. any (Pseudo-device that captures on all 7. dbus-system (D-Bus system bus)
interfaces) [Up, Running] 8. dbus-session(D-Bussessionbus)
3. lo[Up,Running,Loopback] 9. bluetooth0(Bluetoothadapternumber0) 10.eth1
4. bluetooth-monitor(BluetoothLinuxMonitor)
5. nflog(Linux netfilterlog(NFLOG) interface)
2. NETSTAT
Netstat (network statistics) is a command-line network utility that displays networkconnections
for Transmission Control Protocol (both incoming and outgoing), routing tables, and a number of
network interface (network interface controller or software-defined network interface) and network
protocol statistics.
It is available on Unix-like operating systems including macOS, Linux, Solaris and BSD,
andisavailableon IBMOS/2andonMicrosoftWindowsNT-basedoperatingsystemsincludingWindows
XP, Windows Vista, Windows 7, Windows 8 and Windows 10. It is used for finding problems in the
network and to determine the amount of traffic on the network as a performance measurement.
CheckthecommandsasfollowasoncommandpromptinWindows
MicrosoftWindows[Version 10.0.10586]
(c) 2015MicrosoftCorporation.Allrightsreserved.
C:\Users\SYSTEM>netstat -a
The following netstat commands displays protocol statistics and current TCP/IP network
connections.
Command Description
netstat–a Displaysallconnections,listeningandnonlisteningports,sockets,
protocolsliketcp,udp etc
netstat–at Shows onlytcpconnections(-au showsonlyudpconnections)
netstat–ant ShowsallTCPconnectionswithnodnsresolution(showipnumber
instead).
netstat-atnp |grepESTA DisplaysallcurrentEstablishedTCP connections
netstat–al Shows onlylistening sockets
netstat–b Displaystheexecutableinvolvedincreatingeachconnectionorlistening port.
In some cases well-known executables host multiple independent
components,andinthesecasesthesequenceofcomponentsinvolvedin
creatingtheconnectionorlisteningportisdisplayed.Inthiscasethe
executable name is in at the bottom, on top is the component it
called,and soforth untilTCP/IPwasreached. Note that thisoptioncanbe
time-
consumingandwillfailunlessyouhavesufficientpermissions.
netstat-ct Displaystcpconnections continuously
netstat–e DisplaysEthernet statistics.This maybecombined withthe–s option.
netstat–f DisplaysFullyQualified DomainNames(FQDN)forforeignaddresses.
netstat–g DisplaymulticastgroupmembershipinformationforIPv4andIPv6
netstat–i Displaysatableofallnetworkinterfaces.Add-etogetoutputsimilarto
ifconfig
netstat –lntu Displayallserviceslisteningfortcpandudp,allfreeopenportsonthe
local machine
netstat–n Displaysaddresses andportnumbersinnumericalform.
netstat–o DisplaystheowningprocessIDassociatedwitheachconnection.
netstat–pprotocolname Showsconnections fortheprotocol specified byproto; proto maybeany of:
TCP, UDP, TCPv6, or UDPv6.
Ifusedwiththe–soptiontodisplayper-protocolstatistics,protomay
beanyof:IP, IPv6,ICMP, ICMPv6,TCP,TCPv6,UDP,orUDPv6.
netstat-q Displaysallconnections,listeningports,andboundnonlisteningTCP
ports. Bound non listening ports may or may not be associated with
anactive connection.
netstat–r Displaysthe routingtable.
netstat–s Displaysper-protocol statistics.
Bydefault,statisticsareshownforIP,IPv6,ICMP,ICMPv6,TCP,
TCPv6,UDP,andUDPv6;the-poptionmaybeusedtospecifyasubset
of the default.
netstat–t Displaysthecurrentconnectionoffload state.
netstat–x DisplaysNetworkDirect connections,listeners,andsharedendpoints.
netstat–y DisplaystheTCPconnectiontemplateforallconnections.Cannotbe
combinedwith theother options.
netstat –interval Redisplaysselectedstatistics,pausingintervalsecondsbetweeneach display.
PressCTRL+Ctostopredisplayingstatistics.Ifomitted,netstatwill
printthecurrentconfigurationinformationonce.
3. IFCONFIG
ifconfig is a system administration utility in Unix-like operating systems for network
interface configuration. The utility is a command-line interface tool and is also used in the
system startup scripts of many operating systems. It has features for configuring, controlling,
and querying TCP/IP network interface parameters.
Syntax: ifconfig[...OPTIONS][INTERFACE]
ifconfig -a Displayalltheinterfacesavailable,eveniftheyaredown.
ifconfig -s Display a short list, instead of details.
ifconfig -v Run the command in verbose mode – log more details about execution.
ifconfig interface up Activatethedriverforthegiveninterface.
ifconfig interface down Deactivatethedriverforthegiveninterface.
ifconfig interface add addr/prefixlen Add an IPv6 address to an interface.
ifconfig interface del addr/prefixlen Remove an IPv6 address to an interface.
ifconfig interface [-]arp Enable/disabletheuseofARPprotocolonaninterface.
ifconfig interface [-]promisc Enable/disable the promiscuous mode on an interface.
Ifitisselected,allthepacketsonthenetworkwillbe received by
the interface.
ifconfiginterface[-]allmulti Enable/disableall-multicastmodeforaninterface.
Ifitisselected,allthemulticastpacketswillbereceived by the
interface.
ifconfig interface [-]allmulti Set the Maximum Transfer Unit(MTU).
ifconfig --help Displayhelprelatedtoifconfigcommand.
4. NSLOOKUP
Nslookup is a network administration command-line tool available in many computer
operating systems for querying the Domain Name System (DNS) to obtain domain name or IP
address mapping, or other DNS records. The name "nslookup" means "name server lookup".
This tool can be used to check DNS records propagation using different servers, to confirm
proper DNS resolution, and perform other troubleshooting steps and can use via the command
prompt as follow as.
MicrosoftWindows [Version 10.0.10586]
(c) 2015MicrosoftCorporation.Allrightsreserved.
C:\Users\SYSTEM>nslookup example.com
STEPS:
1. OpenWireshark,checkthegraphrepresentationofinstallednetworkcontrollerinterfaces
2. Setthepreferencesformeditmenutodisplaytherequiredfieldwhile capturingthe packets.
3. Select“Option” optionfromcapture menu, select currentnetworkinterfacesfrominputtab,set
required preferences from output and options tab in Wireshark-Capture Interfaces window,
make sure enable promiscuous option is checked and click start.
4. Now the packet capturing starts and open windows command prompt type > “ping ip address”
response will appear in command prompt, simultaneously watch the packet capturing in
Wireshark capturing window.
5. Similarlycheck thetraceroutecommandin Wireshark.
RESULT:
The learning, analysing, capturing and examining of networking commands has been done
successfully
PROGRAM
importjava.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
importjava.io.InputStreamReader;
import java.net.URL;
publicclass Download
{
publicstatic voidmain(Stringargs[])throwsIOException
{
download("http://www.google.com");
}
publicstatic void download(StringurlString) throwsIOException
{
URLurl=newURL(urlString); try(
BufferedReaderreader =new BufferedReader(new
InputStreamReader(url.openStream()));
BufferedWriterwriter=newBufferedWriter(newFileWriter("Google.html"));
)
{
Stringline;
while((line=reader.readLine())!= null)
{
writer.write(line);
}
System.out.println("Pagedownloaded.");
}
}
}
OUTPUT:
RESULT :
Thus the program for creating sockets for HTTP netpage to download successfully.
PROGRAM:
ECHOCLIENT :-
import java.io.*;
import java.net.*;
import java.util.*;
publicclassechoclient
Socket c=null;
DataInputStreamusr_inp=null;
DataInputStreamdin=newDataInputStream(System.in);
DataOutputStream dout=null;
try
c=newSocket("127.0.0.1",5678);
usr_inp=newDataInputStream(c.getInputStream());
dout=newDataOutputStream(c.getOutputStream());
catch(IOExceptione)
if(c!=null||usr_inp!=null ||dout!=null)
String unip;
while((unip=din.readLine())!=null)
{
dout.writeBytes(""+unip);
dout.writeBytes("\n");
System.out.print("\nTheechoedmessage");
System.out.print(usr_inp.readLine());
System.exit(0);
din.close();
usr_inp.close();
c.close();
ECHO SERVER :-
import java.io.*;
import java.net.*;
publicclassechoserver
publicstaticvoidmain(String[]args)throwsException
ServerSocketm=null;
Socket c=null;
DataInputStreamusr_inp=null;
DataInputStreamdin=newDataInputStream(System.in);
DataOutputStream dout=null;
try
{
m=newServerSocket(5678);
c=m.accept();
usr_inp=newDataInputStream(c.getInputStream());
dout=newDataOutputStream(c.getOutputStream());
catch(IOExceptione)
if(c!=null||usr_inp!=null)
Stringunip;
while(true)
Stringm1=(usr_inp.readLine());
System.out.print(m1);
dout.writeBytes(""+m1);
dout.writeBytes("\n");
dout.close();
usr_inp.close();
c.close();
}
CLIENT AND SERVER OUTPUT:
RESULT:
Thus the java program to concurrently using TCP sockets was excited
successfully.
PROGRAM:
Chat Server :
import java.io.*;
import java.net.*;
publicclasschatserver
{
publicstatic void main(Stringargs[])throws Exception
{
ServerSocketm=null;
Socket c=null;
DataInputStreamusr_inp=null;
DataInputStreamdin=newDataInputStream(System.in);
DataOutputStream dout=null;
try
{
m=newServerSocket(1234);
c=m.accept();
usr_inp=newDataInputStream(c.getInputStream());
dout=newDataOutputStream(c.getOutputStream());
}
catch(IOExceptione)
{
}
if(c!=null||usr_inp!=null)
{
Stringunip;
while(true)
{
System.out.println("\nmessagefromclient");
String ml=usr_inp.readLine();
System.out.println(ml);System.out.println("\n
enteryourmessage:"); unip=din.readLine();
dout.writeBytes(""+unip);
dout.writeBytes("\n");
}
}
dout.close();
usr_inp.close();
c.close();
}
}
ChatClient:
import java.io.*;
import java.net.*;
publicclasschatclient
{
publicstatic void main(Stringargs[])throws Exception
{
Socket c=null;
DataInputStreamusr_inp=null;
DataInputStreamdin=newDataInputStream(System.in);
DataOutputStream dout=null;
try
{
c=newSocket("127.0.0.1",1234);
usr_inp=newDataInputStream(c.getInputStream());
dout=newDataOutputStream(c.getOutputStream());
}
catch(IOExceptione)
{
}
if(c!=null||usr_inp!=null ||dout!=null)
{
System.out.println("\nEnterthemessageforserver:");
while((unip=din.readLine())!=null)
{
dout.writeBytes(""+unip);
dout.writeBytes("\n");
System.out.println("reply");
System.out.println(usr_inp.readLine());
System.out.println("\nenteryourmessage:");
}
System.exit(0);
}
din.close();
usr_inp.close();
c.close();
}
}
OUTPUT:
CLIENTOUTPUT:
SERVEROUTPUT:
RESULT:
Chat application using TCP Sockets Implemented Successfully.
SERVERPROGAM
import java.io.*;
importjava.net.*;
importjava.util.*;
classServerdns12
{
publicstatic void main(Stringargs[])
{
try
{
DatagramSocketserver=newDatagramSocket(1309);
while(true)
{
byte[] sendbyte=new byte[1024];
byte[]receivebyte=newbyte[1024];
DatagramPacketreceiver=newDatagramPacket(receivebyte,receivebyte.length);
server.receive(receiver);
Stringstr=newString(receiver.getData());
String s=str.trim();
//System.out.println(s);
InetAddressaddr=receiver.getAddress();
int port=receiver.getPort();
Stringip[]={"165.165.80.80","165.165.79.1"};
Stringname[]={"www.aptitudeguru.com","www.downloadcyclone.blogspot.com"};
for(int i=0;i<ip.length;i++)
{
if(s.equals(ip[i]))
{
sendbyte=name[i].getBytes();
DatagramPacketsender=newDatagramPacket(sendbyte,sendbyte.length,addr,port);
server.send(sender);
break;
}
elseif(s.equals(name[i]))
{
sendbyte=ip[i].getBytes();
DatagramPacketsender=newDatagramPacket(sendbyte,sendbyte.length,addr,port);
server.send(sender);
break;
}
}
break;
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
CLIENT PROGRAM
import java.io.*;
importjava.net.*;
importjava.util.*;
class Clientdns
{
publicstatic void main(Stringargs[])
{
try
{
DatagramSocketclient=new DatagramSocket();
InetAddressaddr=InetAddress.getByName("127.0.0.1");
byte[] sendbyte=new byte[1024];
byte[]receivebyte=newbyte[1024];
BufferedReaderin=newBufferedReader(newInputStreamReader(System.in));
System.out.println("Enter the DOMAIN NAME or IP adress:");
Stringstr=in.readLine();
sendbyte=str.getBytes();
DatagramPacketsender=newDatagramPacket(sendbyte,sendbyte.length,addr,1309);
client.send(sender);
DatagramPacketreceiver=newDatagramPacket(receivebyte,receivebyte.length);
client.receive(receiver);
Strings=newString(receiver.getData());
System.out.println("IPaddressorDOMAINNAME:"+s.trim());
client.close();
}
catch(Exception e)
{
System.out.println(e);
}}}
SERVERANDCLIENTOUTPUT:
RESULT:
Thus the DNS application program was executed
Successfully
EX.NO.5 USE A TOOL LIKE WIRESHARK TO CAPTURE PACKETS AND EXAMINE THE PACKETS
DATE:
AIM:
To use a to like a wireshark packets and examine the packets
import java.io.*;
importjava.net.*;
importjava.util.*;
class Serverarp
{
publicstatic void main(Stringargs[])
{
try
{
ServerSocketobj=newServerSocket(139);
Socket obj1=obj.accept();
while(true)
{
DataInputStream din=new DataInputStream(obj1.getInputStream());
DataOutputStreamdout=newDataOutputStream(obj1.getOutputStream());
String str=din.readLine();
Stringip[]={"165.165.80.80","165.165.79.1"};
Stringmac[]={"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)
{
}}}
Client :
import java.io.*;
importjava.net.*;
importjava.util.*;
class Clientarp
{
publicstatic void main(Stringargs[])
{
try
{
BufferedReaderin=newBufferedReader(newInputStreamReader(System.in));
Socket clsct=new Socket("127.0.0.1",139);
DataInputStream din=new DataInputStream(clsct.getInputStream());
DataOutputStreamdout=newDataOutputStream(clsct.getOutputStream());
System.out.println("Enter the Logical address(IP):");
String str1=in.readLine();
dout.writeBytes(str1+'\n');
String str=din.readLine();
System.out.println("ThePhysicalAddressis:"+str);
clsct.close();
}
catch(Exceptione)
{
System.out.println(e);
}
}
}
SERVERANDCLIENT OUTPUT:
RESULT :
Thus the program has been executed successfully.
PROGRAM
Server:
import java.io.*;
importjava.net.*;
importjava.util.*;
class Serverrarp
{
publicstatic void main(Stringargs[])
{
try
{
ServerSocketobj=newServerSocket(139);
Socket obj1=obj.accept();
while(true)
{
DataInputStream din=new DataInputStream(obj1.getInputStream());
DataOutputStreamdout=newDataOutputStream(obj1.getOutputStream());
String str=din.readLine();
Stringip[]={"165.165.80.80","165.165.79.1"};
Stringmac[]={"6A:08:AA:C2","8A:BC:E3:FA"};
for(int i=0;i<mac.length;i++)
{
if(str.equals(mac[i]))
{
dout.writeBytes(ip[i]+'\n');
break;
}}
obj.close();
}}
catch(Exception e)
{
System.out.println(e);
}}
Client :
import java.io.*;
importjava.net.*;
importjava.util.*;
class Clientrarp
{
publicstatic void main(Stringargs[])
{
try
{
BufferedReaderin=newBufferedReader(newInputStreamReader(System.in)); Socket
clsct=new Socket("127.0.0.1",139);
AIM:
Ns overview
✓ CasestudyII:Create anewagentinNs
Ns overview
✓ Ns Status
✓ Periodicalrelease(ns-2.26,Feb2003)
✓ Platform support
✓ FreeBSD,Linux,Solaris,WindowsandMac
Ns Functionalities
Wireless
Most of the commercial simulators are GUI driven, while some network simulators are CLI
driven. The network model / configuration describes the state of the network (nodes, routers, switches,
links) and the events (data transmissions, packet error etc.). An important output 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.
Simulationofnetworksisaverycomplex task.Forexample,ifcongestionishigh,thenestimation 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 variates" and "importance sampling" have been developed to speed
simulation.
Examplesofnetworksimulators
There are many both free/open-source and proprietary network simulators. Examples of notable
network simulation software are, ordered after how often they are mentioned in research papers:
1. ns(opensource)
2. OPNET (proprietarysoftware)
3. NetSim(proprietarysoftware)
Usesof networksimulators
Network simulators serve a varietyof needs. Compared to the cost and time involved in settingup
an entire test bed containing multiple networked computers, routers and data links, network simulatorsare
relatively fast and inexpensive. They allow engineers, researchers to test scenarios that might be
particularly difficult or expensive to emulate using real hardware - for instance, simulating a scenariowith
several nodes or experimenting with a new protocol in the network. Network simulators are particularly
useful in allowing researchers to test new networking protocols or changes to existing protocols in a
controlled and reproducible environment. A typical network simulator encompasses a wide range of
networking technologies and can help the users to build complex networks from basic building blocks
such as a variety of nodes and links. With the help of simulators, one can design hierarchical
networksusingvarioustypesofnodeslikecomputers,hubs,bridges,routers,switches,links,mobileunits etc.
Various types of Wide Area Network (WAN) technologies like TCP, ATM, IP etc. and Local
Area Network (LAN) technologies like Ethernet, token rings etc., can all be simulated with a typical
simulatorandtheusercantest,analyzevariousstandardresultsapartfromdevisingsomenovelprotocol or
strategy for routing etc. Network simulators are also widely used to simulate battlefield networks in
Network-centric warfare.
Thereare a wide varietyof network simulators, rangingfrom the verysimple to the verycomplex.
Minimally, a network simulator must enable a user to represent a network topology, specifying the nodes
on the network, the links between those nodes and the traffic between the nodes. More complicated
systems may allow the user to specify everything about the protocols used to handle traffic in a network.
Graphical applications allow users to easily visualize the workings of their simulated environment. Text-
based applications may provide a less intuitive interface, but may permit more advanced forms of
customization.
Packetloss
Packet loss occurs when one or more packets of data travelling across a computer network fail to
reach their destination. Packet loss is distinguished as one of the three main error types encountered in
digital communications; the other two being bit error and spurious packets caused due to noise.
Packets can be lost in a network because they may be dropped when a queue in the network node
overflows. The amount of packet loss during the steady state is another important property of acongestion
control scheme. The larger the value of packet loss, the more difficult it is for transport layer protocols to
maintain high bandwidths, the sensitivity to loss of individual packets, as well as tofrequency and patterns
of loss among longer packet sequences is strongly dependent on the application itself.
Throughput
This is the main performance measure characteristic, and most widely used. In communication
networks, such as Ethernet or packet radio, throughput or network throughput is the average rate of
successful message delivery over a communication channel. The throughput is usually measured in bits
per second (bit/s or bps), and sometimes in data packets per second or data packets per time slot. This
measure how soon the receiver is able to get a certain amount of data send bythe sender. It is determined
as the ratio of the total data received to the end to end delay. Throughput is an important factor which
directly impacts the network performance
Delay
Delayis the time elapsed while a packet travels from one point e.g., source premise or network ingress to
destination premise or network degrees. The larger the value of delay, the more difficult it is for transport
layer protocols to maintain high bandwidths. We will calculate end to end delay
QueueLength
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
The Study of Network simulator(NS )and Simulation of Congestion Control Algorithms using NS
has been done successfully.
EX.no:8
Date: STUDY OFTCP AND UDP PERFORMANCE
AIM
Tomakethestudyof tcp/udpperformanceusingsimulationtool.
PROCEDURE
DEPLOYINGANDCONFIGURINGTHETOPOLOGY
Step1:Makethetopologymultiserver,dnsclient,emailclient,ftpclientandhttpclient asbelowas tools
available in packet tracer.
Step 2: Double click the multiserver – desktop – choose ip configuration – make sure enable
radiobuttononstatic-enteripaddressas192.168.0.2–subnet255.255.255.0–default
gateway – 192.168.0.1 – dns server 192.168.0.2.
Config–Choosehttp–makesureenableradiobuttononhttpandhttps–erasethe html code
and write the customized html code.
Config–Choosedns–makesureenable “on”radiobuttonondnsservice– name: sbc.edu.in –
address : 192.168.0.2 – click add button.
Config–Chooseemail–makesureenable“on”radiobuttononsmtpandpop3 services –
domain name : sbc.edu.in – add two different user name with password by clicking “+
button”.
Config–Chooseftp–makesureenable“on”radiobuttononftpservices– provide user
name and password for file access on user setup part – check all privileges –
click“+button”toadd currentftpuser.
Step 3 :Double click the http client – desktop – choose ip configuration – make sure enable
radiobuttononstatic-enteripaddressas192.168.0.3–subnet255.255.255.0–default gate
Desktop – choose e mail – your name : user name given in email server configuration –
emailaddress@domainnameforexample:[email protected]–incomingand
outgoingmailserverassbc.edu.in–provideusernameandpasswordthatgiveninemail server
configuration and click “save” button – inbox will appears.
Step 4 : Double click the ftp client – desktop – choose ip configuration – make sure enable
radiobuttononstatic-enteripaddressas192.168.0.4–subnet255.255.255.0–default
gateway – 192.168.0.1 – dns server 192.168.0.2.
Step 5 : Double click the dns client – desktop – choose ip configuration – make sure enable
radiobuttononstatic-enteripaddressas192.168.0.5–subnet255.255.255.0–default
gateway – 192.168.0.1 – dns server 192.168.0.2.
Step 6 : Double click the email client – desktop – choose ip configuration – make sure enable
radiobuttononstatic-enteripaddressas192.168.0.6–subnet255.255.255.0–default
gateway – 192.168.0.1 – dns server 192.168.0.2.
Desktop – chooseemail – your name : username2 given in email server configuration –
emailaddress@domainnameforexample:[email protected]–incomingand
outgoingmailserverassbc.edu.in–provideusernameandpasswordthatgiveninemail server
configuration and click “save” button – inbox will appears.
GENERATINGNETWORKTRAFFICS
Step6:Generatetraffictopopulateaddressresolutionprotocol(arp)tables,clickmultiserver –click desktop
– commamd prompt – enter the ping 192.168.0.255command.
Step 8 : Generate ftp traffic – stay with simulation mode – click ftp client– click desktop –
commamdprompt–entertheftp192.168.0.2command–pduwillappear–don’tclosethecurrent window
just minimize it.
Step 9 : Generate dns traffic – stay with simulation mode – click dns client– click desktop –
commamdprompt–enterthenslookupsbc.edu.incommand–pduwillappear–don’tclosethe current
window just minimize it.
Step10:Generateemailtraffic–staywithsimulationmode–clickemailclient–clickdesktop– email–
inbox willappear–composeamailtouser1withuser1’smailid –clicksendbutton–pdu will appear –
don’t close the current window just minimize it.
EXAMININGTHEFUNCTIONALITYOFTCPAND UDP
Step12:Clickcapture/forwardagain,someofthepdusaredisappearastheyare saved in th
queue.
Step13:Clickcapture/forward sixtimes,alltheclientsreceivedthereply.
Step14:Finallybythe waythestudyandexaminingoftcp/udpisvisualisedinpackettracer as shown
in the following diagram.
RESULT :
The study of tcp/udp performance using simulation tool has been done successfully.
PROGRAM:
importjava.io.*;
staticintgraph[][];
static int v;
static int e;
publicstatic voidmain(Stringargs[])throwsIOException
BufferedReaderbr=newBufferedReader(newInputStreamReader(System.in));
v = Integer.parseInt(br.readLine());
System.out.println("PleaseenterthenumberofEdges:"); e =
Integer.parseInt(br.readLine());
graph=newint[v][v]; via
= new int[v][v];
rt = new int[v][v];
if(i == j)
graph[i][j] = 0;
else
graph[i][j]= 9999;
}
for(inti =0; i<e; i++)
System.out.println("PleaseenterdataforEdge"+(i+1)+":");
System.out.print("Source: ");
ints=Integer.parseInt(br.readLine());
s--;
System.out.print("Destination:");
intd=Integer.parseInt(br.readLine());
d--;
System.out.print("Cost:");
intc=Integer.parseInt(br.readLine());
graph[s][d] = c;
graph[d][s]=c;
dvr_calc_disp("TheinitialRoutingTablesare:");
ints=Integer.parseInt(br.readLine());
s--;
System.out.print("PleaseentertheDestinationNodefortheedgewhosecosthas changed:
");
intd=Integer.parseInt(br.readLine());
d--;
System.out.print("Pleaseenterthenewcost:"); int c
= Integer.parseInt(br.readLine()); graph[s][d] =
c;
graph[d][s]=c;
dvr_calc_disp("ThenewRoutingTablesare:");
}
staticvoid dvr_calc_disp(Stringmessage)
System.out.println();
init_tables();update_tables();
System.out.println(message);
print_tables();
System.out.println();
staticvoidupdate_table(int source)
if(graph[source][i]!=9999)
intdist=graph[source][i];
intinter_dist=rt[i][j];
if(via[i][j] == source)
inter_dist = 9999;
if(dist+inter_dist<rt[source][j])
rt[source][j]=dist+inter_dist;
via[source][j] = i;
}
}
int k =0;
update_table(k);
k++;
if(k==v) k
= 0;
if(i==j)
rt[i][j] =0;
via[i][j] =i;
else
{
rt[i][j]=9999;
via[i][j] =100;
System.out.print("Dist:"+rt[i][j]+" ");
System.out.println();
}
OUTPUT:
RESULT:
Thus the program has been executed successfully
PROGRAM:
import java.io.BufferedReader;
import java.io.IOException;
importjava.io.InputStreamReader;
class Graph
int nodes;
int edges;
intgrph[][];
voidaccept()throws IOException
BufferedReaderbr=newBufferedReader(newInputStreamReader(System.in));
nodes = Integer.parseInt(br.readLine());
System.out.println("Enternumberofedges:"); edges
= Integer.parseInt(br.readLine());
grph=newint[nodes][nodes];
grph[i][j] = 9999;
System.out.println("Entersourcenodeforedge"+(i+1)); int
source = Integer.parseInt(br.readLine());
System.out.println("Enterdestinationnodeforedge"+(i+1)); int
destination = Integer.parseInt(br.readLine());
System.out.println("Enterthedistancefortravelingfromnode"+source+"to"+
destination);
intdistance=Integer.parseInt(br.readLine());
classlsra{
staticvoiddijk(Graphg,intsrc)
Stringpath[]=newString[g.nodes];
distance[i]=9999;
previous[i]=-1;
path[i] = "";
distance[src]=0;
if(distance[i]+g.grph[i][j]< distance[j])
{
distance[j]=distance[i]+g.grph[i][j];
previous[j] = i;
intcurrent=i; do
path[i]="-"+(current+1)+path[i]; current =
previous[current];
while(current!=-1);
path[i]=path[i].substring(1,path[i].length());
System.out.println();
if(i!=src)
System.out.println("Theshortestpath&itsdistancefornode"+(i+1)+"is:");
System.out.println("Distance:"+ distance[i]);
}
publicstatic voidmain(Stringargs[])throwsIOException
Graphg=newGraph(); g.accept();
dijk(g,0);
}
OUTPUT:
RESULT :
The simulation of link state routing algorithm using java programming has
been done successfully
PROGRAM:
importjava.io.*;
class crc
BufferedReaderbr=newBufferedReader(newInputStreamReader(System.in)); int[]
data;
int[]div;
int[]divisor;
int[]rem;
int[]crc;
int data_bits,divisor_bits,tot_length;
System.out.println("enterbnumberofdatabits:");
data_bits=Integer.parseInt(br.readLine());
data=new int[data_bits];
for(int i=0;i<data_bits;i++)
data[i]=Integer.parseInt(br.readLine());
System.out.println("enternumberofbitsindivisor:");
divisor_bits=Integer.parseInt(br.readLine());
divisor=new int[divisor_bits];
for(int i=0;i<divisor_bits;i++)
divisor[i]=Integer.parseInt(br.readLine());
for(inti=0;i<data_bits;i++)
System.out.print(data[i]);
System.out.println();
System.out.print("divisorbitsare:");
for(int i=0;i<divisor_bits;i++)
System.out.print(divisor[i]);
System.out.println();
tot_length=data_bits+divisor_bits-1;
div=new int[tot_length];
rem=new int[tot_length];
crc=new int[tot_length];
for(inti=0;i<data.length;i++)
div[i]=data[i];
System.out.print("dividend(afterappending0's)are:");
for(int i=0;i<div.length;i++)
System.out.print(div[i]);
System.out.println();
for(intj=0;j<div.length;j++){
rem[j]=div[j];
rem=divide(div,divisor,rem);
for(int i=0;i<div.length;i++)
crc[i]=(div[i]^rem[i]);
System.out.println();
System.out.println("crccode:");
for(int i=0;i<crc.length;i++)System.out.print(crc[i]);
System.out.println();
System.out.println("entercrccodeof"+tot_length+"bits:");
for(int i=0;i<crc.length;i++)
crc[i]=Integer.parseInt(br.readLine());
for(inti=0;i<crc.length;i++)
System.out.print(crc[i]);
System.out.println();
for(intj=0;j<crc.length;j++){
rem[j]=crc[j];
rem=divide(crc,divisor,rem);
for(int i=0;i<rem.length;i++)
if(rem[i]!=0)
System.out.println("error");
break;
if(i==rem.length-1)
System.out.println("Noerror");
staticint[]divide(intdiv[],intdivisor[],intrem[])
int cur=0;
while(true)
for(int i=0;i<divisor.length;i++)
rem[cur+i]=(rem[cur+i]^divisor[i]);
while(rem[cur]==0&&cur!=rem.length-1)
cur++;
if((rem.length-cur)<divisor.length)
break;
returnrem;
}
OUTPUT:
RESULT:
Thus the program was executed successfully.