0% found this document useful (0 votes)
14 views33 pages

RAGHAV Computer Network Lab

The document is a practical file for a Computer Network Lab, detailing various programs and experiments related to TCP/IP, UDP performance, networking devices, and protocols. It includes an index of programs, descriptions of TCP and UDP, and an overview of networking devices such as hubs, switches, routers, and cables used for interconnection. The document serves as a comprehensive guide for understanding the fundamentals of computer networking and its components.

Uploaded by

ritikakaurrdoppw
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views33 pages

RAGHAV Computer Network Lab

The document is a practical file for a Computer Network Lab, detailing various programs and experiments related to TCP/IP, UDP performance, networking devices, and protocols. It includes an index of programs, descriptions of TCP and UDP, and an overview of networking devices such as hubs, switches, routers, and cables used for interconnection. The document serves as a comprehensive guide for understanding the fundamentals of computer networking and its components.

Uploaded by

ritikakaurrdoppw
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Raghav(8519143)

PRACTICAL
FILEOF
COMPUTER NETWORK
LAB(PC-CS-308L)

SUBMITEDTO:-- SUBMITTEDBY:--

Dr. VishalGarg Raghav


AP,CSE Deptt. CSE YEAR

JMIETI (8519143)

DepartmentofComputerScienceandEngineering
Jai Parkash Mukand Lal Innovative Engineering & Technology
InstituteRadaur – 135133 (YamunaNagar)
(AffiliatedtoKurukshetraUniversity,Kurukshetra,Haryana,India)
INDEX

[Link] Program Date Remarks


1 Program To Study About TCP/IP &
UDPPerformance.
2 ToStudyAboutvariousnetworkingconnectingdevice
andwire used forinterconnection.

Devices:Hub,Switch,Router,Bridge,Gateway,Repe
ater,AccessPoints.

Cables:ConsoleCable,FibreOptic,CoaxialCable,Tw
isted Pair, DCE& DTECable
3 PerformanceComparisonofMACProtocol.
4 PerformanceComparisonofRoutingProtocol.
5 StudyAboutARP/RARPProtocol.
6 BasicJavaPrograms:
A.)Check ANumberIsEvenOr Odd.
B.) Find The Greatest Among Three
Numbers.C.) Check A Number Is Prime
Number Or Not.D.)Print Fibonacci Series.
C.)PrintThePatterns.
Raghav(8519143)
Program:1

ProgramToStudyAboutTCP/IP&UDPPerformance.

Abstract
TCP,whichstands forTransmission Control Protocol,andUDP, orUserDatagramProtocol,arepartofthe
[Link] differentmethodstosendinformationacrosstheinternet.

Introduction
Theinternetprotocolsuiteisacollectionofdifferentprotocols,ormethods,fordevicestocommunicatewitheac
[Link] major protocolswithintheinternetprotocolsuite:

1. TCP
The important protocol is Transmission Control Protocol (TCP) used for transmission in a
[Link] widely uses TCP protocol for data transmission in communication network. In order to
performtransmissionconnection is established betweentheclient and theserver.

Connection is initiated by the Client and sends Sequence number along with the segment. So
theServer acknowledges it back with its own Sequence number and ACK of clients segment which is one
morethanclients Sequencenumber.

ClientafterreceivingACKofitssegment sendsanacknowledgement ofServersresponse..


1
Raghav(8519143)
CP is used in situations where it's necessary that all data being sent by one device is received by
anothercompletelyintact.
For example, when you visit a website, TCP is used to guarantee that everything from the text, images,
andcode needed to render the page arrives. Without TCP, images or text could be missing, or arrive in
theincorrectorder,breaking thepage.
TCP is a connection-oriented protocol, meaning that it establishes a connection between two devices
beforetransferringdata,and maintainsthat connection throughoutthetransferprocess.
Toestablisha connectionbetweentwodevices, TCPusesamethodcalled athree-wayhandshake:

For example, to read this article on your device, your device first sent a message to the freeCodeCamp
Newsserver calledan SYN(SynchronizeSequence Number).
ThenthefreeCodeCampNews serversendsback anacknowledgementmessagecalled aSYN-ACK.
When your device receives the SYN-ACK from the server, it sends an ACK acknowledgment message
back,whichestablishestheconnection.
OnceaTCPconnectionisestablishedbetweentwodevices,theprotocolguaranteesthatalldataistransmitted.
Going back to the example of your device and freeCodeCamp News, once the three-way handshake
iscomplete, the News server can start sending all the data your device's web browser needs to render
thisarticle.
All devices break up data into small packets before sending them over the internet. Those packets then
needtobereassembled on theotherend.
So when the freeCodeCamp News server sends the HTML, CSS, images, and other code for this article,
[Link]
ackets intothefiles andimages it needsto renderthisarticle.
TCP ensures that these packets all arrive to your device. If any packets are lost along the way, TCP makes
iteasyforyourdevicetolettheserverknowit'smissingdata,andfortheservertoresendthosepackets.

2
Raghav(8519143)

