Jit1411/networks Laboratory Manual
Jit1411/networks Laboratory Manual
II YEAR/ IV SEMESTER
Networks Laboratory
Vision of the Department
Networks Laboratory
JERUSALEM COLLEGE OF ENGINEERING
Velachery Main Road, Pallikkaranai, Chennai – 600 100
Name……………………………………………………………………………………
Year…………………………………Semester………………Branch……………….
University Register No .
Certified that this is a Bonafide Record work done by the above student in the
DATE:
Networks Laboratory
Jerusalem College of Engineering Department of CSE
CONTENTS
Networks Laboratory
Networks Laboratory
Ex.No.1
Date Network Commands
AIM:
Learn to use commands like tcpdump, netstat, ifconfig, nslookup and traceroute. Capture ping and traceroute
PDUs using a network protocol analyzer.
1. Tcpdump
Options Description
-D Print a list of Network interfaces.
-i Specify an interface on which to capture.
-c Specify the number of packets to receive
-v,-vv,-vvv Increase the level of detail (verbosity)
-r Read captured data from a file.
-w Write captured data to a file.
Many other options and arguments can be used with tcpdump. The
following are some specific examples of the power of the tcpdump
utility.
Networks Laboratory
or destination (dst) host: # tcpdump src
host
# tcpdump dst host
Networks Laboratory
Provide the protocol as an argument to display only traffic for a specific protocol, for example tcp,
udp, icmp, arp:
# tcpdump protocol
# tcpdump tcp
2.Netstat
Networks Laboratory
Syntax
netstat [-a] [-e] [-n] [-o] [-p Protocol] [-r] [-s] [Interval]
Parameters
Used without
displays active TCP
connections. parameters
Displays all active TCP connections and the TCP and UDP ports on
-a
which the computer is listening.
-e Displays Ethernet statistics, such as the number of bytes and packets sent and
3. Ifconfig
Using ipconfig
From the command prompt, type ipconfig to run the utility with default options.
The output of the default command contains the IP address, network mask, and
gateway for all physical and virtual network adapter
Syntax
Parameters
Networks Laboratory
parameter, ipconfig displays only the IP address, subnet mask, and default
gateway values for each adapter. Adapters can represent physical interfaces,
such as installed network adapters, or logical interfaces, such as dial-up
connections.
Renews DHCP configuration for all adapters (if an adapter is not specified) or
/renew for a specific adapter if the Adapter parameter is included. This parameter is
[Adapter] available only on computers with adapters that are configured to obtain an IP
address automatically. To specify an adapter name, type the adapter name that
appears when you use ipconfig without parameters.
Sends a DHCPRELEASE message to the DHCP server to release the current
DHCP configuration and discard the IP address configuration for either all
/release adapters (if an adapter is not specified) or for a specific adapter if the Adapter
[Adapter] parameter is included. This parameter disables TCP/IP for adapters configured
to obtain an IP address automatically. To specify an adapter name, type the
adapter name that appears when you use ipconfig without parameters.
Flushes and resets the contents of the DNS client resolver cache. During DNS
/flushdns troubleshooting, you can use this procedure to discard negative cache entries
from the cache, as well as any other entries that have been added dynamically.
Displays the contents of the DNS client resolver cache, which includes both
entries preloaded from the local Hosts file and any recently obtained resource
/displaydns records for name queries resolved by the computer. The DNS Client service
uses this information to resolve frequently queried names quickly, before
querying its configured DNS servers.
Initiates manual dynamic registration for the DNS names and IP addresses that
are configured at a computer. You can use this parameter to troubleshoot a
/registerdns failed DNS name registration or resolve a dynamic update problem between a
client and the DNS server without rebooting the client computer. The DNS
settings in the advanced properties of the TCP/IP protocol determine which
names are registered in DNS.
Adapter Displays the DHCP class ID for a specified adapter. To see the DHCP
/showclassid class ID for all adapters, use the asterisk (*) wildcard character in place of
Adapter. This parameter is available only on computers with adapters that are
configured to obtain an IP address automatically.
Adapter [ClassID] Configures the DHCP class ID for a specified adapter. To
set the DHCP class ID for all adapters, use the asterisk (*) wildcard character in
/setclassid place of Adapter. This parameter is available only on computers with adapters
that are configured to obtain an IP address automatically. If a DHCP class ID
is not specified, the current class ID is removed.
Networks Laboratory
Examples:
4. Nslookup
The nslookup (which stands for name server lookup) command is a network
utility program used to obtain information about internet servers. It finds name server
information for domains by querying the Domain Name System.
5. traceroute
Networks Laboratory
Traceroute uses Internet Control Message Protocol (ICMP) echo packets with variable time to live
(TTL) values. The response time of each hop is calculated. To guarantee accuracy, each hop is queried
multiple times (usually three times) to better measure the response of that particular hop.
tracert www.google.com
With the tracert command shown above, we're asking tracert to show us the
path from the local computer all the way to the network device with the
hostname www.google.com.
Networks Laboratory
NOTE:
RESULT:
Networks Laboratory
Ex.No:2
Write a code simulating ARP /RARP protocols
Date:
AIM:
ALGORITHM:
Server
1. Create a server socket and bind it to port.
2. Listen for new connection and when a connection arrives, accept it.
3. Send server‟s date and time to the client.
4. Read client‟s IP address sent by the client.
5. Display the client details.
6. Repeat steps 2-5 until the server is terminated.
7. Close all streams.
8. Close the server socket.
Client
1. Create a client socket and connect it to the server‟s port number.
2. Retrieve its own IP address using built-in function.
3. Send its address to the server.
4. Display the date & time sent by the server.
5. Close the input and output streams.
6. Close the client socket.
PROGRAM:
Networks Laboratory
Networks Laboratory
OUTPUT:
RESULT
Networks Laboratory
Ex.No:3
Create a socket for HTTP for Web page upload and download
Date:
AIM:
To write a java program for socket for HTTP for web page upload and download .
ALGORITHM:
5. If your frames reach the server it will send ACK signal to client
otherwise it will send NACK signal to client.
6. Stop the program
PROGRAM
Networks Laboratory
Networks Laboratory
OUTPUT
RESULT:
Networks Laboratory
Ex.No:4
Application using of TCP sockets
Date:
AIM:
ALGORITHM:
5. If your frames reach the server it will send ACK signal to client otherwise
it will send NACK signal to client.
6. Stop the program
PROGRAM:
Networks Laboratory
OUTPUT:
RESULT:
Networks Laboratory
B.CHAT AIM:
PROGRAM:
Networks Laboratory
Networks Laboratory
OUTPUT:
RESULT:
Networks Laboratory
C.File Transfer
AIM:
Algorithm Server
Client
Program
Networks Laboratory
Networks Laboratory
OUTPUT:
Networks Laboratory
RESULT:
Networks Laboratory
Ex.No:5
Simulation of DNS using UDP sockets.
Date:
AIM:
ALGORITHM:
5. If your frames reach the server it will send ACK signal to client
otherwise it will send NACK signal to client.
6. Stop the program
PROGRAM:
Networks Laboratory
Networks Laboratory
OUTPUT:
RESULT:
Networks Laboratory
Ex.No.6
Date Study of Network simulator (NS) and Simulation of
Congestion Control Algorithms
AIM:
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 is the trace files. Trace files log every packet, every event that occurred in
thesimulation 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 variates" and "importance sampling" have
been developed to speed simulation.
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:
Networks Laboratory
1. ns (open source)
2. OPNET (proprietary software)
3. NetSim (proprietary software)
Network simulators serve a variety of needs. Compared to the cost and time involved in setting
up an entire test bed containing multiple networked computers, routers and data links, network
simulators are 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 scenario with 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 networks using various types of nodes like computers,
hubs,bridges, routers, switches, links, mobile units etc.
Various types of Wide Area Network (WAN) technologies like TCP, ATM, IP etc. and LocalArea
Network (LAN) technologies like Ethernet, token rings etc., can all be simulated with a typical
simulator and the user can test, analyze various standard results apart from devising some novel
protocol or strategy for routing etc. Network simulators are also widely used to simulate battlefield
networks in Network-centric warfare
There are a wide variety of network simulators, ranging from the very simple to the very complex.
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.
Networks Laboratory
Packet loss occurs when one or more packetsof data traveling across a computer network fail to
reachtheir 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 a
congestion control scheme. The larger the value of packet loss, the more difficult it is for
transportlayer protocols to maintain high bandwidths, the sensitivity to loss of individual packets, as
well as to frequency 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 asEthernetorpacket 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 orbps), and sometimes in data packets per second or data packets per time
slotThis measure how soon the receiver is able to get a certain amount of data send by the 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
Delay is 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 valueof delay, the more
difficult it is for transport layer protocols to maintain highbandwidths. We will calculate end to end
delay
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 thesystem 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.
Networks Laboratory
RESULT
Thus the study of Network simulator (NS2) was studied
Networks Laboratory
Ex.No.7 Study of TCP/UDP performance using Simulation tool
Date
AIM:
To implement a Transport Control Protocol in sensor network through the simulator.
SOFTWARE REQUIREMENTS:
Network Simulator -2
THEORY:
The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite.
It originated in the initial network implementation in which it complemented the Internet Protocol
(IP). Therefore, the entire suite is commonly referred to as TCP/IP. TCP provides reliable, ordered,
and error-checked delivery of a stream of octets (bytes) between applications running on hosts
communicating by an IP network. Major Internet applications such as the World Wide Web, email,
remote administration, and file transfer rely on TCP. Applications that do not require reliable data
stream service may use the User Datagram Protocol (UDP), which provides a connectionless
datagram service that emphasizes reduced latency over reliability.
ALGORITHM:
1. Create a simulatorobject
2. Define different colors for different dataflows
3. Open a nam trace file and define finish procedure then close the trace file, and execute nam
on trace file.
4. Create six nodes that forms a network numbered from 0 to5
5. Create duplex links between the nodes and add Orientation to the nodes for setting a LANtopology
6. Setup TCP Connection between n(0) andn(4)
7. Apply FTP Traffic overTCP
8. Setup UDP Connection between n(1) andn(5)
9. Apply CBR Traffic overUDP
10. Schedule events and run theprogram
Networks Laboratory
PROGRAM:
Networks Laboratory
OUTPUT:
RESULT:
Networks Laboratory
Ex.No.8 Simulation of Distance Vector/ Link State Routing
algorithm.
Date
AIM:
To simulate and study the Distance Vector routing algorithm using simulation.
SOFTWARE REQUIREMENTS:
Network Simulator -2
THEORY:
Distance Vector Routing is one of the routing algorithm in a Wide Area Network for computing
shortest path between source and destination. The 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 routes in the tableeither directly or via an intermediate devices. Each router
initially has information about its all neighbors. Then this information will be shared among nodes
ALGORITHM:
Networks Laboratory
PROGRAM:
Networks Laboratory
Networks Laboratory
OUTPUT:
RESULT:
Networks Laboratory
Ex.No.9 Performance evaluation of Routing protocols using
Simulation tool
Date
Routing is the process of selecting best paths in a network. In the past, the term routing was also
used to mean forwarding network traffic among networks. However this latter function is much
better described as simply forwarding. Routing is performed for many kinds of networks, including
the telephone network (circuit switching), electronic data networks (such as the Internet), and
transportation networks. This article is concerned primarily with routing in electronic data
networks using packet switching technology.
In packet switching networks, routing directs packet forwarding (the transit of logically addressed
network packets from their source toward their ultimate destination) through intermediate nodes.
Intermediate nodes are typically network hardware devices such as routers, bridges,
gateways,firewalls, or switches. General-purpose computers can also forward packets and perform
routing, though they are not specialized hardware and may suffer from limited performance. The
routing process usually directs forwarding on the basis of routing tables which maintain a record of
the routes to various network destinations. Thus, constructing routing tables, which are held in the
router's memory, is very important for efficient routing. Most routing algorithms use only one
network path at a time. Multipath routing techniques enable the use of multiple alternative paths.
In case of overlapping/equal routes, the following elements are considered in order to decide which
routes get installed into the routing table (sorted by priority):
Networks Laboratory
1. Prefix-Length: where longer subnet masks are preferred (independent of whether it is within
arouting protocol or over different routing protocol)
2. Metric: where a lower metric/cost is preferred (only valid within one and the same
routingprotocol)
Routing, in a more narrow sense of the term, is often contrasted with bridging in its assumption that
network addresses are structured and that similar addresses imply proximity within the network.
Structured addresses allow a single routing table entry to represent the route to a group of devices.
In large networks, structured addressing (routing, in the narrow sense) outperforms unstructured
addressing (bridging). Routing has become the dominant form of addressing on the Internet.
Bridging is still widely used within localized environments.
ii. Flooding
Flooding s a simple routing algorithm in which every incoming packet is sent through every
outgoing link except the one it arrived on.Flooding is used in bridging and in systems such as
Usenet and peer-to-peer file sharing and as part of some routing protocols, including
OSPF,DVMRP, and those used in ad-hoc wireless networks.There are generally two types of
flooding available, Uncontrolled Flooding and Controlled Flooding.Uncontrolled Flooding is the
fatal law of flooding. All nodes have neighbours and route packets indefinitely. More than two
neighbours creates a broadcast storm.
Controlled Flooding has its own two algorithms to make it reliable, SNCF (Sequence Number
Controlled Flooding) and RPF (Reverse Path Flooding). In SNCF, the node attaches its own
address and sequence number to the packet, since every node has a memory of addresses and
sequence numbers. If it receives a packet in memory, it drops it immediately while in RPF, the
node will only send the packet forward. If it is received from the next node, it sends it back to the
sender.
Networks Laboratory
Algorithm
There are several variants of flooding algorithm. Most work roughly as follows:
2. Each node tries to forward every message to every one of its neighbours except the source
node.
This results in every message eventually being delivered to all reachable parts of the network.
A variant of flooding called selective flooding partially addresses these issues by only sending
packets to routers in the same direction. In selective flooding the routers don't send every incoming
packet on every line but only on those lines which are going approximately in the right direction.
Advantages
If a packet can be delivered, it will (probably multiple times).
Since flooding naturally utilizes every path through the network, it will also use the shortest path.
This algorithm is very simple to implement.
Disadvantages
Flooding can be costly in terms of wasted bandwidth. While a message may only have one
The term distance vector refers to the fact that the protocol manipulates vectors(arrays) of
distances to other nodes in the network. The vector distance algorithm was the original
ARPANET routing algorithm and was also used in the internet under the name of RIP (Routing
Information Protocol)
Examples of distance-vector routing protocols include RIPv1 and RIPv2 and IGRP.
Method
Routers using distance-vector protocol do not have knowledge of the entire path to a destination.
Instead they use two methods:
Distance-vector protocols are based on calculating the direction and distance to any link in a network.
"Direction" usually means the next hop address and the exit interface. "Distance" is a measure of the
cost to reach a certain node. The least cost route between any two nodes is the route with minimum
distance. Each node maintains a vector (table) of minimum distance to every node. The cost of
reaching a destination is calculated using various route metrics. RIP uses the hop count of the
destination whereas IGRP takes into account other information such as node delay and available
bandwidth.
Updates are performed periodically in a distance-vector protocol where all or part of a router's
routing table is sent to all its neighbors that are configured to use the same distance-vector routing
protocol. RIP supports cross-platform distance vector routing whereas IGRP is a Cisco Systems
proprietary distance vector routing protocol. Once a router has this information it is able to amend
its own routing table to reflect the changes and then inform its neighbors of the changes. This
process has been described as ‗routing by rumor‗ because routers are relying on the information
they receive from other routers and cannot determine if the information is actually valid and true.
Networks Laboratory
There are a number of features which can be used to help with instability and inaccurate routing
information.
EGP and BGP are not pure distance-vector routing protocols because a distance-vector protocol
calculates routes based only on link costs whereas in BGP, for example, the local route preference
value takes priority over the link cost.
Count-to-infinity problem
The Bellman–Ford algorithm does not prevent routing loops from happening and suffers from the
count-to-infinity problem. The core of the count-to-infinity problem is that if A tells B that it has
apath somewhere, there is no way for B to know if the path has B as a part of it. To see the problem
clearly, imagine a subnet connected like A–B–C–D–E–F, and let the metric between the routers be
"number of jumps". Now suppose that A is taken offline. In the vector-update-process B notices
that the route to A, which was distance 1, is down – B does not receive the vector update from A.
The problem is, B also gets an update from C, and C is still not aware of the fact that A is down –
so it tells B that A is only two jumps from C (C to B to A), which is false. This slowly propagates
through the network until it reaches infinity (in which case the algorithm corrects itself, due to the
relaxation property of Bellman–Ford).
Networks Laboratory
OUTPUT
RESULT
Networks Laboratory
Ex.No.10 Simulation of error correction code (like CRC).
Date
AIM:
To implement error detection and error correction techniques.
SOFTWARE REQUIREMENTS:
Turbo C
THEORY:
The upper layers work on some generalized view of network architecture and are not aware of
actual hardware data processing. Hence, the upper layers expect error-free transmission between the
systems. Most of the applications would not function expectedly if they receive erroneous data.
Applications such as voice and video may not be that affected and with some errors they may still
function well. Data-link layer uses some error control mechanism to ensure that frames (data bit
streams) are transmitted with certain level of accuracy. But to understand how errors is controlled, it
is essential to know what types of errors may occur. CRC is a different approach to detect if the
received frame contains valid data. This technique involves binary division of the data bits being
sent. The divisor is generated using polynomials. The sender performs a division operation on the
bits being sent and calculates the remainder. Before sending the actual bits, the sender adds the
remainder at the end of the actual bits. Actual data bits plus the remainder is called a codeword. The
sender transmits data bits as codewords.
ALGORITHM:
1. Open Turbo c++ software and type the program for error detection
2. Get the input in the form of bits.
3. Append 16 zeros as redundancy bits.
4. Divide the appended data using a divisor polynomial.
5. The resulting data should be transmitted to the receiver.
6. At the receiver the received data is entered.
7. The same process is repeated at the receiver.
8. If the remainder is zero there is no error otherwise there is some error in the received bits
Networks Laboratory
9. Run the program.
PROGRAM:
Networks Laboratory
OUTPUT:
RESULT:
Networks Laboratory
Program Educational Objectives (PEOs)
PEO1:
Graduates will apply engineering basics, laboratory and job oriented experiences to devise and
unravel engineering problems in computer science engineering domain.
PEO2:
Graduates will be multi faceted researcher and experts in fields like computing, networking,
artificial intelligence, software engineering and data science.
PEO3:
Graduates will be dynamic entrepreneur and service oriented professional with ethical and
social responsibility.
PEO4:
Graduates will ingress and endure in core and other prominent organization across the globe
and will foster innovation.
PROGRAM OUTCOMES(POs)
Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals, and an engineering
specialization to the solution of complex engineering problems.
Problem analysis: Identify, formulate, review research literature, and analyze complex engineering problems reaching
substantiated conclusions using first principles of mathematics, natural sciences, and engineering sciences.
Design/development of solutions: Design solutions for complex engineering problems and design system components
or processes that meet the specified needs with appropriate consideration for the public health and safety, and the
cultural, societal, and environmental considerations.
Conduct investigations of complex problems: Use research-based knowledge and research methods including design
of experiments, analysis and interpretation of data, and synthesis of the information to provide valid conclusions.
Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern engineering and IT tools
including prediction and modeling to complex engineering activities with an understanding of the limitations.
The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal, health, safety,
legal and cultural issues and the consequent responsibilities relevant to the professional engineering practice.
Environment and sustainability: Understand the impact of the professional engineering solution sin societal and
environmental contexts, and demonstrate the knowledge of, and need for sustainable development.
Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the engineering
practice.
Individual and team work: Function effectively as an individual, and as a member or leader indiverse teams, and in
multidisciplinary settings.
Communication: Communicate effectively on complex engineering activities with the engineering community and
with society at large, such as, being able to comprehend and write effective reports and design documentation, make
effective presentations, and give and receive clear instructions.
Networks Laboratory
Project management and finance: Demonstrate knowledge and understanding of the engineering and management
principles and apply these to one‘s own work, as a member and leader in a team, to manage projects and in
multidisciplinary environments.
Life-long learning: Recognize the need for, and have the preparation and ability to engage in independent and life-long
learning in the broadest context of technological change.
PSO-I: The ability to understand, analyze and to develop the design related to real-time system such as IOT, Secured
automated systems, machine vision , computer vision and cognitive computing with various complexities , providing
orientation towards green computing environment .
PSO-II: The ability to apply standard practices and strategies in software project development using open-ended
programming environments to deliver a quality product
PSO-III: The ability to innovate, introduce and produce socially relevant products to facilitate transformation of
society into a digitally empowered knowledge economy, thereby to chart a successful career with a new dimension to
entrepreneurship.
Networks Laboratory