PAcket Tracer Manual
PAcket Tracer Manual
PAcket Tracer Manual
1. (a) Study of different types of Network cables and implement cross-wired cable and
straight through cable using clamping tool
4. To create scenario and study the performance of network with CSMA / CA protocol
and compare with CSMA/CD protocols.
10. Configure a network using address resolution protocol (ARP) and routing
information protocol (RIP) and analyze the performance of the network.
1|Page
1. (a) Study of different types of Network cables and implement cross-wired cable and
straight through cable using clamping tool
Aim: Study of different types of Network cables and practically implements the cross-
wired cable and straight through cable using clamping tool.
Description:
A cable is a device which contains a number of signal conductors usually in the
form of separate wires. It is the medium through which information usually moves
from one system to another through the network. There are several types of cable
which are commonly used with the local area network.
Twisted Pair:
Twisted pair cable is the most common type of network medium used in LANs.
A transmission media consists of color coded pairs of two shielded or unshielded
insulated copper wires which are arranged in a spiral pattern. The spiral pattern is an
important aspect of twisted-pair cables in order to minimize crosstalk or interference
between adjoining wires.
The advantage of using twisted pair cables are:
1. It is lighter, thinner and more flexible. 2. Easy to install 3. It is inexpensive
Unshielded twisted pair (UTP) cabling consists of two unshielded wires twisted
around each other that contain no shielding. It is commonly used in the telephone
wires and is common for computer networking because of high flexibility of the
cables. It is a plastic connector that looks like a large telephone-style connector. The
standard connector for unshielded twisted pair cabling is RJ-45 connector
Crimper:
A crimper is a jawed device that looks like a pair of pliers. It has a set of dies in
it that enables you to squeeze the two halves of an RJ-45 connector together with the
wires inside. The wire is striped off a cable and is out in the bottom half of the
connector at both the ends. The other half of the connector on the top of the wires
squeezes the handles of the crimper to lock the two halves together.
3|Page
Straight-through Cable:
Straight-through cable is a Cat 5 cable which has similar wiring at both the ends. It
is a standard network cables that connects a computer to a network device like network
hub, network switch, and network routers. A straight-through cable has each internal
twisted pair of wires connected to the same pin number at each end. The twisted-pair
wires must be twisted throughout the entire length of the cable. If the colors in both
ends are in the same order, it is a straight-through cable.
It is also a Cat 5 networking cable, which is generally used to connect two computers
or network devices directly to one another without using a network hub, network,
router or network switch.
The crossover cable can be used to connect
Switch to switch
Hub to hub
Host to host
Hub to switch
Router direct to host
4|Page
(b) Study of Network devices
Network devices are called hardware devices that link computers, printers, faxes and
other electronic devices to the network. Such devices easily, safely and correctly
transfer data over one or other networks. Inter-network or intra-network devices may
be available. Some devices such as the NIC card or the connector RJ45 are mounted
on the device, while some are a network component such as a router, switch, etc. Let’s
look more closely at some of these phones. The modem is a system that can send and
receive data through phone or cable lines from a computer.
The data stored on the device is digital, while a phone line or cable wire can transmit
only analog data. Digital signal is converted to analog and vice versa, which is
important in the modem. Two devices –modulator and modulator –are combined
Modem. When the processor sends the data, the modulator transforms digital data into
analog data. When the demodulator is received on the processor, analog data signals
are translated into digital data.
1. Access Point
While a wired or wireless link is technological in an AP, it usually means a
wireless device. An AP operates on the second OSI layer, the data link layer, and can
either act as a bridge that connects a standard wireless network to wireless devices or
as a router that transmits data to another access point. Wireless connectivity points
(WAPs) are a device that is used to generate a wireless LAN (WLAN) transmitter and
receiver. Access points are usually networked separate machines with an integrated
antenna, transmitter, and adapter.
5|Page
In order to provide a link between WLAN and wired Ethernet LAN, APs are using
wireless infrastructure network mode. They have several ports, which allow you to
extend the network to support other customers. One or more APs may need to have
full coverage, depending on the size of the network. APSAPs may also provide
multiple ports that can be used to increase the network’s size, the capabilities of
firewalls and the DHCP. So, we’re getting switch-based APs, DHCP servers, firewall,
and router.
2. Router
They serve as a LAN external link to a WAN and run on your network boundaries.
Routers interact through the management of destination tables and local connections.
A router gives data on the linked systems and sends requests if the destination is
unknown. Routers are your first protection line, and only the traffic approved by
network administrators needs to be enabled to pass.
3. Hub
The hubs link various networking devices. A network also functions as amplification
by amplifying signals that deteriorate over cables after long distances. In the network
communication system family, a hub is the easiest, as it links LAN components with
the same protocols. Digital or analog data can be used with a server as long as its
configuration prepares for formatting the incoming data. Hubs do not process or
address packets; they only send data packets to all connected devices. We send data
packets. Hubs operate on the Open Systems Interconnection (OSI) physical layer.
Active HUB: Those are hubs that can clean, raise and distribute the signal together
with the network with their power supply. It is both a repeater and a cable hub. The
total distance between nodes can be increased.
Passive HUB: These are hubs that collect cable from active network nodes and
electricity. These hubs relay signals to the grid without being cleaned and improved,
nor can the distance between nodes be increased.
6|Page
4. Bridge
Bridges link two or more hosts or network segments. Bridge processing and
transfer of frames between the various bridge links are the key roles in the network
architecture. For the transmission of images, you use Media Access Control (MAC)
hardware. Bridges can transmit the data or block the crossing by looking at the
devices’ MAC addresses connected to each line. It is also possible to connect two
physical LANs with a wider theoretical LAN with bridges. Bridges only function on
OSI layers Physical and Data Link. Bridges are used for dividing large networks into
smaller sections through the placement between two segments of the physical network
and data flow management between the two.
Bridges are in many respects like hubs, like linking LAN components to the same
protocols. Yet bridges, known as frames, filter the incoming data packets to addresses
before transmission. The bridge does not modify the format or content of the incoming
data when it filters the data packets with the aid of a dynamic bridge table; the bridge
filters and forwarded frames in the network. The initially empty bridge table preserves
each LAN computer’s LAN address and each bridge interface’s addresses that link the
LAN to the other LANs.
5. Gateway
The transportation and session layers of the OSI model usually work in
gateways. There are many guidelines and specifications for different vendors on the
transport layer and above; gateways manage these. The connection between
networking technologies, such as OSI and Transmission Control Protocol / Internet
Protocols, such as TCP / IP, is supported by the gateway. Gateways link, thus, two or
more self-contained networks with their own algorithms, protocols, topology, domain
name system and policy, and network administration. Gateways handle all routing
functions and more. In fact, an added translation router is a gateway. A protocol
converter is called the feature that translates between different network technologies.
6. Switch
Switches have a smarter job than hubs in general. A switch improves the
capacity of the network. The switch keeps limited information on routing nodes in the
internal network and provides links to systems such as hubs or routers. Normally LAN
beaches are linked by switches. Switches will usually read incoming packets hardware
addresses to transfer them to their respective destinations. Switches improve the
Network’s effectiveness over hubs or routers because of the flexibility of the digital
circuit. Switches also improve network protection since network control makes digital
circuits easier to investigate.
7|Page
You can see a switch as a system that combines some of the best routers and hubs. A
switch can operate on the interface Data Link or the OSI model’s network layer. A
multi-layer switch can be worked in both layers, so both a switch and a router can
work. A high-performance switch adopting the same routing procedures as routers is a
multilayer switch. DDoS may attack switches; flood controls can be used to prevent
malicious traffic from stopping the switch. The Switch port’s protection is crucial to
make sure that all unused ports are deactivated, and DHCP, ARP, and MAC Address
Filtering are used to ensure stable switches.
7. Modem
Digital signals are transmitted through analog phone lines using modems
(modulator demodulators). The modem converts digital signals into analog signals of
various frequencies and transmits them to a modem at the receiver location. The
receiving modem turns the other way and provides a digital output to a device,
normally a computer, connected to a modem. In most cases, digital data is transmitted
via the RS-232 standard interface to or from a serial line modem. Most cable operators
use modems as final terminals to locate and remember their homes and personal
clients, and many phone companies provide DSL services. All physical and data link
layers are operating on modems.
8. Brouter
The bridging router is also known as the device that combines both bridge and
router features. It can be used on the data connection layer or the network layer. It can
route packets across networks as a router, function as a bridge, and filter network
traffic in the local area.
8|Page
(c) Study of Network IP
Each device connected to the internet has a unique identifier. Most networks today,
including all computers on the internet, use the TCP/IP as a standard to communicate
on the network. In the TCP/IP protocol, this unique identifier is the IP Address. The
two kinds of IP Addresses are IPv4 and IPv6.
IPv4 vs IPv6
IPv4 uses 32 binary bits to create a single unique address on the network. An IPv4
address is expressed by four numbers separated by dots. Each number is the decimal
(base-10) representation for an eight-digit binary (base-2) number, also called an octet.
IPv6 uses 128 binary bits to create a single unique address on the network. An IPv6
address is expressed by eight groups of hexadecimal (base-16) numbers separated by
colons. Groups of numbers that contain all zeros are often omitted to save space,
leaving a colon separator to mark the gap.
IPv6 space is much larger than the IPv4 space due the use of hexadecimals as well as
having 8 groups. Most devices use IPv4. However, due to advent of IoT devices and
the greater demand for IP Addresses, more and more devices are accepting IPv6.
Static address is one that you configure yourself by editing your computer’s network
settings. This type of address is rare, and it can create network issues if you use it
without a good understanding of TCP/IP.
Dynamic addresses are the most common. They’re assigned by the Dynamic Host
Configuration Protocol (DHCP), a service running on the network. DHCP typically
runs on network hardware such as routers or dedicated DHCP servers. Dynamic IP
addresses are issued using a leasing system, meaning that the IP address is only active
for a limited time. If the lease expires, the computer will automatically request a new
lease.
IP Classes
9|Page
Four specific reservations include the following:
0.0.0.0 — this represents the default network, which is the abstract concept of just
being connected to a TCP/IP network.
127.0.0.1 — this is called the loopback address, meaning your computer’s way of
identifying itself, whether or not it has an assigned IP address.
The other IP address reservations are for subnet classes. A subnet is a smaller network
of computers connected to a larger network through a router. The subnet can have its
own address system so computers on the same subnet can communicate quickly
without sending data across the larger network. A router on a TCP/IP network,
including the Internet, is configured to recognize one or more subnets and route
network traffic appropriately.
Multicast (formerly called Class D) — The first four bits in the address are 1110, with
addresses ranging from 224.0.0.0 to 239.255.255.255.
The first three (within Classes A, B and C) are those most used in creating subnets.
Later, we’ll see how a subnet uses these addresses. The IANA has outlined specific
uses for multicast addresses within Internet Engineering Task Force (IETF)
document RFC 5771. However, it hasn’t designated a purpose or future plan for Class
E addresses since it reserved the block in its 1989 document RFC 1112. Before IPv6,
the Internet was filled with debate about whether the IANA should release Class E for
general use.
10 | P a g e
Subnets
When you type ipconfig on your UNIX terminal (or CMD prompt for Windows users),
you will get a pretty detailed display of your IP Address information. I have taken a
screenshot of the section that I am interested in.
IP address: 192.168.1.69
Subnet mask: 255.255.255.0
Twenty-four bits (three octets) reserved for network identity
Eight bits (one octet) reserved for nodes
Subnet identity based on subnet mask (first address): 192.168.1.0
The reserved broadcast address for the subnet (last address): 192.168.1.255
Example addresses on the same network: 192.168.1.1, 192.168.1.103
Example addresses not on the same network: 192.168.2.1, 192.168.2.103
11 | P a g e
Experiment: 2
Configuration of LAN
Aim:
To analyse the performance of various configurations and protocols in LAN
Requirements
Windows pc – 3Nos
CISCO Packet Tracer Software ( Student Version)
8 port switch – 1 No
Cat-5 LAN cable
Procedure
12 | P a g e
Network Topology Diagram for LAN
C:\>ping 10.0.0.2
Pinging 10.0.0.2 with 32 bytes of data:
13 | P a g e
LAN - MAC ADDRESS TABLE:
Result
Hence, the various configurations and protocols in LAN are analysed and the
experiment is performed successfully.
14 | P a g e
Experiment:2(a)
Configuration of VLAN
Aim:
To construct a VLAN and make the PC’s communicate among a VLAN
Requirements
Windows pc – 6 Nos
CISCO Packet Tracer Software ( Student Version)
8 port switch – 1 No
Cat-5 LAN cable
Procedure
Theory
VLANs define broadcast domains in a Layer 2 network. A broadcast domain is the set
of all devices that will receive broadcast frames originating from any device within the set.
Broadcast domains are typically bounded by routers because routers do not forward broadcast
frames. Layer 2 switches create broadcast domains based on the configuration of the switch.
Switches are multiport bridges that allow you to create multiple broadcast domains. Each
broadcast domain is like a distinct virtual bridge within a switch.
15 | P a g e
Network Topology Diagram for VLAN
16 | P a g e
CONFIGURATION OF THE SWITCHPORT FOR VLAN:
Switch>en
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#ex
Switch(config)#vlan 20
Switch(config-vlan)#ex
Switch(config)#interface range fastEthernet 0/1-3
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#ex
Switch(config)#interface range fastEthernet 0/4-6
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#ex
Switch(config)#ex
Switch#
%SYS-5-CONFIG_I: Configured from console by console
17 | P a g e
C:\>PING 20.0.0.1
Result
Hence, created VLAN structure and observed the communications of PCs within a
VLAN
18 | P a g e
Experiment: 2(b)
Configuration of Inter VLAN
Aim:
To construct a Inter - VLAN and make the PC’s communicate among a VLAN
Requirements
Windows pc – 4 Nos
CISCO Packet Tracer Software ( Student Version)
8 port switch – 1 No
Cat-5 LAN cable
Procedure
The use of VLANs means that users would not be able to communicate across
departments, i.e. a user in FINANCE, would not be able to send a message to a user in SALES
since they are on different broadcast domains.
19 | P a g e
Network Topology Diagram for Inter VLAN
PC0 PC1
IP Address : 10.0.0.1 IP Address : 10.0.0.2
Subnet Mask : 255.255.255.0 Subnet Mask : 255.255.255.0
Gate way : 10.0.0.50 Gate way : 10.0.0.50
PC0 PC1
IP Address : 20.0.0.1 IP Address : 20.0.0.2
Subnet Mask : 255.255.255.0 Subnet Mask : 255.255.255.0
Gate way : 20.0.0.50 Gate way : 20.0.0.50
20 | P a g e
ROUTER CONFIGURATION:
Router>en
Router#config ter
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fastEthernet 0/0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface fastEthernet 0/0.10
Router(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.10, changed state to
up
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 10.0.0.50 255.0.0.0
Router(config-subif)#no shut
Router(config-subif)#no shutdown
Router(config-subif)#exit
Router(config)#interface fastEthernet 0/0.20
Router(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.20, changed state to
up
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address 20.0.0.50 255.0.0.0
Router(config-subif)#no shut
Router(config-subif)#no shutdown
Router(config-subif)#exit
Router(config)#exit
Router#
%SYS-5-CONFIG_I: Configured from console by console
21 | P a g e
Router#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B – BGP D - EIGRP, EX -
EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF
NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E – EGP i - IS-IS,
L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user
static route, o – ODR P - periodic downloaded static route
Result
Hence, We constructed Inter VLAN and made the communications of PCs between
different VLANs.
22 | P a g e
Experiment: 3
Configuration of Wireless LAN
Aim:
To construct a Wireless LAN and make the PC’s communicate wirelessly
Requirements
Windows pc – 2 Nos
CISCO Packet Tracer Software ( Student Version)
8 port switch – 1 No
Cat-5 LAN cable
Procedure
Theory
A Wireless Local Area Network (WLAN) implements a flexible data communication
system frequently augmenting rather than replacing a wired LAN within a building or campus.
WLANs use radio frequency to transmit and receive data over the air, minimizing the need for
wired connections.
23 | P a g e
Network Topology Diagram for Wireless LAN
Result:
Thus, constructed a WLAN and made the Laptops communicate wirelessly
24 | P a g e
EXPERIMENT-4
Performance Analysis of CSMA/CA and CSMA/CD Protocols.
AIM:
To create scenario and study the performance of CSMA / CD protocol through simulation.
SOFTWARE REQUIREMENTS:
Ns-2
THEORY:
Ethernet is a LAN (Local area Network) protocol operating at the MAC (Medium Access Control)
layer. Ethernet has been standardized as per IEEE 802.3. The underlying protocol in Ethernet is known as the
CSMA / CD – Carrier Sense Multiple Access / Collision Detection. The working of the Ethernet protocol is as
explained below, A node which has data to transmit senses the channel. If the channel is idle then, the data is
transmitted. If the channel is busy then, the station defers transmission until the channel is sensed to be idle and
then immediately transmitted. If more than one node starts data transmission at the same time, the data
collides. This collision is heard by the transmitting nodes which enter into contention phase. The contending
nodes resolve contention using an algorithm called Truncated binary exponential back off.
ALGORITHM:
PROGRAM:
CSMA/CA
set ns [new Simulator]
#Define different colors for data flows (for NAM)
$ns color 1 Blue
$ns color 2 Red
#Open the Trace files
set file1 [open out.tr w] s
et winfile [open WinFile w]
$ns trace-all $file1
#Open the NAM trace file
set file2 [open out.nam w]
$ns namtrace-all $file2
#Define a 'finish' procedure
proc finish {} {
global ns file1 file2
$ns flush-trace
close $file1
close $file2
exec nam out.nam &
exit 0
25 | P a g e
}
#Create six nodes
set n0 [$ns node]
set n1 [$ns node]
set lan [$ns newLan "$n3 $n4 $n5" 0.5Mb 40ms LL Queue/DropTail MAC/Csma/Ca Channel]
Setup a TCP connection
set tcp [new Agent/TCP/Newreno]
$ns attach-agent $n0 $tcp
global ns
set time 0.1
set now [$ns now]
set cwnd [$tcpSource set cwnd_]
set wnd [$tcpSource set window_]
puts $file "$now $cwnd"
$ns at [expr $now+$time] "plotWindow $tcpSource $file" }
$ns at 0.1 "plotWindow $tcp $winfile"
$ns at 5 "$ns trace-annotate \"packet drop\""
# PPP
$ns at 125.0 "finish"
$ns run
OUTPUT:
CSMA/CD
27 | P a g e
proc finish {} {
global ns file1 file2
$ns flush-trace
close $file1
close $file2
set lan [$ns newLan "$n3 $n4 $n5" 0.5Mb 40ms LL Queue/DropTail MAC/Csma/Cd Channel]
Setup a TCP connection
global ns
set time 0.1
set now [$ns now]
set cwnd [$tcpSource set cwnd_]
set wnd [$tcpSource set window_]
puts $file "$now $cwnd"
$ns at [expr $now+$time] "plotWindow $tcpSource $file" }
$ns at 0.1 "plotWindow $tcp $winfile"
$ns at 5 "$ns trace-annotate \"packet drop\""
# PPP
$ns at 125.0 "finish"
$ns run
OUTPUT:
RESULT:
29 | P a g e
EXPERIMENT-5
Implementation and study of stop and wait protocol
AIM: To Simulate and to study stop and Wait protocol
SOFTWARE REQUIREMENTS: NS-2 Simulator
THEORY:
Stop and Wait is a reliable transmission flow control protocol. This protocol works only in
Connection Oriented (Point to Point) Transmission. The Source node has window size of ONE. After
transmission of a frame the transmitting (Source) node waits for an Acknowledgement from the
destination node. If the transmitted frame reaches the destination without error, the destination
transmits a positive acknowledgement. If the transmitted frame reaches the Destination with error,
the receiver destination does not transmit an acknowledgement. If the transmitter receives a positive
acknowledgement it transmits the next frame if any. Else if its acknowledgement receive timer
expires, it retransmits the same frame.
1. Start with the window size of 1 from the transmitting (Source) node
2. After transmission of a frame the transmitting (Source) node waits for a reply
(Acknowledgement) from the receiving (Destination) node.
3. If the transmitted frame reaches the receiver (Destination) without error, the receiver
(Destination) transmits a Positive Acknowledgement.
4. If the transmitted frame reaches the receiver (Destination) with error, the receiver
(Destination) do not transmit acknowledgement.
5. If the transmitter receives a positive acknowledgement it transmits the next frame if any.
Else if the transmission timer expires, it retransmits the same frame again.
6. If the transmitted acknowledgment reaches the Transmitter (Destination) without error, the
Transmitter (Destination) transmits the next frame if any.
7. If the transmitted frame reaches the Transmitter (Destination) with error, the Transmitter
(Destination) transmits the same frame.
8. This concept of the Transmitting (Source) node waiting after transmission for a reply from the
receiver is known as STOP and WAIT.
30 | P a g e
ALGORITHM:
31 | P a g e
$ns at 0.11 "$ns trace-annotate \"Send Packet_0\""
$ns at 0.35 "$ns trace-annotate \"Receive Ack_0\""
$ns at 0.56 "$ns trace-annotate \"Send Packet_1\""
$ns at 0.79 "$ns trace-annotate \"Receive Ack_1\""
$ns at 0.99 "$ns trace-annotate \"Send Packet_2\""
$ns at 1.23 "$ns trace-annotate \"Receive Ack_2 \""
$ns at 1.43 "$ns trace-annotate \"Send Packet_3\""
$ns at 1.67 "$ns trace-annotate \"Receive Ack_3\""
$ns at 1.88 "$ns trace-annotate \"Send Packet_4\""
$ns at 2.11 "$ns trace-annotate \"Receive Ack_4\""
$ns at 2.32 "$ns trace-annotate \"Send Packet_5\""
$ns at 2.55 "$ns trace-annotate \"Receive Ack_5\""
$ns at 2.75 "$ns trace-annotate \"Send Packet_6\""
$ns at 2.99 "$ns trace-annotate \"Receive Ack_6\""
$ns at 3.1 "$ns trace-annotate \"FTP stops\""
proc finish {} {
global ns nf
$ns flush-trace
close $nf
puts "running nam..."
exec nam stop.nam &
exit 0
}
$ns run
OUTPUT:
RESULT:
Thus the Stop and Wait protocol was Simulated and studied.
32 | P a g e
EXPERIMENT-6
Implementation and study of Go back-N and selective repeat protocols
THEORY:
Go Back N is a connection oriented transmission. The sender transmits the frames continuously. Each
frame in the buffer has a sequence number starting from 1 and increasing up to the window size. The sender
has a window i.e. a buffer to store the frames. This buffer size is the number of frames to be transmitted
continuously. The size of the window depends on the protocol designer.
OPERATIONS:
2. Receiver sends an ACK i if frame i has an error. After that, the receiver discards all incoming frames until
the frame with error is correctly retransmitted.
3. If sender receives an ACK i it will retransmit frame i and all packets i+1, i+2,... which have been sent, but
not been acknowledged
2. Each frame in the buffer has a sequence number starting from 1 and increasing up to the window size.
3. The source node has a window i.e. a buffer to store the frames. This buffer size is the number of frames to
be transmitted continuously.
5. For the first frame, the receiving node forms a positive acknowledgement if the frame is received without
error.
33 | P a g e
6. If subsequent frames are received without error (up to window size) cumulative positive acknowledgement
is formed.
7. If the subsequent frame is received with error, the cumulative acknowledgment error-free frames are
transmitted. If in the same window two frames or more frames are received with error, the second and the
subsequent error frames are neglected. Similarly even the frames received without error after the receipt of
a frame with error are neglected.
8. The source node retransmits all frames of window from the first error frame.
9. If the frames are errorless in the next transmission and if the acknowledgment is error free, the window
slides by the number of error-free frames being transmitted.
10.If the acknowledgment is transmitted with error, all the frames of window at source are retransmitted, and
window doesn’t slide.
11. This concept of repeating the transmission from the first error frame in the window is called as
GOBACKN transmission flow control protocol
35 | P a g e
Selective Repeat ARQ
It is a specific instance of the Automatic Repeat-request (ARQ) Protocol. It may be used as a protocol
for the delivery and acknowledgement of message units, or it may be used as a protocol for the delivery of
subdivided message sub-units. When used as the protocol for the delivery of messages, the sending process
continues to send a number of frames specified by a window size even after a frame loss. Unlike Go-Back-N
ARQ, the receiving process will continue to accept and acknowledge frames sent after an initial error. The
receiver process keeps track of the sequence number of the earliest frame it has not received, and sends that
number with every ACK it sends. If a frame from the sender does not reach the receiver, the sender continues
to send subsequent frames until it has emptied its window. The receiver continues to fill its receiving window
with the subsequent frames, replying each time with an ACK containing the sequence number of the earliest
missing frame. Once the sender has sent all the frames in its window, it re-sends the frame number given by
the ACKs, and then continues where it left off. The size of the sending and receiving windows must be equal,
and half the maximum sequence number (assuming that sequence numbers are numbered from 0 to n-1) to
avoid miscommunication in all cases of packets being dropped. To understand this, consider the case when all
ACKs are destroyed. If the receiving window is larger than half the maximum sequence number, some,
possibly even all, of the packages that are resent after timeouts are duplicates that are not recognized as such.
The sender moves its window for every packet that is acknowledged.
Disadvantages:
2. Each frame in the buffer has a sequence number starting from 1 and increasing up to the window size.
3. The source node has a window i.e. a buffer to store the frames. This buffer size is the number of frames to
be transmitted continuously.
4. The receiver has a buffer to store the received frames. The size of the buffer depends upon the window size
defined by the protocol designer.
6. The source node transmits frames continuously till the window size is exhausted. If any of the frames are
received with error only those frames are requested for retransmission (with a negative acknowledgement)
7. If all the frames are received without error, a cumulative positive acknowledgement is sent.
8. If there is an error in frame 3, an acknowledgement for the frame 2 is sent and then only Frame 3 is
retransmitted. Now the window slides to get the next frames to the window.
9. If acknowledgment is transmitted with error, all the frames of window are retransmitted. Else ordinary
window sliding takes place. (* In implementation part, Acknowledgment error is not considered)
10.If all the frames transmitted are errorless the next transmission is carried out for the new window.
11.This concept of repeating the transmission for the error frames only is called Selective Repeat
transmission flow control protocol.
36 | P a g e
#PROGRAM FOR SELECTIVE REPEAT:
puts "filtering..."
#exec tclsh../bin/namfilter.tcl srepeat.nam
#puts "running nam..."
exec nam Srepeat.nam &
exit 0
}
$ns run
38 | P a g e
OUTPUT:
RESULT:
Thus the Go back N and Selective Repeat protocols were Simulated and studied.
39 | P a g e
Experiment 7
Implementation of client server using TCP protocol
AIM: To implement a chat server and client in java using TCP sockets.
DESCRIPTION: TCP Clients sends request to server and server will receives the request and
response with acknowledgement. Every time client communicates with server and receive
response from it.
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. Read Client's message and display it
4. Get a message from user and send it to client
5. Repeat steps 3-4 until the client sends "end"
6. Close all streams
7. Close the server and client socket
8. Stop
Client
1. Create a client socket and connect it to the server‟s port number
2. Get a message from user and send it to server
3. Read server's response and display it
4. Repeat steps 2-3 until chat is terminated with "end" message
5. Close all input/output streams
6. Close the client socket
7. Stop
PROGRAM:
//Server.java
import java.io.*;
import java.net.*;
class Server {
public static void main(String args[]) {
String data = "Networks Lab";
try {
ServerSocket srvr = new ServerSocket(1234);
Socket skt = srvr.accept();
System.out.print("Server has connected!\n");
PrintWriter out = new PrintWriter(skt.getOutputStream(), true);
System.out.print("Sending string: '" + data + "'\n");
out.print(data);
out.close();
skt.close();
srvr.close();
}
40 | P a g e
catch(Exception e) {
System.out.print("Whoops! It didn't work!\n");
}
}
}
//Client.java
import java.io.*;
import java.net.*;
class Client {
public static void main(String args[]) {
try {
Socket skt = new Socket("localhost", 1234);
BufferedReader in = new BufferedReader(new
InputStreamReader(skt.getInputStream()));
System.out.print("Received string: '");
while (!in.ready()) {}
System.out.println(in.readLine());
System.out.print("'\n");
in.close();
}
catch(Exception e) {
System.out.print("Whoops! It didn't work!\n");
}}}
OUTPUT
Server:
$ javac Server.java
$ java Server
Server started
Client connected
Cilent
$ javac Client.java
$ java Client
RESULT
Thus both the client and server exchange data using TCP socket programming.
EXPERIMENT -8
41 | P a g e
Implementation of Remote Procedure Call
Aim:
To write a java program to implement RPC (remote procedure call
Algorithm :
1.Start the program.
2.Get the frame size from the user
3.To create the frame based on the user request.
4.To send frames to server from the client side.
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:
RPC PROGRAM
Client
import java.io.*;
import java.net.*;
import java.util.*;
class Clientrpc
{
public static void main(String args[])
{
try
{
BufferedReader in=new BufferedReader(new
InputStreamReader(System.in)); Socket clsct=new Socket("127.0.0.1",139);
DataInputStream din=new DataInputStream(clsct.getInputStream());
DataOutputStream dout=new DataOutputStream(clsct.getOutputStream());
System.out.println("Enter String");
String str=in.readLine();
dout.writeBytes(str+'\n');
clsct.close();
}
catch (Exception e)
{
System.out.println(e);
}
}
}
Server
import java.io.*;
import java.net.*;
import java.util.*;
class Serverrpc
{
public static void main(String args[])
{
42 | P a g e
try
{
ServerSocket obj=new ServerSocket(139);
while(true)
{
Socket obj1=obj.accept();
DataInputStream din=new DataInputStream(obj1.getInputStream());
DataOutputStream dout=new DataOutputStream(obj1.getOutputStream());
String str=din.readLine();
Process p=Runtime.getRuntime().exec(str);
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
OUTPUT
Server
Y:\networks\remote>java Serverrpc
Client
Y:\networks\remote>java Clientrpc
Enter String
Calc
Result :
Thus the program was implementing to implement RPC (remote procedure call)
Experiment: 9
43 | P a g e
DISTANCE VECTOR ROUTING
Aim:
To understand the operation of Distance Vector Routing using MATLAB Software
Requirements:
Procedure:
A distance-vector routing protocol in data networks determines the best route for data
packets based on distance. Distance-vector routing protocols measure the distance by the
number of routers a packet has to pass, one router counts as one hop. Some distance-vector
protocols also take into account network latency and other factors that influence traffic on a
given route. To determine the best route across a network, routers, on which a distance-vector
protocol is implemented, exchange information with one another, usually routing tables plus
hop counts for destination networks and possibly other traffic information. Distance-vector
routing protocols also require that a router informs its neighbours of network topology changes
periodically.
The term distance vector refers to the fact that the protocol manipulates vectors (arrays)
of distances to other nodes in the network. The distance vector algorithm was the original
ARPANET routing algorithm and was implemented more widely in local area networks with
the Routing Information Protocol (RIP).
44 | P a g e
Matlab Program for Distance Vector Routing
clc;
clear all;
ack=0;
s=input('Enter the source router no: ');
z=input('Enter the destination node: ');
while ack==0
%delay routing tables for 5 modes
A=randint(1,5,100);%metric may be delay or no of hops
B=randint(1,5,100);
C=randint(1,5,100);
D=randint(1,5,100);
E=randint(1,5,100);
A(1)=0;B(2)=0;C(3)=0;D(4)=0;E(5)=0;
r=vertcat(A,B,C,D,E);
disp('All routers are updated with routing tables of neighbouring routers');
fprintf('The routing tables for router %d is \n',s);
disp(r);
d(1,5)=0;
count=1;
for i=s
for j=1:5
if j~=i
for k=1:5
if k~=j && k~=i
for l = 1:5
if l~=k && l~=j && l~=i
for m = 1:5
if m~=k && m~=j && m~=i && m~=l
if(m==z)
d(count,:)=[i,j,k,l,m];
count=count+1;
end
end
end
end
end
45 | P a g e
end
end
end
end
end
count1 =1;
for i=s
for j=1:5
if j~=i
for k=1:5
if k~=j && k~=i
for l=1:5
if l~=k && l~=j && l~=i
if l==z
c(count1,:)=[i,j,k,l];
count1= count1+1;
end
end
end
end
end
end
end
end
count2 = 1;
for i=s
for j=1:5
if j~=i
for k=1:5
if k~=j && k~=i
if k==z
e(count2,:) = [i,j,k,0];
count2= count2 + 1;
end
end
end
end
end
46 | P a g e
end
%finding the total delay of all possible paths
for i=1:6
del(i)=0;
for j=2:5
del(i)=del(i)+r(d(i,j-1),d(i,j));
end
end
count=i+1;
for i=1:6
del(count)=0;
for j=2:4
del(count)=del(count)+r(c(i,j-1),c(i,j));
end
count=count+1;
end
for i=1:3
del(count)=0;
for j=2:3
del(count)=del(count)+r(e(i,j-1),e(i,j));
end
count=count+1;
end
del(count)=r(s,z);
dc= sort(del);
%possible paths and latest delay paths
fprintf('Possble path delayS');
for i=1:count
for j=1:count
if dc(i)==del(j)
n(i)=j;
if j<=6
fprintf('\n%d %d %d %d %d %d %d',d(j,:),dc(i));
ma(i,:)=cellstr(num2str(d(j,:)));
elseif j<=12
fprintf('\n%d %d %d %d %d',c(j-6),dc(i));
ma(i,:)=cellstr(num2str(c(j-6)));
elseif j<=15
47 | P a g e
fprintf('\n%d %d %d %d',e((j-12),:),dc(i));
ma(i,:)=cellstr(num2str(e((j-12),:)));
elseif j==16
fprintf('\n%d %d %d',s,z,dc(i));
ma(i,:)=cellstr(num2str([s z]));
end
end
end
end
temp=dc(1);
for i=2:count
if(dc(i)<=temp)
temp=dc(i);
end
end
for i=1:count
if(dc(i)==temp)
break;
end
end
disp(sprintf('\n\n\t Least delay path is %s delay=%d',(char(ma(i))),dc(i)));
m(16,5)=0;
e=char(ma);
for i=1:length(ma)
m(i,1)=str2double(cellstr(e(i,1)));
m(i,2)=str2double(cellstr(e(i,4)));
m(i,3)=str2double(cellstr(e(i,7)));
m(i,4)=str2double(cellstr(e(i,10)));
m(i,5)=str2double(cellstr(e(i,13)));
end
k=m(1,2);
disp(sprintf('Packet sent to %d router',k));
disp('Updating the routing table..');
48 | P a g e
if (m(1,1)==s&&m(1,2)==z)
ack=1;
disp(sprintf('Packet sent to the destination router %d',z));
end
s=m(1,2);
z=m(1,3);
end
DVR OUTPUT
Result:
Thus, Simulated and verified the operation of Distance Vector Routing Algorithm and
understand its operation.
49 | P a g e
Experiment: 10(a)
Configuration of Address Resolution protocol
Aim:
To construct simple LAN and understand the concept and operation of Address
Resolution Protocol (ARP)
Requirements
Windows pc – 5 Nos
CISCO Packet Tracer Software ( Student Version)
8 port switch – 1 No
Cat-5 LAN cable
Procedure
Open the CISCO Packet tracer software
Drag and drop 5 pcs using End Device Icons on the left corner
Select 8 port switch from switch icon list in the left bottom corner
Make the connections using Straight through Ethernet cables
Give IP address of the PC1, PC2, PC3 and PC4 as per the input table respectively,
observe the source and destination MAC address of all packets.
Get cache from switch.
Theory
ARP (Address Resolution Protocol) is a network protocol used to find out the hardware
(MAC) address of a device from an IP address. It is used when a device wants to communicate
with some other device on a local network (for example on an Ethernet network that requires
physical addresses to be known before sending packets). The sending device uses ARP to
translate IP addresses to MAC addresses. The device sends an ARP request message containing
the IP address of the receiving device. All devices on a local network segment see the message,
but only the device that has that IP address responds with the ARP reply message containing its
MAC address. The sending device now has enough information to send the packet to the
receiving device.
50 | P a g e
Network Topology Diagram for ARP
51 | P a g e
OUTPUT:
ARP CATCH TABLE OF PC1 (IP: 10.0.0.2):
C:\>arp -a
Result:
Thus, constructed a simple LAN and understand the concept and operation of ARP and
got the ARP Cache of given layout.
52 | P a g e
Experiment: 10(b)
Configuration of Routing Information protocol
Aim:
To understand the concept and operation of Routing Information Protocol (RIP)
Requirements
Windows pc – 2 Nos
CISCO Packet Tracer Software ( Student Version)
8 port switch – 2 No
Router – 2 Nos
Cat-5 LAN cable
Procedure
Open the CISCO Packet tracer software
Drag and drop 5 pcs using End Device Icons on the left corner
Select 8 port switch from switch icon list in the left bottom corner
Select Routers and Give the IP address for serial ports of router and apply clock rate as
per the table.
Make the connections using Straight through Ethernet cables
Ping between PCs and observe the transfer of data packets in real and simulation mode.
Theory
RIP (Routing Information Protocol) is one of the oldest distance vector routing
protocols. It is usually used on small networks because it is very simple to configure and
maintain, but lacks some advanced features of routing protocols like OSPF or EIGRP. Two
versions of the protocol exists: version 1 and version 2. Both versions use hop count as a metric
and have the administrative distance of 120. RIP version 2 is capable of advertising subnet
masks and uses multicast to send routing updates, while version 1 doesn’t advertise subnet
masks and uses broadcast for updates. Version 2 is backwards compatible with version 1.
RIPv2 sends the entire routing table every 30 seconds, which can consume a lot of
bandwidth. RIPv2 uses multicast address of 224.0.0.9 to send routing updates, supports
authentication and triggered updates (updates that are sent when a change in the network
occurs).
53 | P a g e
Network Topology Diagram for RIP
54 | P a g e
OUTPUT:
RIP (PINGING FROM PC0 TO PC1):
C:\>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 192.168.2.2: bytes=32 time=11ms TTL=126
Reply from 192.168.2.2: bytes=32 time=12ms TTL=126
Reply from 192.168.2.2: bytes=32 time=13ms TTL=126
Reply from 192.168.2.2: bytes=32 time=11ms TTL=126
Ping statistics for 192.168.2.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 11ms, Maximum = 13ms, Average = 11ms
Result:
Thus, understand the concept and operation of RIP and pinged from PC in are networks
to PC to another network.
55 | P a g e
Experiment: 11
Configuration of internet protocol (IP)
Aim:
To understand the Configuration of internet protocol (IP)
Requirements
Windows pc – 2 Nos
Procedure
You configure TCP/IP from the network configuration tool in the Microsoft Windows Control Panel.
Click the Protocol tab and select TCP/IP Protocol. Then click the Properties button to display the
Properties panel
If the TCP/IP Protocol is not already installed, click Add and then select the TCP/IP Protocol.
Configuration consists of assigning a Hostname, an IP Address, and a Network Mask to a given
network interface.
In the IP Address tab, use the pull-down list to choose the Adapter you will use. Your network
administrator can tell you whether you will be using DHCP or a static IP address. If using a static IP,
then you must enter the appropriate values for IP Address, Subnet Mask, and Default Gateway.
56 | P a g e
Additional configuration consists of defining a Name Server IP Address or creating entries in the
Hosts file on the local machine. Name Servers translate host names into IP Addresses when queried
on a particular host name. The Hosts file provides this same functionality, but in a non-network
participating manner.
DNS Server
Domain Name System (DNS) is one of the industry-standard suite of protocols that comprise
TCP/IP. Microsoft Windows Server 2003. DNS is implemented using two software components:
the DNS server and the DNS client (or resolver).DNS is implemented using two software
components: the DNS server and the DNS client (or resolver). Both components are run as
background service applications.
Gateway
Gateway is a device that connects two or more networks with different types of protocols. Two
different types of networks require a gateway to communicate with each other. It receives data from
one network and converts it according to the protocol of other network. For example, the computers
on a LAN require gateway to access the internet.
IP Address
57 | P a g e
An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g.,
computer, printer) participating in a computer network that uses the Internet Protocol for
communication. An IP address serves two principal functions: host or network
interface identification and location addressing. IP addresses are usually written and displayed
in human-readable notations, such as 172.16.254.1 (IPv4), and 2001:db8:0:1234:0:567:8:1 (IPv6).
Subnet Mask
A subnet mask is a screen of numbers used for routing traffic within a subnet. Once a packet has
arrived at an organization's gateway or connection point with its unique network number, it can be
routed to its destination within the organization's internal gateways using the subnet number.
Result:
Thus the Configuration of internet protocol (IP) was done.
58 | P a g e
Experiment: 12
Apparatus required
59 | P a g e
end
end
disp(A);
t=1:20;
disp(t);
disp(A);
status(1)='!';
dist(1)=0;
next(1)=0;
for i=2:20
status(i)='?';
dist(i)=A(i,1);
next(i)=1;
disp(['i== ' num2str(i) ' A(i,1)=' num2str(A(i,1)) ' status:=' status(i) ' dist(i)=' num2str(dist(i))]);
end
flag=0;
for i=2:20
if A(1,i)==1
disp([' node 1 sends RREQ to node ' num2str(i)])
if i==20 && A(1,i)==1
flag=1;
end
end
end
disp(['Flag= ' num2str(flag)]);
while(1)
if flag==1
break;
end
temp=0;
for i=1:20
if status(i)=='?'
min=dist(i);
vert=i;
break;
60 | P a g e
end
end
for i=1:20
if min>dist(i) && status(i)=='?'
min=dist(i);
vert=i;
end
end
status(vert)='!';
for i=1:20
if status()=='!'
temp=temp+1;
end
end
if temp==20
break;
end
end
i=20;
count=1;
route(count)=20;
AODV OUTPUT
Result:
Thus, Simulated and verified the operation of AODV Routing Algorithm and understand
its operation.
62 | P a g e
Experiment: 13
Configuration of network using Dynamic Source Routing (DSR) routing
Aim:
To configure the network using Dynamic Source Routing (DSR) routing with TCL script
using NS-2.
Introduction:
Mobile Ad Hoc Network is a multi-hop packet based wireless network composed of a set of
mobile nodes that can communicate and move at the same time, without using any kind of fixed
wired infrastructure. It can change locations and configure itself. In this experiment, we will learn
how to prepare MANET scenario by using AODV and DSR protocol with different TCL script
Ad Hoc Network
Ad-hoc networks are temporary network. They do not need any external infrastructure like base
stations and physical wires.
Mobile Ad-hoc Network (MANET) MANET automatically configures a network among
mobile devices. Each devices move independently in any direction. Each node acts as a router.
A typical MANET is shown in the figure-01 below:
Routing
Routing is the selection of path or a route in a network for forwarding packets. The objective of
routing packets in a network is to determine the best possible path in terms of minimising the
number of hops (path length), delay, packet loss, cost etc.
Routing in MANET
MANETs are formed dynamically by connecting arbitrary wireless mobile nodes, without
using existing infrastructure. So, routing in MANET is different from traditional routing. Each
node in MANET functions like a host and a router. The nodes also used in
forwarding/receiving their own packets. The nodes also take part in forwarding other's node
packet. Therefore, MANET provides limited physical security as compared to the traditional
network.
63 | P a g e
Routing protocols for MANET
Routing protocols for a MANET can be classified as:
Proactive (table-driven) : DSDV, OLSR etc.
Reactive (on-demand): AODV, DSR etc.
Hybrid: ZRP
Proactive routing protocols determine path in advance and periodically exchange routing data
to maintain the path.
Reactive routing protocols, on the other hand, determine a route to some destination node only
when it is required to send some data to that node. If at any time a path fails, an alternative path
is determined again.
Hybrid routing takes the advantages of both table driven and on-demand algorithms.
64 | P a g e
07 -propType $val(prop) \ #propagation model
08 -phyType $val(netif) \ #network interface type
09 -topoInstance $topo \ #topography instance
10 -agentTrace ON \ #tracing at agent level
11 -routerTrace ON \ #tracing at router level
12 -macTrace ON \ #tracing at mac level
13 -movementTrace ON \ #mobile node movement
14 -channel $chan_1_
The four last option in node configuration can either be ON or OFF based on the condition of
the mobile nodes. The agent trace will give the trace of TCP, routerTrace provides tracing of
packets used in routing, macTrace is used to trace MAC protocol packets and movementTrace
is used to allow tracing the motion of nodes for nam.
The prime goal of this simulation is setup MANET with routing protocol DSR. The
simulation is written by TCL script. The network performance is analyzed by trace file. The trace file
is generated automatically after the simulation is completed. The trace file contains all activities that
happened during the simulation and it recorded all the data based on the event. This simulation shows
the MANET setup, how a packet is transferred from source to destination, what happens if the
network gets disrupted, and how new routing path is constructed after disruption or topology changes
or node dead. This simulation is set up with four mobile nodes and performs packet transfer and
acknowledgment, route disruption and new route formation. This simulation contains an
introduction, theory, simulation, self-evaluation, procedure, exercises and references section to get
the insight of routing in MANET.
65 | P a g e
Simulation
Click button 1 to setup a MANET with four nodes. It shows how nodes form a network
automatically and perform packet transformation from node1 to node 4 with acknowledgment.
Figure 1 shows the simulation view.
Then, Click button 2. It describes and shows a packet transformation when disruption of routing path
between node 1 to node2. Here, when node2 moved out of the coverage, new routing path will be
constructed between node 1 and node 2 without node2. Figure 2 shows the route disruption scenario.
66 | P a g e
New routing path (path: Node1 – node 4 – node 3) will be constructed automatically when node2
moves out of the transmission range. Figure 3 shows the packet transformation through new routing
path and figure 4 shows the how acknowledgment packet transfer from destination node(node3) to
the source node (node1).
67 | P a g e