2. UDP
The User Data-gram Protocol (UDP) is simplest Transport Layer communication protocol
availableof the TCP/IP protocol suite. Communication mechanisminvolved is minimum. UDP is an
unreliabletransportprotocolwhichuses IPservicesto providebestdelivery mechanism.
In UDP, there is no generation of acknowledgement of received packets to sender and senders do
notwait for any acknowledgement in turn of packet. This makes UDP protocol unreliable on processing.
UDP isimplemented where packet acknowledgement have same significance on bandwidth as that actual
data. Incase of video streaming, thousands of packets are generated towards its users. Acknowledging all
[Link] of
underlying IP protocol ensures best efforts to deliver its packets, but even if some packets invideo streaming
get lost, the impact is can be ignored easily. Loss of few packets is sometimes neglected incase ofvideoand
voicetrafficsometimesgoesunnoticed.

3
Raghav(8519143)

UDP, or User Datagram Protocol, is another one of the major protocols that make up the internet
[Link] is less reliablethan TCP,but is much simpler.
UDP is used for situations where some data loss is acceptable, like live video/audio, or where speed is
acriticalfactorlikeonlinegaming.
While UDPis similar to TCP in that it's used to send and receive data online, there are a couple
ofkeydifferences.
First, UDP is a connectionless protocol, meaning that it does not establish a connection
beforehandlikeTCPdoes with its three-way handshake.
Next, UDP doesn't guarantee that all data is successfully transferred. With UDP, data is sent to
anydevice that happens to be listening, but it doesn't care if some of it is lost along the way. This is one of
thereasonswhy UDP is also knownasthe"fire-and-forget" protocol.
[Link] A asks
person B to talk. Person B says sure, that's fine. Person A agrees and they both start
[Link]
dhearmostofwhatthey'[Link] there'sno guaranteethateveryone in the areawillhearwhat theprotester
issaying,orthat they'reevenlistening.

4
Raghav(8519143))
Program:2

To Study About various networking connecting device and wire used


forinterconnection.

Devices:Hub,Switch,Router, Bridge,Gateway,Repeater,AccessPoints.

Cables:ConsoleCable,FibreOptic,CoaxialCable,TwistedPair,DCE&DTEConnector

Networkdevices,ornetworkinghardware,arephysicaldevicesthatarerequiredforcommunicationandinteractionbet
weenhardwareon acomputernetwork.

Devices
 Hub

Hubs connect multiple computer networking devices together. A hub also acts as a repeater in that
itamplifies signals that deteriorate after traveling long distances over connecting cables. A hub is the
simplestinthefamilyofnetworkconnecting devicesbecauseitconnectsLAN componentswithidenticalprotocols.

A hub can be used with both digital and analog data, provided its settings have been configured
toprepare for the formatting of the incoming data. For example, if the incoming data is in digital format,
thehub must pass it on as packets; however, if the incoming data is analog, then the hub passes it on in
signalform.
Hubs do not perform packet filtering or addressing functions; they just send data packets to
allconnected devices. Hubs operate at the Physical layer of the Open Systems Interconnection (OSI)
[Link] aretwo types ofhubs:simpleand multiple port.

 Switch

Switches generally have a more intelligentrole than hubs. A switch is a multiport devicethatimproves
network efficiency. The switch maintains limited routing information about nodes in the internalnetwork,
and it allows connections to systems like hubs or routers. Strands of LANs are usually connectedusing
switches. Generally, switches can read the hardware addresses of incoming packets to transmit them
totheappropriatedestination.
5
Raghav(8519143))
Using switches improves network efficiency over hubs or routers because of the virtual
circuitcapability. Switches also improve network security because the virtual circuits are more difficult to
examinewith network monitors. You can think of a switch as a device that has some of the best capabilities
of routersand hubs combined. A switch can work at either the Data Link layer or the Network layer of the
OSI model.A multilayer switch is one that can operate at both layers, which means that it can operate as both
a switchand a router. A multilayer switch is a high-performance device that supports the same routing
protocols asrouters.

Switches can be subject to distributed denial of service (DDoS) attacks; flood guards are used
toprevent malicious traffic from bringing the switch to a halt. Switch port security is important so be sure
tosecure switches: Disable all unused ports and use DHCP snooping, ARP inspection and MAC
addressfiltering.

 Router

Routershelptransmitpacketstotheirdestinationsbychartingapaththroughtheseaofinterconnected
networking devices using different network topologies. Routers are intelligent devices, andthey store
information about the networks they’re connected to. Most routers can be configured to operate aspacket-
filteringfirewalls anduseaccesscontrollists(ACLs).

6
Raghav(8519143)
Routers, in conjunction with a channel service unit/data service unit (CSU/DSU), are also used
totranslate from LAN framing to WAN framing. This is needed because LANs and WANs use
differentnetwork protocols. Such routers are known as border routers. They serve as the outside connection
of a LANtoaWAN, and theyoperateattheborderofyournetwork.

Router are also used to divide internal networks into two or more subnetworks. Routers can also
beconnectedinternallytootherrouters,[Link]
[Link] about the systems
connected to it and where to send requests if the destination isn’t [Link] usually communicate
routing and other information using one of three standard protocols:
RoutingInformationProtocol(RIP),Border GatewayProtocol(BGP) orOpenShortestPathFirst(OSPF).

 Bridge

Bridges are used to connect two or more hosts or network segments together. The basic role
ofbridges in network architecture is storing and forwarding frames between the different segments that
thebridge connects. They use hardware Media Access Control (MAC) addresses for transferring frames.
Bylooking at the MAC address of the devices connected to each segment, bridges can forward the data or
[Link].

Bridges work only at the Physical and Data Link layers of the OSI model. Bridges are used to
dividelarger networks into smaller sections by sitting between two physical network segments and managing
theflowofdatabetween thetwo.

 Gateway
[Link] and
above, there are numerous protocols and standards from different vendors; gateways are used
[Link]
on(OSI)andTransmissionControlProtocol/InternetProtocol(TCP/IP).Becauseofthis,gateways connect two or
more autonomous networks, each with its own routing algorithms,
protocols,topology,domainnameservice,andnetworkadministration proceduresandpolicies.

7
Raghav(8519143)

Gateways perform all of the functions of routers and more. In fact, a router with added
translationfunctionality is a gateway. The function that does the translation between different network
technologies iscalledaprotocol converter.

 Repeater
A repeater is an electronic device that amplifies the signal it receives. You can think of repeater as
adevicewhichreceivesasignalandretransmitsitatahigherlevelorhigherpowersothatthesignalcancoverlongerdista
nces,[Link] onthePhysicallayer.

 AccessPoint
Whileanaccesspoint(AP)cantechnicallyinvolveeitherawiredorwirelessconnection,itcommonly means
a wireless device. An AP works at the second OSI layer, the Data Link layer, and it canoperate either as a
bridge connecting a standard wired network to wireless devices or as a router passing
datatransmissionsfromoneaccess point to another.
8
Raghav(8519143)

Wireless access points (WAPs) consist of a transmitter and receiver (transceiver)device used tocreate
a wireless LAN (WLAN). Access points typically are separate network devices with a built-in
antenna,transmitter and adapter. APs use the wireless infrastructure network mode to provide a connection
pointbetweenWLANsand awired EthernetLAN.

Cables
 ConsoleCable

TheConsoleCableisusedfortheserialconnectionbetweenyourcomputer’sserialportandtheconsoleportonyo
urTP-Linkswitch orrouter toaccesstheCLI(CommandLine Interface)ofthe device.

herearemanykindsofConsolecableinthemarket,themaintwotypesofConsolecablethatTP-Linkuses is
shownin thepicturesbelow:

Type1:RS232DB9 MaleHead<-->RS232DB9 Female Head

Type2:RS232DB9 Female Head<-->RJ45connector

We highly recommend you to use the original Console Cable that comes with the product, but if you lost
theConsole Cable by accident and need to use a third-part Console Cable or make one by yourself, please
makesurethelinesequenceofthecable’s connectors iscorrect.

9
Raghav(8519143)
Here we take the Type 2 Console Cable which is used for TP-Link products on shipment now as example
tointroduce the line sequence and its corresponding relationship of the RS232 DB9 female head and the
RJ45head.

 FibreOptic
Optical fiber is the technology associated with data transmission using light pulses travelling
alongwith a long fiber which is usually made of plastic or glass. Metal wires are preferred for transmission
inoptical fiber communication as signals travel with fewer damages. Optical fibers are also unaffected
byelectromagnetic interference. The fiber optical cable uses the application of total internal reflection of
[Link] on
the requirement of power and distance of transmission. Single-mode fiber is used for long-distance
transmission, while multitude fiber is used for shorter distances. The outer cladding of these
fibersneedsbetterprotectionthan metal wires.

 Coaxialcables
Coaxial cables, commonly called coax, are copper cables with metal shielding designed to
provideimmunity against noise and greater bandwidth. Coax can transmit signals over larger distances at a
higherspeedas compared to twisted paircables.
Coax has a central core of stiff copper conductor for transmitting [Link] is covered by
aninsulating material. The insulator is encased by a closely woven braided metal outer conductor that acts as
ashield against noise. The outer conductor is again enclosed by a plastic insulating cover. The structure
isshownin thefollowing figure−

10
Raghav(8519143)
 Twisted-PairCable
[Link] two
separate insulated copper wires, which are twisted together and run in parallel. The copper wires
[Link] ofthewiresisusedtotransmitdataandtheother isthegroundreference.
All transmissions are prone to noise, interferences, and crosstalks. When the wires are twisted,
somepart of the noise signals is in the direction of data signals while the other parts are in the opposite
[Link] the external waves cancel out due to the different twists. The receiver calculates the
difference in thevoltagesofthetwowiresfor [Link] noise isobtained.

 DCE &DTEConnector
All RS232 devices that use a DB-9 connector should conform to the standard TIA/EIA-574.
Thedevice should be either DCE or DTE. DCE devices should have a female DB-9 connector, and DTE
devicesshould haveamaleDB-9connector. Foradescriptionofpin outs fortheRS232 DB-9connectorseeattached
document "[Link]" from Cisco (page 2). Any RS232 device that has a DB-9 connectorand
conforms to this standard will connect easily to the Digi PKG-R (PKGR) or development kit radiomodems.

11
Raghav(8519143)
Program:3

PerformanceComparisonofMACProtocol.

Abstract
Wireless SensorNetworks(WSN)arebecomingprevalentandrepresentthenextgreatchangeoccurring to
the Internetand our living [Link] are usedin the medicalfield, smarthome andsmartgrid initiatives,
sports training, forestry and wildlife monitoring, and numerous other disciplines. WSNdeployments are
expected to work for long durations on scarce energy supply and stay reliable with nomaintenance. To allow
WSN applications to optimize their energy consumption, reliability, or
throughputthispaperstudiestheperformancecharacteristicsof twoMACprotocols,namelyRI-MACandBoX-
MAC.

Introduction
Theupwardtrendinwirelesscommunicationcausedresearcherstoenvisionanddevelopaplethoraof
Medium Access Control (MAC) protocols. However, it is often not clear which protocol should
anapplication us for higher reliability, lower energy consumption, or specific throughput demand.
BecauseWSN are deployed in remote areas, on bridges and building in hard to reach places, and are expected
tooperate with close to zero maintenance – it is important that we will be able to optimize for given
[Link] papermakesyetanothersteptowardsthisgoal.

MACprotocols

Open Systems Interconnection [OSI1980] defines computer-to-computer communication as having seven


(ormore modernly five) layers. See Table 1: . Each layer abstracts the details of various mechanisms that
apacket (a piece of data) traveling from one computer to another goes through. These abstraction layers
(atleastbythe OSIplan) allowforthereplacementofonelayer withan updatedversionofitsservices.

OSINetwork layers model


Layer
Location Data unit Number Name Function
Data 7 Application Whichevertheapplication functionalityis
6 Presentation Notinuse
Host HosttoHostcommunication,managingsessionsbetw
5 Session
eenapplications
End-to-End connections, reliability and
Segments 4 Transport
flowcontrol
Packet 3 Network Pathdetermination andlogicaladdressing
Media Frame 2 Datalink Physicaladdressing,Channelaccesscontrol
Bit 1 Physical Media,signalandbinarytransmission
AdaptedformWikipedia,TheFreeEncyclopedia

Multiple access protocols are a set of protocols operating in the Medium Access Control
sublayer(MAC sublayer)of the Open Systems Interconnection (OSI)model. Theseprotocols allow a
numberofnodes or users to access a shared network channel. Several data streams originating from several
nodes aretransferredthrough themulti-pointtransmission channel.

The objectives of multiple access protocols are optimization of transmission time, minimization
ofcollisionsandavoidanceofcrosstalks.

12
Raghav(8519143)
The MAC protocol is a part of layer 2, the data link layer. The data link layer is responsible
fortransferring frames between networks hosts. The MAC provides physical addressing and channel
accesscontrolmechanisms(accesscontrol allowsseveralhoststo communicate oversharedmedium).

[Link]
are-

1. DataLink Control
2. MultipleAccessControl

Data Linkcontrol–
The data link controlis responsible for reliabletransmission of message over transmission channelby
using techniques like framing, error control and flow control. For Data link control refer to – Stop
andWaitARQ

MultipleAccess Control–
If there is a dedicated link between the sender and the receiver then data link control layer
issufficient, howeverif thereis no dedicated link presentthen multiple stations can access the
channelsimultaneously. Hence multiple access protocols are required to decrease collision and avoid
crosstalk. Forexample, in a classroom full of students, when a teacher asks a question and all the students (or
stations) startanswering simultaneously (send data at same time) then a lot of chaos is created( data overlap
or data lost)then it is the job of the teacher (multiple access protocols) to manage the students and make them
answer oneatatime.

Thus, protocols are required for sharing data on non dedicated channels. Multiple access
protocolscanbesubdivided furtheras –

Multipleaccessprotocolsaregenerallyusedtocoordinateaccesstolink,herenodescanregulatetheir
transmission onto the shared broadcast channels by using multiple access protocol, It is used on
bothwiredand wirelessLANandsatellitenetwork.
Multiple nodes can transmit frames at the same time, if so the transmitted frame collides at the
entirereceiver. When there is a collision, there is no acknowledgement to the receiver that the frame is
transmittedornot.
Thus, all frames involved in the collision are lost, and the broadcast channel is wasted during
[Link] thisproblemMultipleAccess protocolisimplemented.

VariousMultipleaccesschannelsare−Sharedwire(Ethernet),shared wireless, satellite.


Multiple access protocols arise not only in the communications systems but as well in a lot of
othersystems such as the computer system, the storage facility or the server of any kind, where the resources
aresharedthrough thenumberofindependentusers.

13
Raghav(8519143)
ClassificationofMultipleAccessProtocol

Themultipleaccessprotocolisclassifiedintofollowingtypes−

RandomaccessMACprotocols

TherandomaccessMACprotocolsareexplainedbelowinastepwisemanner.

Step 1 − In a random access MAC protocol, the transmitting node always transmits at full strength of
thechannel.
Step2 − When there is a collision, each node that is involved in the collision repeatedly retransmits its
frameuntiltheframegetsthroughwithoutacollision.
Step 3 − But when a node experiences a collision, it does not necessarily retransmit the frame right
[Link],itwaitsarandomdelaybeforeretransmitting theframe.
Step 4 − Each node involved in a collision chooses independent random delays. Because after a collision
therandom delays are independently chosen, it is possible that one of the nodes will pick a delay that
issufficiently less than the delays of the other colliding nodes, and will therefore be able to transmit its
frameintothechannel without acollision.
Step 5 − Such a system is more random and there is no guarantee that a station will be able to transmit in
thegivenmedium dueto morepossibilitiesofcollisions.
Step6−Butthere are certainprotocolsthathelptoreduce thecollisions.

Theprotocolsusedhereare asfollows−
 ALOHA
 SLOTTEDALOHA
 CSMA(CarrierSenseMultipleAccess)
 CSMA-CD(CSMAwithCollisionDetection)
 CSMA-CA(CSMAwithCollisionavoidance)

14
Raghav(8519143)
ChannelPartitioningProtocolsorconflictfreeprotocol

Thechannelpartitioningorconflict freeprotocolsare explainedbelowinstepwisemanner.

Step 1 − The protocols used in his format is Time Division Multiplexing (TDM) and Frequency
DivisionMultiplexing (FDM) the other is Code Division Multiple Access (CDMA) here, as the name says,
thechannelispartitionedonthebasisoffrequency,timedependingontheprotocolusedandeachparticipant/senderuse
sthechannelinthetimeor frequency slotassigned specificallyforthem.
Step 2 − This type of partitioning ensures that each user has a predefined time/frequency slot to use
themedium.
Step 3 − Suppose there are n nodes in TDM. The transmission time is divided into n nodes, and each
nodewouldbegiven aparticularslotto transmit over themedium.
Step 4 − In FDM the frequency bandwidth is divided into certain slots and each node would send
itstransmissioninthat particularfrequency.
Step 5 − In CDMA each node is assigned a unique code to transmit so that multiple transmissions can
takeplace between different nodes, without thedanger ofcollision.

FunctionsofMAC

ThefunctionsperformedbyMediumAccessProtocolaregivenbelow−

 It delimitsand recognizestheframes
 It isresponsibleforaddressing atlayer2
 Errorcheckingbyusingframecheck sequences(FCS)
 Physicaltransmissionmedium'saccesscontrol

15
Raghav(8519143)
Program:4

PerformanceComparisonofRoutingProtocol.

Abstract
Aroutingprotocolisaprotocolthatspecifieshowrouterscommunicatewitheachother,disseminating
information that enables them to select routes between any two nodes in a computer [Link] choice of
route is done by routing algorithms. Each router possesses prior knowledge of networks thathas been directly
related. A routing protocol shares this information first among immediate neighbors, andthen throughout the
network. By this way, routers gain knowledge of topology of network. There are manyroutingprotocols used
for routing purposes likeRIP,EIGRP andOSPF.

Introduction
In IP networks, the main responsibility of a routing protocol is to carry packets forwarded from
onenode to different. In a network, routing can be defined as transmitting information from a source to
adestination by one-hoppingor multi hopping. Routing protocols should provide atleasttwo
facilities:selecting routes for different pairs of source/destination nodes and, successfully transmitting data to
a givendestination. Routing protocols are used to describe how routers communicate to each other, learn
availableroutes,buildroutingtables,[Link]
o connect various networks and to provide packet forwarding for other types of networks. The main goal
ofroutingprotocols is to discoverthebestpath from asource to adestination.

PerformanceMetrics
There are severalmetrics to analyze routing protocols over Riverbed Modeler. Delay,throughput,and
convergence duration as performance metrics can supply us a wide aspect of how a given routingprotocol
over different networks topology behaves and we can recover from that whether the protocol isproper for the
topology or not, with this we will also determine there are different metrics to examine routingprotocols over
Riverbed Modeler. Delay, throughput, and convergence duration as performance metrics cangive us a wide
view of how a given routing protocol over different network topology behaves and we canretrieve from that
whether the protocol is suitable for the topology or not, with this we will also discover
theperformanceoftheprotocols,overagivendataratestoseehowitadoptswithdifferentdataRates(increasing) as (1,
2,4, 8)Mbps. Performance metricsaredetailedbelow:

End-to-Enddelay:orE-to-
Edelayistheaverageofsuccessfullycompletedpacketsfromonesourcetodestinationoveranetwork.

Throughput: is the average of successfully delivered packets (messages) per unit of time (seconds)
througha communication channel. In computer networks, throughput is measured in bits per second and
somesituationsin datapacketspersecond.

Convergence: duration is the time in which a group of routers reaches the state of convergence by
creatingrouting tables after the convergence each router gets a map of the topology it resides from there each
routerdecides which packet should be sent in which route. Optimally the routing protocols must have a
quickconvergence time. Itis measuredbytheratepersecond.

 Routingprotocols

Dynamic routes are routes learned via routing protocols. Routing protocols are configured on
routerswith the purpose of exchanging routing information. There are many benefits of using routing
protocols inyour network,such as:

16
Raghav(8519143)
 unlikestaticrouting,youdon’[Link]
oconfigure thenetworksto beadvertisedon a routerdirectlyconnectedto them.
 ifalinkfailsandthenetworktopologychanges,routerscanadvertisethatsomerouteshavefailedandpickanewrou
teto that network.

Typesofroutingprotocols
Therearetwotypesof routingprotocols:
1. Distancevector(RIP,IGRP)
2. Linkstate(OSPF,IS-IS)

Cisco has created its own routing protocol – EIGRP. EIGRP is considered to be an advanced
distancevector protocol, although some materials erroneously state thatEIGRP is a hybrid routing protocol,
acombinationofdistancevectorand link state.

All of the routing protocols mentioned above are interior routing protocols (IGP), which means
thatthey are used to exchange routing information within one autonomous system. BGP(Border
GatewayProtocol) is an example of an exterior routing protocol (EGP) which is used to exchange routing
informationbetweenautonomous systems on theInternet.

Distancevectorprotocols
As the name implies, distance vector routing protocols use distance to determine the best path to
aremote [Link] distanceissomethinglikethenumberof hops(routers) tothedestinationnetwork.

Distance vector protocols usually send the complete routing table to each neighbor (a neighbor
isdirectly connected router that runs the same routing protocol). They employ some version of Bellman-
Fordalgorithm to calculate the best routes. Compared with link state routing protocols, distance vector
protocolsare easier to configure and require little management, but are susceptible to routing loops and
convergeslower than the link state routing protocols. Distance vector protocols also use more bandwidth
because theysend complete routing table, while the link state procotols send specific updates only when
topology changesoccur.

RIPandEIGRPareexamplesofdistancevectorroutingprotocols.

These protocols select the best path on the basis of hop counts to reach a destination network in a
particulardirection. Dynamic protocol like RIP is an example of a distance vector routing protocol. Hop
count is eachrouter that occurs in between the source and the destination network. The path with the least
hop count willbechosenas thebestpath.

Features–

 Updatesofthenetwork areexchanged periodically.


 Updates(routinginformation)arealwaysbroadcast.
 Fullroutingtablesare sentinupdates.
 [Link].

Disadvantages–

 Astheroutinginformationisexchangedperiodically,unnecessarytrafficisgeneratedwhichconsumesavailable
bandwidth.
 Asfullroutingtablesareexchanged,[Link],the
n thewholetopologywill beveryeasy tounderstand.
 Also,thebroadcastingofthenetworkperiodicallycreatesunnecessarytraffic.

17
Raghav(8519143)
Linkstateprotocols
Link state routing protocols are the second type of routing protocols. They have the same
basicpurpose as distance vector protocols, to find a best path to a destination, but use different methods to do
[Link] distance vector protocols, link state protocols don’t advertise the entire routing table. Instead,
theyadvertise information about a network toplogy (directly connected links, neighboring routers…), so that
intheendallroutersrunningalink
[Link]
routingprotocols,supportclasslessrouting,sendupdates using multicast addresses and use triggered routing
updates. They also require more router CPU andmemoryusagethandistance-vectorrouting
protocolsandcanbehardertoconfigure.

These protocolsknow more about Internetworkthananyother distance vector [Link]


are also known as SPF (Shortest Path First) protocol. OSPF is an example of link-state routingprotocol.

Features–

 Hello,messages, alsoknownaskeep-alivemessagesareusedforneighbordiscoveryandrecovery.
 Conceptoftriggeredupdates [Link] aretriggeredonlywhenthereisatopologychange.
 Onlythatmanyupdatesare exchangedwhichisrequestedbytheneighborrouter.

Linkstateroutingprotocolmaintainsthreetablesnamely:

1. Neighbortable-
thetablewhichcontainsinformationabouttheneighborsoftherouteronly,i.e,towhichadjacencyhas
beenformed.

2. Topologytable-
[Link] to
aparticularadvertised networks.

3. Routingtable- Thistablecontainsallthebestroutestotheadvertised network.

Advantages–

 Asitmaintainsseparatetablesforboththebestrouteandthebackuproutes(wholetopology)thereforeithasmorek
nowledge oftheinternetworkthanany otherdistancevector routing protocol.
 Conceptoftriggeredupdatesisusedthereforenomoreunnecessarybandwidthconsumption
isseenlikeindistancevectorrouting protocol.
Partial updates aretriggeredwhen thereis a topologychange, not a full update like
distancevectorroutingprotocol wherethewholerouting tableisexchanged.

Differencebetweendistancevectorandlinkstateroutingprotocols

Thefollowingtablesummarizesthedifferences:

18
Raghav(8519143)
4. AdvancedDistancevectorroutingprotocol:

It is also known as hybrid routing protocol which uses the concept of both distance vector and link-
state routing protocol. Enhanced Interior Gateway Routing Protocol (EIGRP) is an example of this class
ofrouting protocol. EIGRP acts as a link-state routing protocol as it uses the concept of Hello protocol
forneighbor discovery and forming an adjacency. Also, partial updates are triggered when a change
[Link]-vector routingprotocolasitlearnedroutesfrom directlyconnectedneighbors.

19
Raghav(8519143)
Program:5

StudyAboutARP/RARPProtocol.

AddressResolutionProtocol(ARP)

Address Resolution Protocol (ARP) is a network-specific standard protocol. The Address


ResolutionProtocol is important for changing the higher-level protocol address (IP addresses) to physical
[Link] described in RFC 826.

ARP relates an IP address with the physical address. On a typical physical network such as
LAN,each device on a link is identified by a physical address, usually printed on the network interface card
(NIC).Aphysicaladdresscanbechangedeasilywhen NICon aparticularmachinefails.
The IP Address cannot be changed. ARP can find the physical address of the node when its
internetaddress is known. ARP provides a dynamic mapping from an IP address to the corresponding
hardwareaddress.
When one host wants to communicate with another host on the network, it needs to resolve the
IPaddressofeach host to thehost's hardwareaddress.

Thisprocessisas follows−
 When a host tries to interact with another host, an ARP request is initiated. If the IP address is for
thelocal network, the source host checks its ARP cache to find out the hardware address of the
destinationcomputer.
 Ifthe correspondence hardwareaddressisnotfound,ARPbroadcaststhe requesttoallthelocal hosts.
 All hosts receive the broadcast and check their own IP address. If no match is discovered, the request
isignored.
 The destination host that finds the matching IP address sends an ARP reply to the source host along
withits hardware address, thus establishing the communication. The ARP cache is then updated with
thehardware addressofthedestination host.

20
Raghav(8519143)

ARPPacketGeneration
If an application needs to send information to a specific IPdestination address, the IProutingstructure
first determines the IP address of the next-hop of the packet (it should be the destination host
itselforarouter)andthehardwaretoolon which it should betransmitted.
If it is an IEEE 802.3/4/5 network, the ARP structure should be considered to design the
<protocoltype targetprotocol address>to aphysicaladdress.
The ARP module attempts to find the address in this ARP cache. If it is to find the connecting pair,
itprovides the equivalent 48-bit physical location back to the caller (the device driver), which then shares
thepacket.
Ifitdoesnotdiscoverthe pair initstable,itremovesthepacket(theassumptionisthatahigher-levelprotocolwill
resend)andcreatesanetworkbroadcastofanARPrequest.

 Hardwareaddressspace:It specifies thetypeofhardwaresuchasEthernet orPacket Radionet.


 Protocoladdressspace:Itspecifiesthetypeofprotocol,sameastheEthertypefieldintheIEEE802header(IPorA
RP).
 HardwareAddressLength:Itdeterminesthelength(inbytes)of the hardwareaddressesin [Link]
IEEE802.3 and IEEE802.5, this is 6.
 ProtocolAddressLength:Itspecifiesthelength(inbytes)[Link],thisis 4
byte.
 OperationCode:Itspecifieswhetherthisisan ARPrequest(1)orreply(2).
 Source/target hardware address: It contains the physical network hardware addresses. For IEEE
802.3,these are48-bitaddresses.

FortheARPrequestpacket,thetargethardwareaddressisthe onlyundefinedfieldinthe packet.

21
Raghav(8519143)
ReverseAddressResolutionProtocol(RARP)

Reverse Address Resolution Protocol (RARP) is a network-specific standard protocol. It is


describedin RFC 903. Some network hosts, such as a diskless workstation, do not know their own IP address
whenthey are booted. To determine their own IP address, they use a mechanism similar to ARP, but now
thehardware addressofthehostistheknownparameter,andtheIPaddress isthequeriedparameter.
The reverse address resolution is performed the same way as the ARP address resolution. The
samepacketformat is used fortheARP.

Anexceptionistheoperationcode fieldthatnowtakesthefollowingvalues−
1. 3forRARPrequest
2. 4forRARPreply

The physical header of the frame will now indicate RARP as the higher-level protocol (8035
hex)insteadofARP (0806 hex)orIP-(0800hex)in theEthertypefield.

When a framework with a local disk is bootstrapped, it generally accepts its IP address from
aconfiguration document that's read from a disk file. But a system without a disk, including an X terminal or
adisklessworkstation, needs someotherwaytoacceptitsIPaddress.
The feature of RARP is for the diskless framework to read its specific hardware address from
theinterfacecardandsendaRARPrequestaskingforsomeonetoreplywiththedisklesssystemsIPaddress.
The format of a RARP packet is almost identical to an ARP packet. The only difference is that
theframe type is 0X8035 for a RARP request or reply, and the op-field has a value of 3 for a RARP request
and4foraRARPreply.

22
Raghav(8519143)
The problem with RARP includes its use of a link-layer broadcast, preventing most routers
fromforwarding a RARP request, and the minimal information returned just the system's IP address. While
theRARPconcept iseasy,theimplementationofaRARPserveris systemdependent.
SomedifferencesarisefromtheconceptofRARPitself−

 ARP only assumes that every host knows the mapping between its own hardware address and
protocoladdress. RARP requires one or more server hosts in the network to maintain a database of
mappingbetween hardware address and protocol address so that they will be able to reply to requests
from clienthosts.
 Due to the size of this database, part of the server function is usually implemented outside the
adapter−smicrocode, with optionally a small cache in the microcode. The microcode part is then only
responsiblefor reception and transmission of the RARP frames, the RARP mapping itself being taken
care of byserver softwarerunningas anormalprocesson thehostmachine.
 Thenatureofthisdatabasealsorequires somesoftwaretocreateandupdatethedatabasemanually.
 If there are multiple RARP servers in the network, the RARP requests only uses the first RARP
replyreceivedin responsetoitsbroadcastRARPrequestand discardstheothers.

23
Raghav(8519143)
Program:6

BasicJavaPrograms

A. )CheckA Number IsEvenOrOdd

SourceCode:

[Link];

publicclassOddEven {
public static void main(String[] args)
{Scannerconsole=newScanner([Link]);
[Link]("Enter The Number To Check It is Odd Or Even :
");intnumber =[Link]();
if(number%2==0)
{
[Link](number+"IsEvenNumber");
}
else{
[Link](number+"IsOddNumber");
}
}
}

Output:

Fig:CheckingANumberIsOddOrEven

24
Raghav(8519143)
B. )FindTheGreatest AmongThreeNumbers

SourceCode:

[Link];

publicclassGreatestAmongThree{
public static void main(String[] args)
{inta, b, c;
Scannerconsole=newScanner([Link]);

[Link]("Enter The First Number :


");a=[Link]();
[Link]("Enter The Second Number :
");b=[Link]();
[Link]("Enter The Third Number :
");c=[Link]();

if(a>b&&b >c){
[Link](a+"IsGreater Among"+a+","+b+ ","+c);
}
elseif(b>a &&a>c)
{
[Link](b+"IsGreater Among"+a+","+b+ ","+c);

}
elseif(c>a &&a>b)
{
[Link](c+"IsGreaterAmong "+a+","+b +","+c);

}
else{
[Link]("AnyTwoNumbersAreSame!!!");

}
}

Output:

Fig:FindingGreatest AmongTheThreeNumbers

25
Raghav(8519143)
C. )CheckANumber IsPrimeNumber OrNot

SourceCode:

[Link];

publicclassCheckPrime{
public static void main(String[] args)
{intn;
Scanner console = new
Scanner([Link]);[Link]("Enter The
Number To Check : ");n= [Link]();
booleanisprime=false;
for (int i = 2; i <= n / 2; ++i)
{if(n % i==0) {
isprime =
true;break;
}
}
if(!isprime)
[Link](n + " Is A Prime
Number.");else
[Link](n+"IsNotAPrimeNumber.");
}
}

Output:

Fig:CheckingANumberIsPrimeOrNot

26
Raghav(8519143)
D. )PrintFibonacciSeries

SourceCode:

import

[Link];publicclassF

ibonacciSeries{

public staticvoidmain(String[]args){
int n,a,b, c;
Scannerconsole=newScanner([Link]);

[Link]("Please Enter Length Of Series :


");n=[Link]();

a=0;
b=1;

[Link]("Fibonacci Series :
");for(inti =2; i<n;i++) {
c = a +
b;a= b;
b=c;
[Link](c+"");
}
}

Output:

Fig:PrintingFibonacciSeries

27
Raghav(8519143)
E. )PrintThePatterns

1. RightTriangleStarPattern

SourceCode:

publicclassRightTrianglePattern{
public static void main(String args[])
{inti, j, row= 6;
for (i = 0; i < row; i++)
{for(j=0;j<=i;j++) {
[Link]("*");
}
[Link]();
}
}
}

Output:

Fig:PrintingRightTriangleStar Pattern

28
Raghav(8519143)
2. Left Triangle Star

PatternSourceCode:

publicclassLeftTrianglePattern{
public static void main(String args[])
{inti, j, row= 6;
for (i=0;i<row;i++){
for (j = 2 * (row - i); j >= 0; j--)
{[Link]("");
}
for (j = 0; j <= i; j++)
{[Link]("*");
}
[Link]();
}
}
}

Output:

Fig:PrintingLeftTriangleStarPattern

29
Raghav(8519143)
3. PyramidStarPattern

SourceCode:

publicclassPyramidPattern{
public static void main(String args[])
{inti, j, row= 6;
for (i=0;i<row;i++){
for(j=row-i;j>1;j--) {
[Link]("");
}
for (j = 0; j <= i; j++)
{[Link]("*");
}
[Link]();
}
}
}

Output:

Fig:PrintingPyramidStarPattern

30

You might also like