Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
12 views120 pages

Cns Man

Uploaded by

Sakshi Wadikar
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)
12 views120 pages

Cns Man

Uploaded by

Sakshi Wadikar
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
You are on page 1/ 120

Pimpri-Chinchwad Educational Trusts

Pimpri-Chinchwad College of Engineering And Research,


Ravet, Pune

DEPARTMENT OF COMPUTER ENGINEERING

LAB MANUAL
Computer Networks and Security Laboratory
Pimpri Chinchwad Education Trust’s
Pimpri Chinchwad College of Engineering &
Research Ravet, Pune
IQAC PCCOER
Academic Year: 2024 - 25 Term: I
LABORATORY MANUAL
Subject: Computer Networks and Security
Laboratory

[Subject Code: 310247]

Class: TE Computer Engineering

Year: 2024-25

Semester: I

Prepared by: Approved by

1) Dr. Swati Nikam


2) Rutuja Magar Dr. Archana A. Chaugule

Subject Teachers H.O.D


Vision – Mission of the Institute
Vision

Vision – Mission of the Computer Department


To be a Premier institute of technical education & research to serve the need of society and all the stakeholders.

Mission

To establish state-of-the-art facilities to create an environment resulting in individuals who are technically sound
having professionalism, research and innovative aptitude with high moral and ethical values.

Vision
To strive for excellence in the field of Computer Engineering and Research through Creative Problem Solving related
to societal needs

Mission:

1. Establish strong fundamentals, domain knowledge and skills among the students with analytical thinking,
conceptual knowledge, social awareness and expertise in the latest tools & technologies to serve industrial
demands
2. Establish leadership skills, team spirit and high ethical values among the students to serve industrial demands
and societal needs
3. Guide students towards Research and Development, and a willingness to learn by connecting themselves to the
global society

Program Educational Objectives (PEO)


1. To prepare graduates who have strong mathematical, scientific, and engineering fundamenta meet

Program Specific Outcomes (PSO)


technological challenges and make them globally competent
2. To prepare committed and motivated graduates with strong communication, managerial leadership
skills those augment their professional competency, and make them productive t players who can
demonstrate professionalism and Ethics in their work.
3. To prepare graduates with a high level of technical proficiency along with research and prob solving
abilities to produce innovative solutions in the field of Computer Engineering.

A graduate of the Computer Engineering Program will demonstrate-

PSO1: Problem-Solving Skills- The ability to apply standard practices and strategies in software project development
using open-ended programming environments to deliver a quality project.

PSO2: Professional Skills-The ability to understand, analyze and develop computer programs in the areas related to
algorithms, software testing, application software, web design, data analytics, IOT and networking for efficient design
of computer-based systems.

PSO3: Successful Career and Entrepreneurship- The ability to employ modern computer languages, environments,
and platforms in creating innovative career paths to be an entrepreneur, and a zest for higher studies, and to generate
IPR & Deliver a quality project.
Course Objectives:
• To learn computer network hardware and software components
• To learn computer network topologies and types of network
• To develop an understanding of various protocols, modern technologies and applications
• To learn modern tools for network traffic analysis
• To learn network programming
• To introduce the concepts and components of Business Intelligence (BI)
• To learn the fundamentals of Software Defined Networks (SDN)

Cognitiv
CO
Statements e level of
learning
Analyze the requirements of network types, topology and
C307.1 transmission media BT- 4 Analyze
Demonstrate error control, flow control techniques and protocols and
BT-3
C307.2 analyze them
Demonstrate
(Apply)
Demonstrate the subnet formation with IP allocation mechanism BT-3
C307.3 and apply various routing algorithms Demonstrate
(Apply)
C307.4 Develop Client-Server architectures and prototypes
BT -6 Develop
(Create)
C307.5 Implement web applications and services using application layer BT-3
protocols Implement
((Apply))
C307.6 Use network security services and mechanisms
BT-3 use
(Apply)
Course Outcomes:
Index

Sr. Title of the Experiment CO Date of Page No. Sign. of Remarks*


No. Performance From To teacher

To study the SSL protocol by


capturing the packets using C307.6
1
Wireshark tool while visiting any
SSL secured website (banking, e-
commerce etc.).
Capture packets using Wireshark,
write the exact packet capture filter
expressions to accomplish the
following and save the output in
file: 1. Capture all TCP traffic
to/from Facebook, during the time
when you log in to your Facebook
account 2. Capture all HTTP traffic
to/from Facebook, when you log in
to your Facebook account 3. Write
a DISPLAY filter expression to C307.5
2 count all TCP packets (captured
under item #1) that have the flags
SYN, PSH, and RST set. Show the
fraction of packets that had each
flag set.
Count how many TCP packets you
received from / sent to Face book,
and how many of each were also
HTTP packets.

3 Write a program for DNS lookup. C307.4


Given an IP address as input, it
should return URL and vice- versa.
Write a program using TCP socket
4 for wired network for following a. C307.4
Say Hello to Each other b. File
transfer c. Calculator
5 Write a program using UDP C307.4
Sockets to enable file transfer
(Script, Text, Audio and Video one
file each) between two machines.
Department of Computer Engineering PCET’s PCCOER, Pune-412101

Write a program to simulate Go


6 back N and Selective Repeat C307.2
Modes of Sliding Window
Protocol in Peer-to-Peer mode.

Write a program to demonstrate


Sub-netting and find subnet masks.
7 C414.3

Write a program for error detection C307.2


and correction for 7/8 bits ASCII
8
codes using Hamming Codes or
CRC.
Write a program to implement link
9 state /Distance vector routing C307.4
protocol to find suitable path for
transmission
To study the IPsec (ESP and AH)
10 protocol by capturing the packets C414.3
using Wireshark tool
Demonstrate the different types of
11 topologies and types of C307.1
transmission media by using a
packet tracer tool
Setup a WAN which contain wired
as well as wired LAN by using a
packet tracer tool. Demonstrate
12 C307.1
transfer of packet from LAN 1
(wired LAN) to LAN 2 (Wireless
LAN))
Study and Analyze the
13 performance of HTTP, HTTPS and C307.5
FTP protocol using Packet tracer
tool
Use packet Tracer tool for
14 configuration of 3 router network C307.6
using one of the following protocol
RIP/OSPF/BGP.

Department of Computer Engineering PCET’s PCCOER, Pune-412101


CERTIFICATE

This is to certify that Mr./Miss/Mrs.


Roll No.: Exam. Seat No.: of SE/TE/BE Computer has carried out above practical
/term work within PCCOER as prescribed by Savitribai Phule Pune University, Pune during the academic year
2024 -2025. His/hers performance is satisfactory and attendance is %.

Date: Faculty I/C HOD Principal


Department of Computer Engineering PCET’s PCCOER, Pune-412101
Assignment No: 1
Problem Statement: To study the SSL protocol by capturing the packets using
Wireshark tool while visiting any SSL secured website (banking, e-commerce etc.)
Objectives: To learn modern tools for network traffic analysis
Outcome: Use network security services and mechanisms Software
& Hardware Requirements:
Operating System: Ubuntu
Packet Analyzer Tool: Wireshark
Hardware: i3 Processor, 4GB RAM, 500GB HDD

Theory:
1. What is SSL, TLS, and HTTPS?
SSL (Secure Socket Layer) and TLS (Transport Layer Security) are popular cryptographic
protocols that are used to imbue web communications with integrity, security, and
resilience against unauthorized tampering. PKI uses the TLS protocol to establish secure
connections between clients and servers over the internet, ensuring that the information
relayed is encrypted and unable to be read by an external third party.
Note: SSL was the predecessor of TLS, and the world began moving away from SSL once
TLS was introduced in 1999, thanks to the improved security features of the latter. TLS is
currently in its third iteration, and is called TLS 1.3. However, SSL continues to be used as
a metonym for both protocols in general (for example, the word ‘SSL certificate’ is widely
used, but SSL has been completely deprecated and no modern systems support SSL
anymore).
Connections that are secured by TLS will indicate their secure status by displaying HTTPS
(Hypertext Transfer Protocol Secure) in the address bar of web browsers, as opposed to
just HTTP.
While TLS is primarily used to secure client-server connection, it is also used to protect
emails, VoIP calls, and other connections.
1.1. Why are they necessary?
In theory, web connections are completely possible without TLS to secure them. However,
without a security protocol in place, the communication would be rendered completely
open to external access. If a browser connected to the website of an online store, and a
user had to enter their credentials to log in, those credentials could easily be lifted by an
observing party.
TLS, at its core, serves to provide end-to-end encryption for all data transmitted from one
point to another, and uses cryptography to ensure that only the two transacting bodies
are capable of reading this information. Every service in the world now Mandates that
connections are secure by TLS – leading browsers do not allow users to access websites
without a valid TLS connection. TLS has the following benefits:
● The contents of the connection remain encrypted, private, and fully secure – and
cannot be easily deciphered by malicious actors.
● The connection is only made if it is reliable – this reliability check is a part of TLS
communications, and is enforced by the exchange of a Message Authentication Code.
● The use of PKI and TLS certificates ensures that the identities of both communicating
parties are verified.
2. SSL/TLS Handshake Process
1. The “client hello” message: The client sends a “client hello” message that lists
cryptographic information such as the TLS version and, the cipher suites supported by
the client in an order of preference. The message also contains a string of random
bytes, known as the “client random”, that is used in subsequent computations.
2. The “server hello” message: The server responds with a “server hello” message that
contains the cipher suite chosen by the server from the list provided by the client, the
session ID, and another string of random bytes, called the “server random”. The server
also sends its TLS certificate. If the server requires a digital certificate for client
authentication, the server sends a "client certificate request" that includes a list of the
types of certificates supported and the Distinguished Names of acceptable
Certification Authorities (CAs).
3. Server authentication: The client verifies the server's TLS certificate with the
certificate authority that issued it. This confirms that the server is who it says it is, and
that the client is interacting with the actual owner of the domain.
4. Premaster secret: The client sends one more random string of bytes, the “premaster
secret.” The premaster secret is encrypted with the server’s public key (included in the
server’s TLS certificate) and can only be decrypted with the private key by the server.
5. Client authentication: If the server has sent a “client certificate request”, the client
sends its digital certificate. The server verifies the client's certificate.
6. Session keys creation: The server decrypts the premaster secret. Both client and server
generate session keys from the client random, the server random, and the premaster
secret.
7. Client is ready: The client sends the server a “finished” message, which is encrypted
with the secret session key, indicating that the client part of the handshake is complete.
8. Server is ready: The server sends the client a “finished” message, which is encrypted
with the secret session key, indicating that the server part of the handshake is
complete.
9. Secure symmetric encryption achieved: For the duration of the TLS session, the server
and client can now exchange messages that are symmetrically encrypted with the
shared secret session key.
Fig. SSL/TLS Handshake Process

3. Secure Socket Layer Protocols:

Fig. Secure Socket Layer Protocols


3.1 SSL Record Protocol:
SSL Record provides two services to SSL connection.
● Confidentiality
● Message Integrity
In the SSL Record Protocol application data is divided into fragments. The fragment is
compressed and then encrypted MAC (Message Authentication Code) generated by
algorithms like SHA (Secure Hash Protocol) and MD5 (Message Digest) is appended. After that
encryption of the data is done and in last SSL header is appended to the data.

3.2 Handshake Protocol:


Handshake Protocol is used to establish sessions. This protocol allows the client and server
to authenticate each other by sending a series of messages to each other. Handshake protocol
uses four phases to complete its cycle.
● Phase-1: In Phase-1 both Client and Server send hello-packets to each other. In this
IP session, cipher suite and protocol version are exchanged for security purposes.
● Phase-2: Server sends his certificate and Server-key-exchange. The server end
phase-2 by sending the Server-hello-end packet.
● Phase-3: In this phase Client reply to the server by sending his certificate and Client-
exchange-key.
● Phase-4: In Phase-4 Change-cipher suite occurred and after this Handshake
Protocol ends.
3.3 Change-cipher Protocol:
This protocol uses the SSL record protocol. Unless Handshake Protocol is completed, the SSL
record Output will be in a pending state. After handshake protocol, the
Pending state is converted into the current state.
Change-cipher protocol consists of a single message which is 1 byte in length and can have
only one value. This protocol’s purpose is to cause the pending state to be copied into the
current state.

Alert Protocol:
This protocol is used to convey SSL-related alerts to the peer entity. Each message in this
protocol contain 2 bytes.
The level is further classified into two parts:
● Warning:
This Alert has no impact on the connection between sender and receiver.
● Fatal Error:
This Alert breaks the connection between sender and receiver. Silent
Features of Secure Socket Layer:
● The advantage of this approach is that the service can be tailored to the specific
needs of the given application.
● Secure Socket Layer was originated by Netscape.
● SSL is designed to make use of TCP to provide reliable end-to-end secure service.
● This is a two-layered protocol.

Conclusion:
Hence, we have successfully studied the SSL protocol by capturing the packets using
Wireshark tool while visiting any SSL secured website.
Wireshark Analysis

:
Assignment No:2
Problem Statement: Capture packets using Wireshark, write the exact packet capture filter
expressions to accomplish the following and save the output in file:
1. Capture all TCP traffic to/from Facebook, during the time when you log in to your Facebook
account
2. Capture all HTTP traffic to/from Facebook, when you log in to your Facebook account
3. Write a DISPLAY filter expression to count all TCP packets (captured under item #1) that have
the flags SYN, PSH, and RST set. Show the fraction of packets that had each flag set.

4. Count how many TCP packets you received from / sent to Face book, and how many of each
were also HTTP packets.
Objectives: To learn modern tools for network traffic analysis
Outcome: Use network security services and mechanisms Software &
Hardware Requirments:
Operating System: Ubuntu Packet
Analyzer Tool: Wireshark

Theory:
1. Introduction
Wireshark is a network packet analyzer. A network packet analyzer presents captured packet data in
as much detail as possible. You could think of a network packet analyzer as a measuring device for
examining what’s happening inside a network cable, just like an electrician uses a voltmeter for
examining what’s happening inside an electric cable (but at a higher level, of course). In the past, such
tools were either very expensive, proprietary, or both. However, with the advent of Wireshark, that has
changed. Wireshark is available for free, is open source, and is one of the best packet analyzers available
today.
1.1 Features
The following are some of the many features Wireshark provides:
● Available for UNIX and Windows.
● Capture live packet data from a network interface.
● Open files containing packet data captured with tcpdump/WinDump, Wireshark, and
many other packet capture programs.
● Import packets from text files containing hex dumps of packet data.
● Display packets with very detailed protocol information.
● Save packet data captured.
● Export some or all packets in a number of capture file formats.
● Filter packets on many criteria.
● Search for packets on many criteria.
● Colorize packet display based on filters. ● Create various statistics.
2. Wireshark Filter
2.1 Display Filter
Wireshark provides a display filter language that enables you to precisely control which packets
are displayed. They can be used to check for the presence of a protocol or field, the value of a field,
or even compare two fields to each other. These comparisons can be combined with logical
operators, like "and" and "or", and parentheses into complex expressions.

Wireshark's display filter uses Boolean expressions, so you can specify values and chain them
together. The following expressions are commonly used:
● Equals: == or eq
● And: && or and
● Or: || (double pipe) or or
2.1.1 Example
1. eth.src == 00:11:22:33:44:55: Source MAC address is 00:11:22:33:44:55
2. ip.addr == 10.0.0.1: Find all traffic that has IP of 10.0.0.1
3. tcp.dstport != 80: Destination tcp port is NOT 80
4. ip.addr==10.10.10.1
5. ip.addr==192.168.1.10 && ip.addr==192.168.1.20
6. !(ip.addr==192.168.1.10 && ip.addr==192.168.1.20)
7. (ip.addr==192.168.1.10 && ip.addr==192.168.1.20) && (tcp.port==445 ||
tcp.port==139)
8. ip.src==10.10.10.0/24
9. eth.addr==00:1b:17:00:01:31
10. ip.addr==10.10.10.1 && tcp.port==80
11. tcp.port==80
12. tcp.port==80 || tcp.port==3389
13. tcp.dstport==80
14. eth.dst=ff:ff:ff:ff:ff:ff
15. ip.addr==255.255.255.255 ip.host contains "imap"
2.2 Capture Filters
Capture filters are used to decrease the size of captures by filtering out packets before they are
added. Capture filters enable you to capture only traffic that you want to be captured, eliminating an
unwanted stream of packets. Capturing packets is a processor- intensive task, and packet analyzers use a
good amount of primary memory while they are running. Packets are only sent to the capture engine
if they meet a certain criterion (capture filter expressions).
Examples
Capture only traffic to or from IP address 172.18.5.4:
● host 172.18.5.4
Capture traffic to or from a range of IP addresses:
● net 192.168.0.0/24 or
● net 192.168.0.0 mask 255.255.255.0
Capture traffic from a range of IP addresses:
● src net 192.168.0.0/24 or
● src net 192.168.0.0 mask 255.255.255.0 Capture traffic to a range of IP addresses:
● dst net 192.168.0.0/24 or
● dst net 192.168.0.0 mask 255.255.255.0 Capture only DNS (port 53) traffic:
● port 53
Capture non-HTTP and non-SMTP traffic on your server (both are equivalent):
● host www.example.com and not (port 80 or port 25) host www.example.com and
not port 80 and not port 25 Capture except all ARP and DNS traffic:
● port not 53 and not arp
Capture traffic within a range of ports
● (tcp[0:2] > 1500 and tcp[0:2] < 1550) or (tcp[2:2] > 1500 and tcp[2:2] < 1550) or,
with newer versions of libpcap (0.9.1 and later):
● tcp portrange 1501-1549
Capture only Ethernet type EAPOL:
● ether proto 0x888e
Reject ethernet frames towards the Link Layer Discovery Protocol Multicast group: ● not
ether dst 01:80:c2:00:00:0e
Capture only IPv4 traffic - the shortest filter, but sometimes very useful to get rid of lower
layer protocols like ARP and STP:
● ip
Capture only unicast traffic - useful to get rid of noise on the network if you only want to see
traffic to and from your machine, not, for example, broadcast and multicast announcements:
● not broadcast and not multicast
Capture IPv6 "all nodes" (router and neighbor advertisement) traffic. Can be used to find
rogue RAs:
● dst host ff02::1

3. trace route command


The Trace route command (tracert) is a utility designed for displaying the time it takes for
a packet of information to travel between a local computer and a destination IP address or
domain. The results displayed after running a traceroute command are a list of the 'hops' that
data packets take along their path to the designated IP address or domain. This command is
commonly associated with the troubleshooting of connection issues. Syntax: tracert
example.com

Conclusion:
Hence, we have Successfully Capture packets using Wireshark and wrote the exact packet
capture filter expressions.
Program:
1. Identify Facebook.com IP Address sudo apt-get install traceroute traceroute
facebook.com
traceroute to facebook.com (31.13.86.8), 30 hops max, 60 byte packets

2. Capture all TCP traffic to/from Facebook, during the time when you log in to your
Facebook account.
Capture filter: tcp and host 31.13.86.8
3. Capture all HTTP traffic to/from Facebook, when you log in to your Facebook account
Capture filter: tcp port 80 and host 31.13.86.8

4. Write a DISPLAY filter expression to count all TCP packets (captured under item #1)
that have the flags SYN, PSH, and RST set. Show the fraction of packets that had each flag
set.
DISPLAY filter:
tcp.flags.syn==1 && ip.dst==31.13.86.8
tcp.flags.push==1 && ip.dst==31.13.86.8
tcp.flags.reset==1 && ip.dst==31.13.86.8
5. Count how many TCP packets you received from / sent to Face book, and how many
of each were also HTTP packets.
Assignment : 3

Title: Study of DNS Lookup


OBJECTIVES:

1. To learn and understand DNS lookup.


2. To learn and Understand concept of IP protocol

PROBLEM STATEMENT
Write a program for DNS lookup. Given an IP address input, it should return URL and vice-
versa.

Prerequisite:

Basic concepts of DNS working.


Forward and Reverse lookup
Software Requirements: C/C++/Java/Python

Hardware Requirement:
PIV, 2GB RAM, 500 GB HDD, Lenovo A13-4089Model. Outcomes:
After completion of this assignment students can learn about DNS working

Theory: -

DNS in TCP/IP
Technologies That Use DNS

DNS and Active Directory


Windows Server 2003 Active Directory directory service uses DNS as its domain
controller location mechanism. When any of the principal Active Directory operations
is performed, such as authentication, updating, or searching, Windows Server 2003
computers use DNS to locate Active Directory domain controllers and these domain
controllers use DNS to locate each other. For example, when a network user with an
Active Directory user account logs in to an Active Directory domain, the user’s
computer uses DNS to locate a domain controller for the Active Directory domain to
which the user wants to log in.

DNS and WINS


The earlier method of name resolution for a Windows network was Windows Internet
Name Service (WINS). DNS is different than WINS in that DNS is a hierarchical
namespace and WINS is a flat namespace. Down-level clients and applications that
rely on NetBIOS names continue to use WINS for name resolution. Since Windows
Server 2003 DNS is WINS-aware, a combination of both DNS and WINS can be used
in a mixed environment to achieve maximum efficiency in locating various network
services and resources.
DNS and DHCP
For Windows Server 2003 DNS, the DHCP service provides default support to register
and update information for legacy DHCP clients in DNS zones. Legacy clients
typically include other Microsoft TCP/IP client computers that were released prior to
Windows 2000. The Windows Server 2003 DNS-DHCP integration enables a DHCP
client that is unable to dynamically update DNS resource records directly to have this
information updated in DNS forward and reverse lookup zones by the DHCP server.

Domain Name System (DNS) is the default name resolution service used in a
Microsoft Windows Server 2003 network. DNS is part of the Windows Server 2003
TCP/IP protocol suite and all TCP/IP network connections are, by default, configured
with the IP address of at least one DNS server in order to perform name resolution on
the network. Windows Server 2003 components that require name resolution will
attempt to use this DNS server before attempting to use the previous default Windows
name resolution service, Windows Internet Name Service (WINS).
Typically, Windows Server 2003 DNS is deployed in support of Active Directory
directory service. In this environment, DNS namespaces mirror the Active Directory
forests and domains used by an organization. Network hosts and services are
configured with DNS names so that they can be located in the network, and they are
also configured with DNS servers that resolve the names of Active Directory domain
controllers.
Windows Server 2003 DNS is also commonly deployed as a non-Active Directory, or
standard, Domain Name System solution, for the purposes of hosting the Internet
presence of an organization, for example.

DNS Architecture
DNS architecture is a hierarchical distributed database and an associated set of
protocols that define:

• A mechanism for querying and updating the database.

• A mechanism for replicating the information in the database among servers.

• A schema of the database.


DNS originated in the early days of the Internet when the Internet was a small network
established by the United States Department of Defense for research purposes. The
host names of the computers in this network were managed through the use of a single
HOSTS file located on a centrally administered server. Each site that needed to resolve
host names on the network downloaded this file. As the number of hosts on the Internet
grew, the traffic generated by the update process increased, as well as the size of the
HOSTS file. The need for a new system, which would offer features such as scalability,
decentralized administration, support for various data types, became more and more
obvious.

DNS Domain Names


The Domain Name System is implemented as a hierarchical and distributed database
containing various types of data, including host names and domain names. The names
in a DNS database form a hierarchical tree structure called the domain namespace.
Domain names consist of individual labels separated by dots, for example:
mydomain.microsoft.com.
A Fully Qualified Domain Name (FQDN) uniquely identifies the hosts position within
the DNS hierarchical tree by specifying a list of names separated by dots in the path
from the referenced host to the root. The next figure shows an example of a DNS tree
with a host called my domain within the microsoft.com. domain. The FQDN for the
host would be mydomain.microsoft.com.
Understanding the DNS Domain Namespace
The DNS domain namespace, as shown in the following figure, is based on the concept
of a tree of named domains. Each level of the tree can represent either a branch or a
leaf of the tree. A branch is a level where more than one name is used to identify a
collection of named resources. A leaf represents a single name used once at that level
to indicate a specific resource.

DNS Domain Name Hierarchy

The previous figure shows how Microsoft is assigned authority by the Internet root
servers for its own part of the DNS domain namespace tree on the Internet. DNS
clients and servers use queries as the fundamental method of resolving names in the
tree to specific types of resource information. This information is provided by DNS
servers in query responses to DNS clients, who then extract the information and pass
it to a requesting program for resolving the queried name. In the process of resolving
a name, keep in mind that DNS servers often function as DNS clients, querying other
servers in order to fully resolve a queried name.
How the DNS Domain Namespace Is Organized
Any DNS domain name used in the tree is technically a domain. Most DNS discussions,
however, identify names in one of five ways, based on the level and the way a name is
commonly used. For example, the DNS domain name registered to Microsoft

(microsoft.com.) is known as a second-level domain. This is because the name has two
parts (known as labels) that indicate it is located two levels below the root or top of the
tree. Most DNS domain names have two or more labels, each of which indicates a new
level in the tree. Periods are used in names to separate labels. The five categories used to
describe DNS domain names by their function in the namespace are described in the
following table, along with an example of each name type.

Types of DNS Domain Names

Name Type Description Example

This is the top of the tree, representing


an unnamed level; it is sometimes
shown as two empty quotation marks
(""), indicating a null value. When used
in a DNS domain name, it is stated by a
trailing period (.) to designate that the
name is located at the root or highest
level of the domain hierarchy. In this
instance, the DNS domain name is
considered to be complete and points to A single period (.) or a period
an exact location in the tree of names. Used at the end of a name,
Root Names stated this way are called fully such as
domain qualified domain names (FQDNs). “example.microsoft.com.”
“com”, which indicates a
Name
A name used to indicate a registered to a business for
Top level country/region or the type of commercial use on the
domain organization using a name. Internet.
Variable-length names registered to an
individual or organization for use on the
Internet. These names are always based “microsoft.com. ”, which is the
upon an appropriate top-level domain, second-level domain
Second depending on the type of organization or Name registered to Microsoft
level geographic location where a name is by the Internet DNS
domain used. Domain name registrar.

Additional names that an organization ““example.microsoft.com. ”,


can create that are derived from the which
registered second-level domain name. is a fictitious
These include names added to grow the subdomain assigned by
DNS tree of names in an organization Microsoft for use in
and divide it into departments or documentation
Subdomain geographic locations. example names.

Questions:
1] Differentiate between Iterative and Recursive Query.
Conclusion: - Thus we studied DNS in detail and implement the forward and reverse
lookup.
Assignment No: 4
Problem Statement: Write a program using TCP socket for wired network for following
a) Say Hello to Each other b)File transfer c)Calculator.
Objectives: To learn network programming

Outcome: Develop Client-Server architectures and prototypes

Software & Hardware Requirments:


Operating System: Ubuntu
Programming Language: java
Editor: Eclipse Theory:

1. Introduction
The term network programming refers to writing programs that execute across
multiple devices (computers), in which the devices are all connected to each other using
a network.
The java.net package of the J2SE APIs contains a collection of classes and interfaces that
provide the low-level communication details, allowing you to write programs that focus
on solving the problem at hand.
The java.net package provides support for the two common network protocols: TCP:
TCP stands for Transmission Control Protocol, which allows for reliable
communication between two applications. TCP is typically used over the
Internet Protocol, which is referred to as TCP/IP.
UDP: UDP stands for User Datagram Protocol, a connection-less protocol that
allows for packets of data to be transmitted between applications.
2. Socket Programming:
Sockets provide the communication mechanism between two computers using TCP. A
client program creates a socket on its end of the communication and attempts to connect
that socket to a server.
When the connection is made, the server creates a socket object on its end of the
communication. The client and server can now communicate by writing to and reading
from the socket.
The java.net.Socket class represents a socket, and the java.net.ServerSocket class provides
a mechanism for the server program to listen for clients and establish connections with
them.
The following steps occur when establishing a TCP connection between two
computers using sockets:
• The server instantiates a ServerSocket object, denoting which port
number communication is to occur on.
• The server invokes the accept() method of the ServerSocket class.
This method waits until a client connects to the server on the given
port.
• After the server is waiting, a client instantiates a Socket object,
specifying the server name and port number to connect to.
• The constructor of the Socket class attempts to connect the client to
the specified server and port number. If communication is
established, the client now has a Socket object capable of
communicating with the server.
• On the server side, the accept() method returns a reference to a new
socket on the server that is connected to the client's socket.
After the connections are established, communication can occur using I/O streams.
Each socket has both an OutputStream and an InputStream. The client's OutputStream is
connected to the server's InputStream, and the client's InputStream is connected to the
server's OutputStream.

3. ServerSocket Class Methods:

public ServerSocket(int port) throws IOException


Attempts to create a server socket bound to the specified port. An exception occurs if the
port is already bound by another application.

public ServerSocket(int port, int backlog) throws IOException


Similar to the previous constructor, the backlog parameter specifies how many incoming
clients to store in a wait queue.

public ServerSocket(int port, int backlog, InetAddress address)


throws IOException
Similar to the previous constructor, the InetAddress parameter specifies the local IP
address to bind to. The InetAddress is used for servers that may have multiple IP
addresses, allowing the server to specify which of its IP addresses to accept client
requests on

public ServerSocket() throws IOException


Creates an unbound server socket. When using this constructor, use the bind() method
when you are ready to bind the server socket
public Socket accept() throws IOException
Waits for an incoming client. This method blocks until either a client connects to the
server on the specified port or the socket times out, assuming that the time-out value has
been set using the setSoTimeout() method. Otherwise, this method blocks indefinitely
4. Socket Class Methods:
The java.net.Socket class represents the socket that both the client and server use to
communicate with each other. The client obtains a Socket object by instantiating one,
whereas the server obtains a Socket object from the return value of the accept() method.

public Socket(String host, int port) throws UnknownHostException, IOException.


This method attempts to connect to the specified server at the specified port. If this
constructor does not throw an exception, the connection is successful and the client is
connected to the server.

public Socket(InetAddress host, int port) throws IOException


This method is identical to the previous constructor, except that the host is denoted by an
InetAddress object.

public void connect(SocketAddress host, int timeout) throws IOException


This method connects the socket to the specified host. This method is needed only
when you instantiated the Socket using the no-argument constructor.

public InetAddress getInetAddress()


This method returns the address of the other computer that this socket is connected to.

public int getPort()


Returns the port the socket is bound to on the remote machine.

public void close() throws IOException


Closes the socket, which makes this Socket object no longer capable of connecting again
to any server

Q. 1. Draw and explain tcp packet format.

Conclusion:
Hence, we have Successfully Wrote a program using TCP socket for wired network for
following a) Say Hello to Each other b)File transfer c)Calculator.
Assignment Number: 5

Title: Study of UDP socket programming for wired

network.
OBJECTIVES:

1. Getting familiar with the client-server communication model.


2. Learning the most important library functions (the UNIX and Internet sockets) used
for the design of the client-server applications.
3. Designing simple client or server applications for datagram.

PROBLEM STATEMENT

Write a program using UDP Sockets to enable file transfer (Script, Text, Audio and Video
one file each) between two machines. Demonstrate the packets captured traces using
Wireshark Packet Analyzer Tool for peer to peer mode. Prerequisite:
Basic concepts of addresses, socket primitives, IP structure
Coversion functions, Notations

Software Requirements: C/C++/Java/Python

Hardware Requirement:
PIV, 2GB RAM, 500 GB HDD, Lenovo A13-4089Model.
Outcomes:
After completion of this assignment students can perform socket programming and perform remote
communications between any two remote processes

Theory: -

Program A program is an executable file residing on a disk in a directory. A program is read into
memory and is executed by the kernel as ad result of an exec () function. The exec () has six
variants, but we only consider the simplest one (exec ()) in this course.

Process An executing instance of a program is called a process. Sometimes, task is used instead
of process with the same meaning. UNIX guarantees that every process has a unique identifier
called the process ID. The process ID is always a non-negative integer.
File descriptors File descriptors are normally small non-negative integers that the kernel uses to
identify the files being accessed by a particular process. Whenever it opens an existing file or
creates a new file, the kernel returns a file descriptor that is used to read or write the file. As we
will see in this course, sockets are based on a very similar mechanism (socket descriptors).
The client-server model

The client-server model is one of the most used communication paradigms in networked systems.
Clients normally communicate with one server at a time. From a server’s perspective, at any point
in time, it is not unusual for a server to be communicating with multiple clients. Client need to
know of the existence of and the address of the server, but the server does not need to know the
address of (or even the existence of) the client prior to the connection being established Client and
servers communicate by means of multiple layers of network protocols. In this course we will
focus on the TCP/IP protocol suite.

The scenario of the client and the server on the same local network (usually called LAN, Local
Area Network) is shown in Figure 1

Figure 1: Client and server on the same Ethernet communicating using TCP/IP.
The client and the server may be in different LANs, with both LANs connected to a Wide Area
Network (WAN) by means of routers. The largest WAN is the Internet, but companies may have
their own WANs. This scenario is depicted in Figure 2.

Figure 2: Client and server on different LANs connected through WAN/Internet.

The flow of information between the client and the server goes down the protocol stack on one
side, then across the network and then up the protocol stack on the other side.

User Datagram Protocol (UDP):-

UDP is a simple transport-layer protocol. The application writes a message to a UDP socket, which
is then encapsulated in a UDP datagram, which is further encapsulated in an IP datagram, which
is sent to the destination.

There is no guarantee that a UDP will reach the destination that the order of the datagrams will be
preserved across the network or that datagrams arrive only once.

The problem of UDP is its lack of reliability: if a datagram reaches its final destination but the
checksum detects an error, or if the datagram is dropped in the network, it is not automatically
retransmitted.

Each UDP datagram is characterized by a length. The length of a datagram is passed to the
receiving application along with the data.
No connection is established between the client and the server and, for this reason, we say that
UDP provides a connection-less service.
Socket addresses

IPv4 s o c k e t a d d r e s s s t r u c t u r e i s n a m e d sockaddr_in and i s defined b y i n c l u d i


n g the <netinet/in.h> header.

The POSIX definition is the following:

struct in_addr{
in_addr_t s_addr; /*32 bit IPv4 network byte ordered address*/
};

struct sockaddr_in {
uint8_t sin_len; /* length of structure (16)*/
sa_family_t sin_family; /* AF_INET*/
in_port_t sin_port; /* 16 bit TCP or UDP port number */
struct in_addr sin_addr; /* 32 bit IPv4 address*/
char sin_zero[8]; /* not used but always set to zero */
};

The uint8_t datatype is unsigned 8-bit integer.

Generic Socket Address Structure: -

A socket address structure is always passed by reference as an argument to any socket functions.
But any socket function that takes one of these pointers as an argument must deal with socket
address structures from any of the supported protocol families.

A problem arises in declaring the type of pointer that is passed. With ANSI C, the solution is to
use void * (the generic pointer type). But the socket functions predate the definition of ANSI C
and the solution chosen was to define a generic socket address as follows:

struct sockaddr {
uint8_t sa_len;
sa_family_t sa_family; /* address family: AD_xxx value */
char sa_data[14];
};

UDP Socket API: -

There are some fundamental differences between TCP and UDP sockets. UDP is a connection-
less, unreliable, datagram protocol (TCP is instead connection-oriented, reliable and stream
based). There are some instances when it makes to use UDP instead of TCP. Some popular
applications built around UDP are DNS, NFS, SNMP and for example, some Skype services and
streaming media.
Figure 3 shows the the interaction between a UDP client and server. First of all, the client does not
establish a connection with the server. Instead, the client just sends a datagram to the server using
the sendto function which requires the address of the destination as a parameter. Similarly, the
server does not accept a connection from a client. Instead, the server just calls the
recvfromfunction, which waits until data arrives from some client. recvfrom returns the IP address
of the client, along with the datagram, so the server can send a response to the client.

As shown in the Figure, the steps of establishing a UDP socket communication on the client side
are as follows:

• Create a socket using the socket() function;


• Send and receive data by means of the recvfrom() and sendto() functions.

The steps of establishing a UDP socket communication on the server side are as follows:

• Create a socket with the socket() function;


• Bind the socket to an address using the bind() function;
• Send and receive data by means of recvfrom() and sendto().

Figure 3: UDP client-server.


The socket () Function

The first step is to call the socket function, specifying the type of communication protocol (TCP
based on IPv4, TCP based on IPv6, UDP).

The function is defined as follows:

#include <sys/socket.h>

int socket (int family, int type, int protocol);

where family specifies the protocol family (AF_INET for the IPv4 protocols), type is a constant
described the type of socket (SOCK_STREAM for stream sockets and SOCK_DGRAM for
datagram sockets.

The function returns a non-negative integer number, similar to a file descriptor, that we define
socket descriptor or -1 on error.

The bind() Function

The bind() assigns a local protocol address to a socket. With the Internet protocols, the address is
the combination of an IPv4 or IPv6 address (32-bit or 128-bit) address along with a 16 bit TCP
port number.

The function is defined as follows:

#include <sys/socket.h>

int bind(int sockfd, const struct sockaddr *servaddr, socklen_t addrlen);

where sockfd is the socket descriptor, servaddr is a pointer to a protocol-specific address and
addrlen is the size of the address structure.

bind() returns 0 if it succeeds, -1 on error.

This use of the generic socket address sockaddr requires that any calls to these functions must cast
the pointer to the protocol-specific address structure. For example for and IPv4 socket structure:

struct sockaddr_in serv; /* IPv4 socket address structure */

bind(sockfd, (struct sockaddr*) &serv, sizeof(serv))


A process can bind a specific IP address to its socket: for a TCP client, this assigns the source IP
address that will be used for IP datagrams sent on the sockets. For a TCP server, this restricts the
socket to receive incoming client connections destined only to that IP address.
Normally, a TCP client does not bind an IP address to its socket. The kernel chooses the source IP
socket is connected, based on the outgoing interface that is used. If a TCP server does not bind an
IP address to its socket, the kernel uses the destination IP address of the incoming packets as the
server’s source address.

bind() allows to specify the IP address, the port, both or neither.

The table below summarizes the combinations for IPv4.


IP Address IP Port Result
INADDR_ANY 0 Kernel chooses IP address and port
INADDR_ANY non zero Kernel chooses IP address, process specifies port
Local IP address 0 Process specifies IP address, kernel chooses port
Local IP address non zero Process specifies IP address and port
Note, the local host address is 127.0.0.1; for example, if you wanted to run your echoServer (see
later) on your local machine the your client would connect to 127.0.0.1 with the suitable port.

The recvfrom() Function

This function is similar to the read() function, but three additional arguments are required. The
recvfrom() function is defined as follows:

#include <sys/socket.h>

ssize_t recvfrom(int sockfd, void* buff, size_t nbytes,


int flags, struct sockaddr* from,
socklen_t *addrlen);

The first three arguments sockfd, buff, and nbytes, are identical to the first three arguments of read
and write. sockfd is the socket descriptor, buff is the pointer to read into, and nbytes is number of
bytes to read. In our examples we will set all the values of the flags argument to 0. The recvfrom
function fills in the socket address structure pointed to by from with the protocol address of who
sent the datagram. The number of bytes stored in the socket address structure is returned in the
integer pointed by addrlen.

The function returns the number of bytes read if it succeeds, -1 on error.


The sendto() Function

This function is similar to the send() function, but three additional arguments are required.The sendto()
function is defined as follows:

#include <sys/socket.h>
ssize_t sendto(int sockfd, const void *buff, size_t nbytes,
int flags, const struct sockaddr *to,
socklen_t addrlen);

The first three arguments sockfd, buff, and nbytes, are identical to the first three arguments of recv. sockfd is
the socket descriptor, buff is the pointer to write from, and nbytes is number of bytes to write. In our examples
we will set all the values of the flags argument to 0. The to argument is a socket address structure containing
the protocol address (e.g., IP address and port number) of where the data is sent.
addlen specified the size of this socket.

The function returns the number of bytes written if it succeeds, -1 on error.

The close() Function

The normal close() function is used to close a socket and terminate a TCP socket. It returns 0 if itsucceeds, -
1 on error. It is defined as follows:

#include <unistd.h>

int
close(int sockfd);
1. What is Socket?
2. What are different types of Socket?
3. What are different Socket functions or calls used in UDP Client Server
communication?
4. Explain UCP protocol in details?

Conclusion:

Hence we studied and implement program to demonstrate Socket programming forwired network.
Assignment Number : 6
Title: Study of Go Back-N and Selective Repeat mode of Sliding window protocol.

OBJECTIVES:

1. To Understand Go back n and selective repeat mode of sliding window protocol.


2. Designing simple client or server applications for stream.

PROBLEM STATEMENT

Write a program to simulate Go back N and Selective Repeat Modes of Sliding Window Protocol in
peer to peer mode and demonstrate the packets captured traces using Wireshark Packet Analyzer Tool for
peer to peer mode.
Prerequisite:
Basic concepts of Go back N method and its working.
Basic concepts of Selective Repeat ARQ method and its working.

Software Requirements: C/C++/Java/Python

Hardware Requirement:
PIV, 2GB RAM, 500 GB HDD, Lenovo A13-4089Model.
Outcomes:
After completion of this assignment students can learn about working of Go back N and selective repeat

Theory: -
Data-link layer is responsible for implementation of point-to-point flow and error control mechanism.

FlowControl:-
When a data frame (Layer-2 data) is sent from one host to another over a single medium, it is required that
the sender and receiver should work at the same speed. That is, sender sends at a speed on which the
receiver can process and accept the data. What if the speed
(hardware/software) of the sender or receiver differs? If sender is sending too fast the receiver may be
overloaded, (swamped) and data may be lost.
Two types of mechanisms can be deployed to control the flow:
Stop and Wait

This flow control mechanism forces the sender after transmitting a data frame to stop and wait until
the acknowledgement of the data-frame sent is received.

Sliding Window

In this flow control mechanism, both sender and receiver agree on the number of data- frames after
which the acknowledgement should be sent. As we learnt, stop and wait flow control mechanism
wastes resources, this protocol tries to make use of underlying resources as much as possible.

ErrorControl:-
When data-frame is transmitted, there is a probability that data-frame may be lost in the transit or it
is received corrupted. In both cases, the receiver does not receive the correct data- frame and sender does
not know anything about any loss.In such case, both sender and receiver are equipped with some protocols
which helps them to detect transit errors such as loss of data- frame. Hence, either the sender retransmits
the data-frame or the receiver may request to resend the previous data-frame.

Requirements for error control mechanism:

• Error detection - The sender and receiver, either both or any, must ascertain that there is some error
in the transit.

• Positive ACK - When the receiver receives a correct frame, it should acknowledge it.

• Negative ACK - When the receiver receives a damaged frame or a duplicate frame, it sends a NACK
back to the sender and the sender must retransmit the correct frame.
• Retransmission: The sender maintains a clock and sets a timeout period. If an acknowledgement
of a data-frame previously transmitted does not arrive before the timeout the sender retransmits the
frame, thinking that the frame or it’s acknowledgement is lost in transit.

There are three types of techniques available which Data-link layer may deploy to control the errors by
Automatic Repeat Requests (ARQ):
Stop-and-wait ARQ

The following transition may occur in Stop-and-Wait ARQ:

o The sender maintains a timeout counter.


o When a frame is sent, the sender starts the timeout counter. o If acknowledgement of frame
comes in time, the sender transmits the next frame in queue. o If acknowledgement does not
come in time, the sender assumes that either the frame or its acknowledgement is lost in
transit. Sender retransmits the frame and starts the timeout counter.
o If a negative acknowledgement is received, the sender retransmits the frame.
Go-Back-N ARQ
Stop and wait ARQ mechanism does not utilize the resources at their best.When the
acknowledgement is received, the sender sits idle and does nothing. In Go-Back-N ARQ method,
both sender and receiver maintain a window.
The sending-window size enables the sender to send multiple frames without receiving the
acknowledgement of the previous ones. The receiving-window enables the receiver to receive
multiple frames and acknowledge them. The receiver keeps track of incoming frame’s sequence
number.

When the sender sends all the frames in window, it checks up to what sequence number it has
received positive acknowledgement. If all frames are positively acknowledged, the sender sends
next set of frames. If sender finds that it has received NACK or has not receive any ACK for a
particular frame, it retransmits all the frames after which it does not receive any positive ACK.

Selective Repeat ARQ


In Go-back-N ARQ, it is assumed that the receiver does not have any buffer space for its window
size and has to process each frame as it comes. This enforces the sender to retransmit all the frames
which are not acknowledged.

In Selective-Repeat ARQ, the receiver while keeping track of sequence numbers, buffersthe frames in
memory and sends NACK for only frame which is missing or damaged.

The sender in this case, sends only packet for which NACK is received.

1. What is Error and flow control?


2. Explain Stop and wait protocol?
3. Explain go back n and Selective repeat protocol in details?
4. Difference between Go-back n and Selective repeat.

Conclusion:

We studied and implemented program of Go-back n and Selective repeat modes of sliding window protocol.
Assignment Number: 7

Title: Study of IP addresses and Subnetting.


OBJECTIVES:

1) To understand the structure of IP addresses and subnet mask.


2) To understand the concept of Subnetting and create subnet of given IP address.

PROBLEM STATEMENT
Write a program to demonstrate subletting and find the subnet masks. Prerequisite:
Basic concepts of IP address and its classes
Sub netting method and super netting method.

Software Requirements: C/C++/Java/Python

Hardware Requirement:
PIV, 2GB RAM, 500 GB HDD, Lenovo A13-4089Model.
Outcomes:
After completion of this assignment students can learn about subnetting and it us in networking

Theory: - Introduction: -

If definitions are helpful to you, use these vocabulary terms in order to get you started:

● Address - The unique number ID assigned to one host or interface in a network.

● Subnet - A portion of a network that shares a particular subnet address.

● Subnet mask - A 32-bit combination used to describe which portion of an address refers to the subnet
and which part refers to the host.

● Interface - A network connection.

If you have already received your legitimate address (es) from the Internet Network Information

Center (InterNIC), you are ready to begin. If you do not plan to connect to the Internet, Cisco strongly
suggests that you use reserved addresses from RFC 1918
Understand IP Addresses
An IP address is an address used in order to uniquely identify a device on an IP network. The address
is made up of 32 binary bits, which can be divisible into a network portion and host portion with the
help of a subnet mask. The 32 binary bits are broken into four octets (1 octet = 8 bits).

Each octet is converted to decimal and separated by a period (dot). For this reason, an IP address is
said to be expressed in dotted decimal format (for example, 172.16.81.100). The value in each octet
ranges from 0 to 255 decimal, or 00000000 - 11111111 binary.

Here is how binary octets convert to decimal: The right most bit, or least significant bit, of an octet
holds a value of 20. The bit just to the left of that holds a value of 21. This continues until the left-
most bit, or most significant bit, which holds a value of 27. So if all binary bits are a one, the decimal
equivalent would be 255 as shown here:

1 111 1111
128 64 32 16 8 4 2 1 (128+64+32+16+8+4+2+1=255)

Here is a sample octet conversion when not all of the bits are set to 1.

01000001
0 64 0 0 0 0 0 1 (0+64+0+0+0+0+0+1=65)

And this sample shows an IP address represented in both binary and decimal.

10. 1. 23. 19 (decimal)


00001010.00000001.00010111.00010011 (binary)

These octets are broken down to provide an addressing scheme that can accommodate large and
small networks. There are five different classes of networks, A to E. This document focuses on
classes A to C, since classes D and E are reserved and discussion of them is beyond the scope of this
document.

Note: Also note that the terms "Class A, Class B" and so on are used in this document in order to
help facilitate the understanding of IP addressing and subnetting. These terms are rarely used in the
industry anymore because of the introduction of classless interdomain routing (CIDR).

Given an IP address, its class can be determined from the three high-order bits (the three left-most bits
in the first octet). Figure 1 shows the significance in the three high order bits and the range of addresses
that fall into each class. For informational purposes, Class D and Class E addresses are also shown.
Figure 1

In a Class A address, the first octet is the network portion, so the Class A example in Figure 1 has a
major network address of 1.0.0.0 - 127.255.255.255. Octets 2, 3, and 4 (the next 24 bi ts) are for the
network manager to divide into subnets and hosts as he/she sees fit. Class A addresses are used for
networks that have more than 65,536 hosts (actually, up to 16777214 hosts!).

In a Class B address, the first two octets are the network portion, so the Class B example in Figure 1
has a major network address of 128.0.0.0 - 191.255.255.255. Octets 3 and 4 (16 bits) are for local
subnets and hosts. Class B addresses are used for networks that have between 256 and 65534 hosts.

In a Class C address, the first three octets are the network portion. The Class C example in Figure
1 has a major network address of 192.0.0.0 - 223.255.255.255. Octet 4 (8 bits) is for local subnets
and hosts - perfect for networks with less than 254 hosts.

Network Masks:

A network mask helps you know which portion of the address identifies the network and which
portion of the address identifies the node. Class A, B, and C networks have default masks, also
known as natural masks, as shown here:

Class A:
255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0

An IP address on a Class A network that has not been subnetted would have an address/mask pair
similar to: 8.20.15.1 255.0.0.0. In order to see how the mask helps you identify the network and
node parts of the address, convert the address and mask to binary numbers.

8.20.15.1 = 00001000.00010100.00001111.00000001
255.0.0.0 = 11111111.00000000.00000000.00000000

Once you have the address and the mask represented in binary, then identification of the network and
host ID is easier. Any address bits which have corresponding mask bits set to 1 represent the network
ID. Any address bits that have corresponding mask bits set to 0 represent the node ID.

8.20.15.1= 00001000.00010100.00001111.00000001

255.0.0.0 = 11111111.00000000.00000000.00000000

net id host id
netid = 00001000 = 8
hostid = 00010100.00001111.00000001 = 20.15.1

Understand Subnetting:-

Subnetting allows you to create multiple logical networks that exist within a single Class A, B, or C
network. If you do not subnet, you are only able to use one network from your Class A, B, or C
network, which is unrealistic.

Each data link on a network must have a unique network ID, with every node on that link being a
member of the same network. If you break a major network (Class A, B, or C) into smaller
subnetworks, it allows you to create a network of interconnecting subnetworks. Each data link on this
network would then have a unique network/subnetwork ID. Any device, or gateway, that connects n
networks/subnetworks has n distinct IP addresses, one for each network / subnetwork that it
interconnects.

In order to subnet a network, extend the natural mask with some of the bits from the host ID portion of
the address in order to create a subnetwork ID. For example, given a Class C network of
which has a natural mask of 255.255.255.0, you can create subnets in this manner:

11001100.00010001.00000101.00000000
255.255.255.224 - 11111111.11111111.11111111.11100000
|sub|

By extending the mask to be 255.255.255.224, you have taken three bits (indicated by "sub") from the
original host portion of the address and used them to make subnets. With these three bits, it is possible
to create eight subnets. With the remaining five host ID bits, each subnet can have up to 32 host
addresses, 30 of which can actually be assigned to a device since host ids of all zeros or all ones are
not allowed (it is very important to remember this). So, with this in mind, these subnets have been
created.
attached. Each subnetwork could potentially support up to 30 host addresses.

This brings up an interesting point. The more host bits you use for a subnet mask, the more subnets
you have available. However, the more subnets available, the less host addresses available per subnet.
For example, a Class C network of 204.17.5.0 and a mask of 255.255.255.224 (/27) allows you to have
eight subnets, each with 32 host addresses (30 of which could be assigned to devices). If you use a
mask of 255.255.255.240 (/28), the break down is:

204.17.5.0 - 11001100.00010001.00000101.00000000
255.255.255.240 - 11111111.11111111.11111111.11110000
|sub |

Since you now have four bits to make subnets with, you only have four bits left for host addresses. So
in this case you can have up to 16 subnets, each of which can have up to 16 host addresses (14 of which
can be assigned to devices).

Take a look at how a Class B network might be subnetted. If you have network 172.16.0.0 ,then you
know that its natural mask is 255.255.0.0 or 172.16.0.0/16. Extending the mask to anything beyond
255.255.0.0 means you are subnetting. You can quickly see that you have the ability to create a lot
more subnets than with the Class C network. If you use a mask of 255.255.248.0 (/21), how many
subnets and hosts per subnet does this allow for?

172.16.0.0 - 10101100.00010000.00000000.00000000
255.255.248.0 - 11111111.11111111.11111000.00000000
| sub |
You use five bits from the original host bits for subnets. This allows you to have 32 subnets (25).
After using the five bits for subnetting, you are left with 11 bits for host addresses. This allows
each subnet so have 2048 host addresses (211), 2046 of which could be assigned to devices.

Note: In the past, there were limitations to the use of a subnet 0 (all subnet bits are set to zero) and all
ones subnet (all subnet bits set to one). Some devices would not allow the use of these subnets. Cisco
Systems devices allow the use of these subnets when the ip subnet zero command is configured.

Examples

Sample Exercise 1

Now that you have an understanding of subnetting, put this knowledge to use. In this example, you are
given two address / mask combinations, written with the prefix/length notation, which have been
assigned to two devices. Your task is to determine if these devices are on the same subnet or different
subnets. You can use the address and mask of each device in order to determine to which subnet each
address belongs.

Device A: 172.16.17.30/20
Device B: 172.16.28.15/20

Determine the Subnet for Device A:


172.16.17.30 - 10101100.00010000.00010001.00011110
255.255.240.0 - 11111111.11111111.11110000.00000000
| sub|
subnet = 10101100.00010000.00010000.00000000 = 172.16.16.0

Looking at the address bits that have a corresponding mask bit set to one, and setting all the other
address bits to zero (this is equivalent to performing a logical "AND" between the mask and address),
shows you to which subnet this address belongs. In this case, DeviceA belongs to subnet 172.16.16.0.

Determine the Subnet for Device B:

172.16.28.15 - 10101100.00010000.00011100.00001111
255.255.240.0 - 11111111.11111111.11110000.00000000
| sub|
subnet = 10101100.00010000.00010000.00000000 = 172.16.16.0

From these determinations, Device A and Device B have addresses that are part of the same subnet.

Sample Exercise 2

Given the Class C network of 204.15.5.0/24, subnet the network in order to create the network in Figure
3 with the host requirements shown.

Figure 3
The subnets that are being used, Net A, Net C, and Net D have a lot of unused host address space. It
is possible that this was a deliberate design accounting for future growth, but in many cases this is
just wasted address space due to the fact that the same subnet mask is used for all the subnets.

Variable Length Subnet Masks (VLSM) allows you to use different masks for each subnet, thereby
using address space efficiently.

VLSM Example

Given the same network and requirements as in Sample Exercise 2 develop a subnetting scheme with
the use of VLSM, given:

Net A: must support 14 hosts


net B: must support 28 hosts
net C: must support 2 hosts
net D: must support 7 hosts
net E: must support 28 host
Determine what mask allows the required number of hosts.

netA: requires a /28 (255.255.255.240) mask to support 14 hosts netB:


requires a /27 (255.255.255.224) mask to support 28 hosts netC:
requires a /30 (255.255.255.252) mask to support 2 hosts netD*:
requires a /28 (255.255.255.240) mask to support 7 hosts netE:
requires a /27 (255.255.255.224) mask to support 28 hosts

* a /29 (255.255.255.248) would only allow 6 usable host addresses


therefore netD requires a /28 mask.

The easiest way to assign the subnets is to assign the largest first. For example, you can assign
in this manner:

netB: 204.15.5.0/27 host address range 1 to 30


netE: 204.15.5.32/27 host address range 33 to
62 netA: 204.15.5.64/28 host address range 65
to 78 netD: 204.15.5.80/28 host address range
81 to 94 netC: 204.15.5.96/30 host address
range 97 to 98

This can be graphically represented as shown in

Figure 5: Figure 5
CIDR:

Classless Interdomain Routing (CIDR) was introduced in order to improve both address space
utilization and routing scalability in the Internet. It was needed because of the rapid growth of the
Internet and growth of the IP routing tables held in the Internet routers.

CIDR moves way from the traditional IP classes (Class A, Class B, Class C, and so on). In CIDR , an
IP network is represented by a prefix, which is an IP address and some indication of the length of the
mask. Length means the number of left-most contiguous mask bits that are set to one. So network
172.16.0.0 255.255.0.0 can be represented as 172.16.0.0/16. CIDR also depicts a more hierarchical
Internet architecture, where each domain takes its IP addresses from a higher level. This allows for
the summarization of the domains to be done at the higher level. For example, if an ISP owns network
172.16.0.0/16, then the ISP can offer 172.16.1.0/24, 172.16.2.0/24, and so on to customers. Yet, when
advertising to other providers, the ISP only needs to advertise 172.16.0.0/16.

For more information on CIDR, see RFC 1518 and RFC 1519 .

Please refer the above theory for answers:

1. What is Subnet mask?


2. Explain concept of subnetting?
3. What is CIDI notation?
4. What is netid and host id in networking

Conclusion:
Hence we studied and implement program to demonstrate subletting and find the subnetmasks.
Assignment Number : 8

Title: Study of CRC and Hamming Code


OBJECTIVES:

To understand the structure and working of CRC and Hamming Code

PROBLEM STATEMENT

Write a program for error detection and correction for 7/8 bits ASCII codes using Hamming Codes
or CRC.

Prerequisite:
Basic concepts of CRC working.
Software Requirements: C/C++/Java/Python

Hardware Requirement:
PIV, 2GB RAM, 500 GB HDD, Lenovo A13-4089Model.
Outcomes:
After completion of this assignment students can learn about CRC error detection

Theory: -

1. Introduction
All communication systems try to make sure that the transmitted messages reach the destination
without any problem. So they intend to implement different algorithms in order to satisfy this
requirement. One of the options is to encode the message in a way that enables the receiver to
check the corrupted messages; example of such coding is the CRC.
Data storage devices must also prevent any corruption of its data. The best choice for this problem
is to use data redundancy, which costs a lot. So instead of that, data can be encoded using redundant
codes in order to detect the corrupted data and the CRC is the one of the most common codes that
is used in such cases.

2. What is CRC
CRC stands for Cyclic Redundancy Check. Which means that is based on cyclic algorithm that
generates redundant information.
So the resultant number uniquely identifies that block of data. This unique number can be used to
check the validity of data or to compare two blocks. So this approach is used in many
communication and computer systems to ensure the validity of the transmitted or stored data.

In general CRC codes are able to detect:


• All single- and double-bit errors.
• All odd numbers of errors.
• All burst errors less than or equal to the degree of the polynomial used.
• Most burst errors greater than the degree of the polynomial used.

3. Check sum concept


One approach in of error checking is to append the sum value of all message bytes to the end of
the message. This sum can identify the message and changes in its contents. On the other hand, if
there is more than one change one that adds up a value and one subtracts one in a way that the
sum remains the same, so it cannot be used to detect errors. The same can happen if the check sum
is changed with the same value as the message.

4. CRC idea
The main idea of CRC is to treat the message as binary numbers, and divide it by fixed binary
number. The remainder from this division is considered the checksum. The recipient of the
message performs the same division and compare the remainder with the "checksum" (transmitted
remainder).

5. Theory of operation:
As stated in the previous section, the CRC is a simple binary division and subtraction. The only
difference is that these operations are done on modulo arithmetic based on mod 2. For example
the addition and subtraction are replaced with XOR operation that do the sum and subtraction
without carry.

Polynomial concept
The CRC algorithm uses the term polynomial to perform all of its calculations. This polynomial
is the same concept as the traditional arithmetic polynomials. The divisor, dividend, quotient, and
remainder that are represented by numbers are represented as polynomials with binary
coefficients.
For example the number 23 (10111b) can be represented in the polynomial form as:

1*x4 + 0*x3 + 1*x2 + 1*x1 + 1*x0


or
x4 + x2 + x1 + x0

Note the binary representation of the number (10111).


This representation simplifies the traditional arithmetic operations (addition, multiplication, etc…)
that are all done on normal algebraic polynomials.

If we can assume that X is 2, then the operations are simplified more and some because some
terms can be canceled. For example the term 3*x3 is represented as 24 in normal number
representation and 24 = 16+8 which is x4+x3 in polynomial representation.

Generator polynomial:
In order to do the CRC calculation; a divisor must be selected which can be any one. This divisor is
called the generator polynomial. Even though, some polynomials became standard for many
applications. Polynomial selection is behind the scope of this summary.
One of the most used terms in CRC is the width of the polynomial. This width is represented by the
order of the highest power in the polynomial. The width of the polynomial in the previous example is
4, which has 5 bits in its binary representation.
Since CRC is used to detect errors, a suitable generator polynomial must be selected for each
application. This is because each polynomial has different error detection capabilities. CRC algorithms
are commonly called after the generator polynomial width, for example CRC-16 uses a generator
polynomial of width 15 and 16-bit register and CRC-32 uses polynomial width of 31 and 32-bit register.

Common used polynomials:

No. of bits Polynomial Name


16 bits: (16,12,5,0) X25 standard
(16,15,2,0) CRC-16/ CCITT
32 bits: (32,26,23,22,16,12,11,10,8,7,5,4,2,1,0) Ethernet, ATM, CRC-32
To Summarize:
The data D is multiplied by Xn and divided by the generator polynomial G, the quotient Q is discarded
and the Remainder R is considered the check sum. On the other side, the data stream D is multiplied
again by Xn and the check sum (CRC) R is added to it (normally it come with the stream) and the
whole result is divided by G again. The result now should be zero for valid data. This operation can
be described by the following equation:

(Xn*D)+R = (Q*G)+0

6. How Do CRC works


Transmitter calculation
The transmitter can append zeros to the end of the message (LSB), perform the division and find the
remainder and appended it to the original message.

Receiver calculation
The message receiver can do one of the followings:
Separate the message and checksum. Calculate the checksum for the message (after appending
zeros) and compare the two checksums.
Checksum the whole message including the CRC (without appending zeros) and check if the new
CRC comes out as Zero.

7. Implementation:
CRC has two main implementation techniques:
• Straightforward
• Look-up table based

Straightforward:
This approach is a direct mapping for the CRC algorithm.
In fact this approach does not use standard microprocessor divide instruction because 1. We need
xor based division (no carry in addition or subtraction) 2. The dividend (the message) can be very
large and behind the processor support.
This approach is relatively low speed and consumes very small resources
This implementation is described in PAINLESS GUIDE TO CRC as:

To perform the division, do the following:

Load the register with zero bits.


Augment the message by appending W zero bits to the end of it.
While (more message bits)
Begin
Shift the register left by one bit, reading the next bit of the augmented
message into register bit position 0.
If (a 1 bit popped out of the register during step
3) Register = Register XOR Poly. End
The register now contains the remainder.

Note: The register holds the remainder only after the last bit of the message gets out of it.

This algorithm is done by the long division


Dout Register Comment
Bit
0 0 0 Pass Register
0 1 1 bit
1 0 1 Xor with Poly
1 1 0
This approach can be implemented directly using Linear-feedback shift registers (LFSR) where the
division is performed by left shifting and subtraction by XOR.

Parallel Implementation:
In real world the serial approach (bit-by-bit) calculation is not acceptable for many applications that
requires high performance or the smallest processing word size is more than a bit For that reason
parallel implementation is needed.

Look-up table based:


This approach is based on pre-calculating the CRC for all input combinations.

This approach is best described in “A PAINLESS GUIDE TO CRC ERROR DETECTION


ALGORITHMS”

1. What is CRC code?


2. What is the difference between CRC and Hamming Code?
3. How do CRC works?
4. Polynomial concept

Conclusion:

Hence we studied and implement program for error detection and correction for 7/8 bits ASCII codes
using CRC.
Assignment No: 9
Problem Statement: Write a program to implement link state /Distance vector
routing protocol to find suitable path for transmission.
Objectives: To develop an understanding of various protocols, modern technologies and
applications
Outcome: Demonstrate the subnet formation with IP allocation mechanism and apply various
routing algorithms

Software & Hardware Requirments:


Operating System: Ubuntu
Programming Language: java
Editor: Eclipse
Theory:
1. Distance Vector Routing Algorithm
The Distance vector algorithm is iterative, asynchronous and distributed. o Distributed:
It is distributed in that each node receives information from one or more of its
directly attached neighbors, performs calculation and then distributes the result
back to its neighbors. o Iterative: It is iterative in that its process continues until
no more information is available to be exchanged between neighbors.
o Asynchronous: It does not require that all of its nodes operate in the lock step
with each other.
The Distance vector algorithm is a dynamic algorithm.
It is mainly used in ARPANET, and RIP.
Each router maintains a distance table known as Vector.
Three Keys to understand the working of Distance Vector Routing Algorithm:
Knowledge about the whole network: Each router shares its knowledge through the
entire network. The Router sends its collected knowledge about the network to its
neighbors.
Routing only to neighbors: The router sends its knowledge about the network to only
those routers which have direct links. The router sends whatever it has about the network
through the ports. The information is received by the router and uses the information to
update its own routing table.
Information sharing at regular intervals: Within 30 seconds, the router sends the
information to the neighboring routers.

Step-01: Each router prepares its routing table. By their local knowledge. each router knows
about-
• All the routers present in the network
• Distance to its neighboring routers Step-02:
• Each router exchanges its distance vector with its neighboring routers.
• Each router prepares a new routing table using the distance vectors it has obtained from
its neighbors.
• This step is repeated for (n-2) times if there are n routers in the network.
• After this, routing tables converge / become stable.

1.1 Distance Vector Routing Example-


Consider-
• There is a network consisting of 4 routers.
• The weights are mentioned on the edges.
• Weights could be distances or costs or delays.

Step-01:
Each router prepares its routing table using its local knowledge.
Routing table prepared by each router is shown below- At
Router A-

Destination Distance Next

A 0 A

B 2 B

C ∞ –

D 1 D

At Router B-
At Router C-
Destination Distance Next Hop

A ∞ –

B 3 B

C 0 C

D 11 D
At Router D-
Destination Distance Next Hop

A 1 A

B 7 B

C 11 C

D 0 D
Step-02:
Each router exchanges its distance vector obtained in Step-01 with its neighbors.
After exchanging the distance vectors, each router prepares a new routing table.
This is shown below-
At Router A-
• Router A receives distance vectors from its neighbors B and D.
• Router A prepares a new routing table as-

• Cost of reaching destination B from router A = min { 2+0 , 1+7 } = 2 via B.


• Cost of reaching destination C from router A = min { 2+3 , 1+11 } = 5 via B.
• Cost of reaching destination D from router A = min { 2+7 , 1+0 } = 1 via D.
Explanation For Destination B
Router A can reach the destination router B via its neighbor B or neighbor D.
• It chooses the path which gives the minimum cost.
• Cost of reaching router B from router A via neighbor B = Cost (A→B) + Cost
(B→B)= 2 + 0 = 2
• Cost of reaching router B from router A via neighbor D = Cost (A→D) + Cost
(D→B) = 1 + 7 = 8
• Since the cost is minimum via neighbor B, so router A chooses the path via B.
• It creates an entry (2, B) for destination B in its new routing table.
• Similarly, we calculate the shortest path distance to each destination router at every
router.

Thus, the new routing table at router A is-

Destination Distance Next Hop

A 0 A

B 2 B

C 5 B

D 1 D
At Router B-
• Router B receives distance vectors from its neighbors A, C and D.
• Router B prepares a new routing table as-

• Cost of reaching destination A from router B = min { 2+0 , 3+∞ , 7+1 } = 2 via A.
• Cost of reaching destination C from router B = min { 2+∞ , 3+0 , 7+11 } = 3 via C.
• Cost of reaching destination D from router B = min { 2+1 , 3+11 , 7+0 } = 3 via A.
Thus, the new routing table at router B is-

Destination Distance Next Hop

A 2 A

B 0 B

C 3 C

D 3 A

At Router C-
• Router C receives distance vectors from its neighbors B and D.
• Router C prepares a new routing table as-

• Cost of reaching destination A from router C = min { 3+2 , 11+1 } = 5 via B.


• Cost of reaching destination B from router C = min { 3+0 , 11+7 } = 3 via B.
• Cost of reaching destination D from router C = min { 3+7 , 11+0 } = 10 via B.
Thus, the new routing table at router C is-

Destination Distance Next Hop

A 5 B

B 3 B

C 0 C

D 10 B

At Router D-
• Router D receives distance vectors from its neighbors A, B and C.
• Router D prepares a new routing table as-
• Cost of reaching destination A from router D = min { 1+0 , 7+2 , 11+∞ } = 1 via A.
• Cost of reaching destination B from router D = min { 1+2 , 7+0 , 11+3 } = 3 via A.
• Cost of reaching destination C from router D = min { 1+∞ , 7+3 , 11+0 } = 10 via

B. Thus, the new routing table at router D is-

Destination Distance Next Hop

A 1 A

B 3 A

C 10 B

D 0 D

Step-03:
• Each router exchanges its distance vector obtained in Step-02 with its neighboring
routers.
• After exchanging the distance vectors, each router prepares a new routing table. This
is shown below-
At Router A-
• Router A receives distance vectors from its neighbors B and D.
• Router A prepares a new routing table as-
• Cost of reaching destination B from router A = min { 2+0 , 1+3 } = 2 via B.
• Cost of reaching destination C from router A = min { 2+3 , 1+10 } = 5 via B.
• Cost of reaching destination D from router A = min { 2+3 , 1+0 } = 1 via D.
Thus, the new routing table at router A is-

Destination Distance Next Hop

A 0 A

B 2 B

C 5 B

D 1 D

At Router B-
• Router B receives distance vectors from its neighbors A, C and D.
• Router B prepares a new routing table as-

• Cost of reaching destination A from router B = min { 2+0 , 3+5 , 3+1 } = 2 via A.
• Cost of reaching destination C from router B = min { 2+5 , 3+0 , 3+10 } = 3 via C.
• Cost of reaching destination D from router B = min { 2+1 , 3+10 , 3+0 } = 3 via A.
Thus, the new routing table at router B is-

Destination Distance Next Hop

A 2 A

B 0 B

C 3 C

D 3 A

At Router C-
• Router C receives distance vectors from its neighbors B and D.
• Router C prepares a new routing table as-

• Cost of reaching destination A from router C = min { 3+2 , 10+1 } = 5 via B.


• Cost of reaching destination B from router C = min { 3+0 , 10+3 } = 3 via B.
• Cost of reaching destination D from router C = min { 3+3 , 10+0 } = 6 via B.
Thus, the new routing table at router C is-

Destination Distance Next Hop

A 5 B

B 3 B

C 0 C

D 6 B
At Router D-
• Router D receives distance vectors from its neighbors A, B and C. Router D
prepares a new routing table as-

• Cost of reaching destination A from router D = min { 1+0 , 3+2 , 10+5 } = 1 via A.
• Cost of reaching destination B from router D = min { 1+2 , 3+0 , 10+3 } = 3 via A.
• Cost of reaching destination C from router D = min { 1+5 , 3+3 , 10+0 } = 6 via A.
Thus, the new routing table at router D is-

Destination Distance Next Hop

A 1 A

B 3 A

C 6 A

D 0 D

These will be the final routing tables at each router.


In Distance Vector Routing,
• Only distance vectors are exchanged.
• “Next hop”values are not exchanged.
• This is because it results in exchanging the large amount of data which consumes more
bandwidth.
While preparing a new routing table-
• A router takes into consideration only the distance vectors it has obtained from its
neighboring routers.
• It does not take into consideration its old routing table.
The algorithm is called so because-
• It involves exchanging of distance vectors between the routers. Distance vector
is nothing but an array of distances.
• The algorithm keeps on repeating periodically and never stops.
• This is to update the shortest path in case any link goes down or topology changes.
• Routing tables are prepared total (n-1) times if there are n routers in the given network.
• This is because shortest path between any 2 nodes contains at most n-1 edges if there
are n nodes in the graph.

• Distance Vector Routing suffers from count to infinity problem.


• Distance Vector Routing uses UDP at transport layer.

2. Link State Routing


Link state routing is a technique in which each router shares the knowledge of its neighborhood
with every other router in the internetwork.
• It is a dynamic routing algorithm in which each router shares knowledge of its
neighbors with every other router in the network.
• A router sends its information about its neighbors only to all the routers through
flooding.
• Information sharing takes place only whenever there is a change.
• It makes use of Dijkastra’s Algorithm for making routing tables.
• Problems – Heavy traffic due to flooding of packets. – Flooding can result in
infinite looping which can be solved by using Time to live (TTL) field.

Initially, we have this list of distances (please see the list below):
• The distance from the source node to itself is 0. For this example, the source node will
be node 0 but it can be any node that you choose.
• The distance from the source node to all other nodes has not been determined yet, so
we use the infinity symbol to represent this initially. Unvisited Node:{0,1,2,3,4,5,6}
0 1 2 3 4 5 6
0 ∞ ∞ ∞ ∞ ∞ ∞

Since we are choosing to start at node 0, we can mark this node as visited. Equivalently, we
cross it off from the list of unvisited nodes and add a red border to the corresponding node in
diagram:
Now we need to start checking the distance from node 0 to its adjacent nodes. As you can see,
these are nodes 1 and 2 (see the red edges):
Unvisited Node:{1,2,3,4,5,6}
0 1 2 3 4 5 6
0 2 6 ∞ ∞ ∞ ∞

Unvisited Node:{2,3,4,5,6}
0 1 2 3 4 5 6
0 2 6 7 ∞ ∞ ∞

For node 3: the total distance is 7 because we add the weights of the edges that form the path
0 -> 1 -> 3 (2 for the edge 0 -> 1 and 5 for the edge 1 -> 3).
From the list of distances, we can immediately detect that this is node 2 with distance 6:

Unvisited Node:{3,4,5,6}

0 1 2 3 4 5 6
0 2 6 7 ∞ ∞ ∞

Node 3 already has a distance in the list that was recorded previously (7, see the list below).
This distance was the result of a previous step, where we added the weights 5 and 2 of the two
edges that we needed to cross to follow the path 0 -> 1 -> 3.
But now we have another alternative. If we choose to follow the path 0 -> 2 -> 3, we would
need to follow two edges 0 -> 2 and 2 -> 3 with weights 6 and 8, respectively, which represents
a total distance of 14.
Clearly, the first (existing) distance is shorter (7 vs. 14), so we will choose to keep the original
path 0 -> 1 -> 3. We only update the distance if the new path is shorter. Therefore, we add
this node to the path using the first alternative: 0 -> 1 -> 3.
We update the distances of these nodes to the source node, always trying to find a shorter path,
if possible:
For node 4: the distance is 17 from the path 0 -> 1 -> 3 -> 4.
For node 5: the distance is 22 from the path 0 -> 1 -> 3 -> 5.
Notice that we can only consider extending the shortest path (marked in red). We cannot
consider paths that will take us through edges that have not been added to the shortest path (for
example, we cannot form a path that goes through the edge 2 -> 3). Unvisited Node:{4,5,6}
0 1 2 3 4 5 6
0 2 6 7 17 22 ∞

We need to choose which unvisited node will be marked as visited now. In this case, it's node
4 because it has the shortest distance in the list of distances. We add it graphically in the
diagram:

For node 5:
• The first option is to follow the path 0 -> 1 -> 3 -> 5, which has a distance of 22 from
the source node (2 + 5 + 15). This distance was already recorded in the list of distances
in a previous step.
• The second option would be to follow the path 0 -> 1 -> 3 -> 4 -> 5, which has a
distance of 23 from the source node (2 + 5 + 10 + 6).
Clearly, the first path is shorter, so we choose it for node 5.
For node 6:
• The path available is 0 -> 1 -> 3 -> 4 -> 6, which has a distance of 19 from the source
node (2 + 5 + 10 + 2).

Unvisited Node:{5,6}
0 1 2 3 4 5 6
0 2 6 7 17 22 19
Only one node has not been visited yet, node 5. Let's see how we can include it in the path.
There are three different paths that we can take to reach node 5 from the nodes that have been
added to the path:
• Option 1: 0 -> 1 -> 3 -> 5 with a distance of 22 (2 + 5 + 15).
• Option 2: 0 -> 1 -> 3 -> 4 -> 5 with a distance of 23 (2 + 5 + 10 + 6).
• Option 3: 0 -> 1 -> 3 -> 4 -> 6 -> 5 with a distance of 25 (2 + 5 + 10 + 2 + 6). Unvisited
Node:{6}
0 1 2 3 4 5 6
0 2 6 7 17 22 19

We have the final result with the shortest path from node 0 to each node in the graph.

Conclusion:
Hence, we have successfully implement link state /Distance vector routing protocol to
find suitable path for transmission.
Assignment No: 10
Problem Statement: To study the IPsec (ESP and AH) protocol by capturing the packets
using Wireshark tool.
Objectives: To learn modern tools for network traffic analysis
Outcome: Use network security services and mechanisms Software
& Hardware Requirments:
Operating System: Ubuntu
Packet Analyzer Tool: Wireshark
Hardware: i3 Processor, 4GB RAM, 500GB HDD

Theory:
1. IPSec (IP Security) architecture uses two protocols to secure the traffic or data flow.
These protocols are ESP (Encapsulation Security Payload) and AH (Authentication
Header). IPSec Architecture include protocols, algorithms, DOI, and
Key Management. All these components are very important in order to provide the
three main services:
● Confidentiality
● Authentication
● Integirity

Fig. IP Security Architecture

1.1. Architecture:
Architecture or IP Security Architecture covers the general concepts, definitions,
protocols, algorithms and security requirements of IP Security technology.
1.2. ESP Protocol:
ESP(Encapsulation Security Payload) provide the confidentiality service. Encapsulation
Security Payload is implemented in either two ways:
● ESP with optional Authentication.
● ESP with Authentication.
Packet Format:

Fig. ESP Protocol Header


● Security Parameter Index(SPI):This parameter is used in Security Association.
It is used to give a unique number to the connection build between Client and
Server.
● Sequence Number:Unique Sequence number are allotted to every packet so that
at the receiver side packets can be arranged properly.
● Payload Data:Payload data means the actual data or the actual message. The
Payload data is in encrypted format to achieve confidentiality.
● Padding:Extra bits or space added to the original message in order to ensure
confidentiality. Padding length is the size of the added bits or space in the original
message.
● Next Header: Next header means the next payload or next actual data.
● Authentication Data: This field is optional in ESP protocol packet format.
1.3. Encryption algorithm:
Encryption algorithm is the document that describes various encryption algorithm used
for Encapsulation Security Payload.
1.4. AH Protocol:
AH (Authentication Header) Protocol provides both Authentication and Integrity service.
Authentication Header is implemented in one way only: Authentication along with
Integrity.
Fig. Authentication Header Format
● Next Header – Next Header is 8-bit field that identifies type of header present
after Authentication Header. In case of TCP, UDP or destination header or some
other extension header it will store correspondence IP protocol number . Like,
number 4 in this field will indicate IPv4, number 41 will indicate IPv6 and number
6 will indicate TCP.
● Payload Length – Payload length is length of Authentication header and here we
use scaling factor of 4. Whatever be size of header, divide it by 4 and then subtract
by 2. We are subtracting by 2 because we’re not counting first 8 bytes of
Authentication header, which is first two row of picture given above. It means we
are not including Next Header, Payload length, Reserved and Security Parameter
index in calculating payload length. Like, say if payload length is given to be X.
Then (X+2)*4 will be original Authentication header length.

● Reserved-This is 16-bit field which is set to “zero” by sender as this field is


reserved for future use.
● Security Parameter Index (SPI) –It is arbitrary 32-bit field. It is very important
field which identifies all packets which belongs to present connection. If we’re
sending data from Source A to Destination B. Both A and B will already know
algorithm and key they are going to use. So for Authentication, hashing function
and key will be required which only source and destination will know about.
Secret key between A and B is exchanged by method of Diffie Hellman algorithm.
So Hashing algorithm and secret key for Security parameter index of connection
will be fixed. Before data transfer starts security association needs to be
established.
Conclusion:
Hence, we have successfully studied the IPsec (ESP and AH) protocol by capturing the
packets using Wireshark tool.
Wireshark Analysis
Assignment No:11
Problem Statement: Demonstrate the different types of topologies and types of
transmission media by using a packet tracer tool.
Objectives: To learn computer network topologies and types of network, network
hardware and software components.
Outcome: Students will be able To Analyze the requirements of network types, topology
and transmission media
Software & Hardware Requirments:
Operating System: Ubuntu
Tool: Packet Tracer
Hardware: i3 Processor, 4GB RAM, 500GB HDD

Theory:
1. Transmission Media:
On any network, the various entities must communicate through some form of media. Just
as humans can communicate through telephone wires or sound waves in the air,
computers can communicate through cables, light, and radio waves. Transmission media
enable computers to send and receive messages but do not guarantee that the messages
will be understood.
Most common network transmission media are coaxial cable, shielded twisted-pair
cable, and unshielded twisted-pair cable, fiber-optic cable and wireless
communications.
Select the appropriate media for various situations. Media choices include the following:
● Twisted-pair cable
● Coaxial cable
● Fiber-optic cable
Wireless communications Situational elements include the following:
● Cost
● Distance limitations
● Number of nodes
2. Types of transmission media
In data communication terminology, a transmission medium is a physical path
between the transmitter and the receiver i.e it is the channel through which data is
sent from one place to another. Transmission Media is broadly classified into the
following types.

Fig. Types of transmission media


2.1 Twisted pair
Twisted pair is a physical media made up of a pair of cables twisted with each other. A
twisted pair cable is cheap as compared to other transmission media. Installation of the
twisted pair cable is easy, and it is a lightweight cable. The frequency range for twisted
pair cable is from 0 to 3.5 KHz.
A twisted pair consists of two insulated copper wires arranged in a regular spiral pattern.
The degree of reduction in noise interference is determined by the number of turns per
foot. Increasing the number of turns per foot decreases noise interference.

Fig. Twisted pair


2.2 Coaxial cable
Coaxial cable gets its name because it contains two conductors that are parallel to each
other. The center conductor in the cable is usually copper. The copper can be either a solid
wire or stranded martial.
Outside this central Conductor is a non-conductive material. It is usually white, plastic
material used to separate the inner Conductor form the outer Conductor. The other
Conductor is a fine mesh made from Copper. It is used to help shield the cable form EMI.
Fig. Coaxial cable

2.3 Twisted Pair Cable


The most popular network cabling is twisted pair. It is light weight, easy to install,
inexpensive and support many different types of network. Twisted pair cabling is made
of pairs of solid or stranded copper twisted along each other. The twists are done to
reduce vulnerably to EMI and cross talk. The number of pairs in the cable depends on the
type. There are two types of twisted pair cables

2.4 Fiber Optic Cable


These are similar to coaxial cable. It uses electric signals to transmit data. At the
Centre is the glass core through which light propagates. In multimode fibers, the core is
50microns, and In single mode fibres, the thickness is 8 to 10 microns. The core in fiber optic cable
is surrounded by glass cladding with lower index of refraction as compared to core to keep all the
light in core. This is covered with a thin plastic jacket to protect the cladding. The fibers are
grouped together in bundles protected by an outer shield

Fig. Fiber Optic Cable


3. Network Topology
Computers in a network have to be connected in some logical manner. The layout
pattern of the interconnections between computers in a network is called network
topology.
3.1 Bus topology
Bus topology uses one main cable to which all nodes are directly connected. The main
cable acts as a backbone for the network. One of the computers in the network typically
acts as the computer server. The first advantage of bus topology is that it is easy to connect
a computer or peripheral device. The second advantage is that the cable requirements are
relatively small, resulting in lower cost. One of the disadvantages is that if the main cable
breaks, the entire network goes down. This type of network is also difficult to
troubleshoot. For these reasons, this type of topology is not used for large networks.

Fig. Bus topology

3.2 Star topology


In star topology, each computer is connected to a central hub using a point-to-point
connection. The central hub can be a computer server that manages the network, or it
can be a much simpler device that only makes the connections between computers over
the network possible. Star topology is very popular because the startup costs are low. It
is also easy to add new nodes to the network. The network is robust in the sense that if
one connection between a computer and the hub fails, the other connections remain
intact. If the central hub fails, however, the entire network will fail.
Fig. Star topology
3.3 Ring topology
In ring topology, the computers in the network are connected in a circular fashion, and the
data travels in one direction. Each computer is directly connected to the next computer,
forming a single pathway for signals through the network. This type of network is easy to
install and manage. If there is a problem in the network, it is easy to pinpoint which connection
is defective. It is also good for handling high-volume traffic over long distances since every
computer can act as a booster of the signal. On the downside, adding computers to this type
of network is more cumbersome, and if one single computer fails, the entire network goes
down.

Fig. Ring topology:


3.4 Mesh topology
In mesh topology, every node has a direct point-to-point connection to every other node.
Because all connections are direct, the network can handle very high-volume traffic. It is
also robust because if one connection fails, the others remain intact. Security is also high
since data travels along a dedicated connection.
Mesh topology can be formed by using the formula:
Number of cables = (n*(n-1))/2; Where n is the number of nodes that represents the
network
Fig. Mesh topology
3.5 Hybrid Topology
The combination of various different topologies is known as Hybrid topology. A Hybrid
topology is a connection between different links and nodes to transfer the data. When two
or more different topologies are combined together is termed as Hybrid topology and if
similar topologies are connected with each other will not result in Hybrid topology. For
example, if there exist a ring topology in one branch of ICICI bank and bus topology in
another branch of ICICI bank, connecting these two topologies will result in Hybrid
topology.

Fig. Hybrid Topology

4. Packet Tracer
Packet Tracer is a cross-platform visual simulation tool designed by Cisco Systems that
allows users to create network topologies and imitate modern computer networks. The
software allows users to simulate the configuration of Cisco routers and switches using a
simulated command line interface. Packet Tracer makes use of a drag and drop user
interface, allowing users to add and remove simulated network devices as they see fit. The
software is mainly focused towards Certified Cisco Network Associate Academy students
as an educational tool for helping them learn fundamental CCNA concepts. Previously
students enrolled in a CCNA Academy program could freely download and use the tool
free of charge for educational use.
Packet Tracer allows students to design complex and large networks, which is often not
feasible with physical hardware, due to costs. Packet Tracer is commonly used by CCNA
Academy students, since it is available to them for free. However, due to functional
limitations, it is intended by CISCO to be used only as a learning aid, not a replacement for
Cisco routers and switches.
4.1 How to install Packet Tracer latest version 7.1.1 on Ubuntu 16.04.4++
1. Create a Cisco NetCad account at Cisco Network Academy
2. Login to registered netcad account.
3. Navigate to resources and download latest version of Cisco Packet Tracer for Linux.
4. Install/ de-package Packet Tracer using following command
$ sudo dpkg –i < Packet Tracer File Name >.deb
5. if dependency missing error encounter you can fix that using following command $
sudo apt install –f
6. Then again try to Install/ de-package Packet Tracer using following command
$ sudo dpkg –i < Packet Tracer File Name >.deb
7. Accept License Agreement and proceed.
8. once installation complete you can open Packet Tracer using following command
$ sudo packettracer
9. Done

Conclusion:
Hence, we have Successfully Demonstrate the different types of topologies and types of
transmission media by using a packet tracer tool.
Output:
1. Bus Topology

2. Ring Topology
3. Star Topology

4. Hybrid Topology
Assignment No: 12
Problem Statement: Setup a WAN which contains wired as well as wireless LAN by
using a packet tracer tool. Demonstrate transfer of a packet from LAN 1 (wired LAN) to
LAN2 (Wireless LAN).
Objectives: To learn computer network topologies and types of network, network
hardware and software components.
Outcome: Students will be able to Analyze the requirements of network types, topology
and transmission media
Software & Hardware Requirments:
Operating System: Ubuntu
Tool: Packet Tracer
Hardware: i3 Processor, 4GB RAM, 500GB HDD

Theory:
1. Local Area Network

A Local Area Network (LAN) is a group of computer and peripheral devices which are
connected in a limited area such as school, laboratory, home, and office building. It is a
widely useful network for sharing resources like files, printers, games, and other
application. The simplest type of LAN network is to connect computers and a printer in
someone's home or office. In general, LAN will be used as one type of transmission
medium.
It is a network which consists of less than 5000 interconnected devices across several
buildings.
1.1 Characteristics of LAN
Here are important characteristics of a LAN network:
• It is a private network, so an outside regulatory body never controls it.
• LAN operates at a relatively higher speed compared to other WAN systems.
• There are various kinds of media access control methods like token ring and Ethernet.
1.2 Advantages of LAN
• Computer resources like hard-disks, DVD-ROM, and printers can share local area
networks. This significantly reduces the cost of hardware purchases.
• You can use the same software over the network instead of purchasing the licensed
software for each client in the network.
• Data of all network users can be stored on a single hard disk of the server computer.
• You can easily transfer data and messages over networked computers.
• It will be easy to manage data at only one place, which makes data more secure.
• Local Area Network offers the facility to share a single internet connection among all the
LAN users.
1.3 Disadvantages of LAN
• LAN will indeed save cost because of shared computer resources, but the initial cost of
installing Local Area Networks is quite high.
• The LAN admin can check personal data files of every LAN user, so it does not offer good
privacy.
• Unauthorized users can access critical data of an organization in case LAN admin is not
able to secure centralized data repository.
• Local Area Network requires a constant LAN administration as there are issues related
to software setup and hardware failures

2. Wireless Networks

Computer networks that are not connected by cables are called wireless networks. They
generally use radio waves for communication between the network nodes. They allow
devices to be connected to the network while roaming around within the network
coverage.
2.1 Types of Wireless Networks
• Wireless LANs − Connects two or more network devices using wireless distribution
techniques.
• Wireless MANs − Connects two or more wireless LANs spreading over a metropolitan
area.
• Wireless WANs − Connects large areas comprising LANs, MANs and personal networks.
2.2 Advantages of Wireless Networks
• It provides clutter-free desks due to the absence of wires and cables.
• It increases the mobility of network devices connected to the system since the devices
need not be connected to each other.
• Accessing network devices from any location within the network coverage or Wi-Fi
hotspot becomes convenient since laying out cables is not needed.
• Installation and setup of wireless networks are easier.
• New devices can be easily connected to the existing setup since they needn’t be wired to
the present equipment. Also, the number of equipment that can be added or removed to
the system can vary considerably since they are not limited by the cable capacity. This
makes wireless networks very scalable.
• Wireless networks require very limited or no wires. Thus, it reduces the equipment and
setup costs.
2.3 Examples of wireless networks
• Mobile phone networks
• Wireless sensor networks
• Satellite communication networks
• Terrestrial microwave networks

3. Wireless LAN
Wireless LAN stands for Wireless Local Area Network. It is also called LAWN (Local Area
Wireless Network). WLAN is one in which a mobile user can connect to a Local Area Network
(LAN) through a wireless connection.

The IEEE 802.11 group of standards defines the technologies for wireless LANs. For path
sharing, 802.11 standard uses the Ethernet protocol and CSMA/CA (carrier sense
multiple access with collision avoidance). It also uses an encryption method i.e. wired
equivalent privacy algorithm.
Wireless LANs provide high speed data communication in small areas such as building or
an office. WLANs allow users to move around in a confined area while they are still
connected to the network.
In some instance wireless LAN technology is used to save costs and avoid laying cable,
while in other cases, it is the only option for providing high-speed internet access to the
public. Whatever the reason, wireless solutions are popping up everywhere.
3.1 Advantages of WLANs
• Flexibility: Within radio coverage, nodes can communicate without further
restriction. Radio waves can penetrate walls, senders and receivers can be placed
anywhere (also non-visible, e.g., within devices, in walls etc.).
• Planning: Only wireless ad-hoc networks allow for communication without previous
planning, any wired network needs wiring plans.
• Design: Wireless networks allow for the design of independent, small devices which
can for example be put into a pocket. Cables not only restrict users but also designers
of small notepads, PDAs, etc.
• Robustness: Wireless networks can handle disasters, e.g., earthquakes, flood etc.
whereas, networks requiring a wired infrastructure will usually break down
completely in disasters.
• Cost: The cost of installing and maintaining a wireless LAN is on average lower than
the cost of installing and maintaining a traditional wired LAN, for two reasons. First,
after providing wireless access to the wireless network via an access point for the first
user, adding additional users to a network will not increase the cost. And second,
wireless LAN eliminates the direct costs of cabling and the labor associated with
installing and repairing it.
• Ease of Use: Wireless LAN is easy to use and the users need very little new information
to take advantage of WLANs.
• 3.2 Disadvantages of WLANs
• Quality of Services: Quality of wireless LAN is typically lower than wired networks.
The main reason for this is the lower bandwidth due to limitations is radio
transmission, higher error rates due to interference and higher delay/delay variation
due to extensive error correction and detection mechanisms.
• Proprietary Solutions: Due to slow standardization procedures, many companies
have come up with proprietary solutions offering standardization functionality plus
many enhanced features. Most components today adhere to the basic standards IEEE
802.11a or 802.11b.
• Restrictions: Several govt. and non-govt. institutions world-wide regulate the
operation and restrict frequencies to minimize interference.
• Global operation: Wireless LAN products are sold in all countries so, national and
international frequency regulations have to be considered.
• Low Power: Devices communicating via a wireless LAN are typically power
consuming, also wireless devices running on battery power. Whereas the LAN design
should take this into account and implement special power saving modes and power
management functions.
• License free operation: LAN operators don't want to apply for a special license to be
able to use the product. The equipment must operate in a license free band, such as the
2.4 GHz ISM band.
• Robust transmission technology: If wireless LAN uses radio transmission, many
other electrical devices can interfere with them (such as vacuum cleaner, train engines,
hair dryers, etc.).Wireless LAN transceivers cannot be adjusted for perfect
transmission is a standard office or production environment.
Conclusion:
Hence, we have successfully setup a WAN which contains wired as well as wireless LAN
by using a packet tracer tool.

Procedure:
Step1. Connect PC0,PC1,PC2 to Switch in wired LAN
PC Port Switch(2960-
24TT)
PC0 FastEthernet0 FastEthernet0/1
PC1 FastEthernet0 FastEthernet0/2
PC2 FastEthernet0 FastEthernet0/3

Step2. Connect PC4,PC5,PC6 to Access Point in wireless LAN


Wireless Network Name WEP Key
NileshKorade 9876543210

Step3. Connect Switch0 and Switch1 to Router0


Switch Switch(2960-24TT) Router( 1941 Router) IP Address
Switch0 GigabitEthernet0/1 GigabitEthernet0/1 172.16.1.1
Switch1 GigabitEthernet0/1 GigabitEthernet0/2 192.168.2.1

Step4. Connect Access Point to Switch1 FastEthernet0/1 port

Step 5. Assign IPAddress to PC0,PC1,PC2 in Wired LAN

172.16.1.2 255.255.0.0 172.16.1.1


172.16.1.3 255.255.0.0 172.16.1.1
172.16.1.4 255.255.0.0 172.16.1.1

Step6. Assign IPAddress to PC3,PC4,PC5 in Wireless LAN


PC IP Address Subnet Mask Default Gateway
PC4 192.168.2.2 255.255.255.0 192.168.2.1
PC5 192.168.2.3 255.255.255.0 192.168.2.1
PC6 192.168.2.4 255.255.255.0 192.168.2.1

Step7. Send Packet From PC0 to PC4


OutPut/Screenshot:
Assignment No:13
Problem Statement:Study and Analyze the performance of HTTP, HTTPS and FTP
protocol using Packet tracer tool
Objectives: To develop an understanding of various protocols, modern technologies and
applications.
Outcome: Implement web applications and services using application layer protocols
Software & Hardware Requirments:
Operating System: Ubuntu
Tool: Packet Tracer
Hardware: i3 Processor, 4GB RAM, 500GB HDD

Theory:
1. HTTP (Hyper Text Transfer Protocol)
The Hypertext Transfer Protocol (HTTP) is application-level protocol for collaborative,
distributed, hypermedia information systems. It is the data communication protocol used
to establish communication between client and server. HTTP is TCP/IP based
communication protocol, which is used to deliver the data like image files, query results,
HTML files etc on the World Wide Web (WWW) with the default port is TCP 80. It provides
the standardized way for computers to communicate with each other.
1.1 The Basic Characteristics of HTTP (Hyper Text Transfer Protocol):
o It is the protocol that allows web servers and browsers to exchange data over the
web.
o It is a request response protocol.
1.2 The Basic Features of HTTP (Hyper Text Transfer Protocol):
There are three fundamental features that make the HTTP a simple and powerful protocol
used for communication:
o HTTP is media independent: It specifies that any type of media content can be
sent by HTTP as long as both the server and the client can handle the data content.
o HTTP is connectionless: It is a connectionless approach in which HTTP client i.e.,
a browser initiates the HTTP request and after the request is sent the client
disconnects from server and waits for the response.
o HTTP is stateless: The client and server are aware of each other during a current
request only. Afterwards, both of them forget each other. Due to the stateless
nature of protocol, neither the client nor the server can retain the information
about different request across the web pages.
1.3 HTML
HTML stands for Hyper Text Markup Language, which is the most widely used language
on Web to develop web pages. HTML was created by Berners-Lee in late 1991 but "HTML
2.0" was the first standard HTML specification which was published in 1995. HTML 4.01
was a major version of HTML and it was published in late 1999. Though HTML 4.01
version is widely used but currently we are having HTML-5 version which is an extension
to HTML 4.01, and this version was published in 2012.
Hypertext refers to the way in which Web pages (HTML documents) are linked
together. Thus, the link available on a webpage is called Hypertext. Basic HTML
Document

Tag & Description

<!DOCTYPE...>This tag defines the document type and HTML version.

<html>This tag encloses the complete HTML document and mainly comprises of
document header which is represented by <head>...</head> and document body which
is represented by <body>...</body> tags.

<head>This tag represents the document's header which can keep other HTML tags like
<title>, <link> etc.

<title>The <title> tag is used inside the <head> tag to mention the document title.

<body>This tag represents the document's body which keeps other HTML tags like
<h1>, <div>, <p> etc.

<h1>This tag represents the heading.

<p>This tag represents a paragraph.

2. What is https?
HTTPS stands for Hyper Text Transfer Protocol Secure. It is a protocol for securing the
communication between two systems e.g. the browser and the web server. The following
figure illustrates the difference between communication over http and https:

Fig. Communication over https and http


As you can see in the above figure, http transfers data between the browser and the web
server in the hypertext format, whereas https transfers data in the encrypted format.
Thus, https prevents hackers from reading and modifying the data during the transfer
between the browser and the web server. Even if hackers manage to intercept the
communication, they will not be able to use it because the message is encrypted.
2.1 Secure Socket Layer (SSL)
SSL is the standard security technology for establishing an encrypted link between the
two systems. These can be browser to server, server to server or client to server.
Basically, SSL ensures that the data transfer between the two systems remains encrypted
and private.
The https is essentially http over SSL. SSL establishes an encrypted link using an SSL
certificate which is also known as a digital certificate.
Fig. SSL
2.2 http vs https
http https

Transfers data in hypertext (structured text) Transfers data in


format encrypted format

Uses port 80 by default Uses port 443 by default

Not secure Secured using SSL technology

Starts with http:// Starts with https://

3. File Transfer Protocol (FTP)


File Transfer Protocol(FTP) is an application layer protocol which moves files between
local and remote file systems. It runs on the top of TCP, like HTTP. To transfer a file, 2 TCP
connections are used by FTP in parallel: control connection and data connection.

3.1 What is control connection?


For sending control information like user identification, password, commands to change the
remote directory, commands to retrieve and store files, etc., FTP makes use of control
connection. The control connection is initiated on port number 21.
3.2 What is data connection?
For sending the actual file, FTP makes use of data connection. A data connection is initiated
on port number 20. FTP sends the control information out-of-band as it uses a separate
control connection. Some protocols send their request and response header lines and the data
in the same TCP connection. For this reason, they are said to send their control information
in-band. HTTP and SMTP are such examples.
3.3 FTP Session :
When a FTP session is started between a client and a server, the client initiates a control TCP
connection with the server side. The client sends control information over this. When the
server receives this, it initiates a data connection to the client side. Only one file can be sent
over one data connection. But the control connection remains active throughout the user
session. As we know HTTP is stateless i.e. it does not have to keep track of any user state. But
FTP needs to maintain a state about its user throughout the session.
3.4 Data Structures : FTP allows three types of data structures :
1. File Structure – In file-structure there is no internal structure and the file is
considered to be a continuous sequence of data bytes.
2. Record Structure – In record-structure the file is made up of sequential records.
3. Page Structure – In page-structure the file is made up of independent indexed pages.
3.5 FTP Commands – Some of the FTP commands are :
USER – This command sends the user identification to the server. PASS – This command
sends the user password to the server. CWD – This command allows the user to work with
a different directory or dataset for file storage or retrieval without altering his login or
accounting information. RMD – This command causes the directory specified in the path-
name to be removed as a directory.
MKD – This command causes the directory specified in the pathname to be created as a
directory.
PWD – This command causes the name of the current working directory to be returned in the
reply.
RETR – This command causes the remote host to initiate a data connection and to send the
requested file over the data connection.
LIST – Sends a request to display the list of all the files present in the directory. ABOR –
This command tells the server to abort the previous FTP service command and any
associated transfer of data.
QUIT – This command terminates a USER and if file transfer is not in progress, the server
closes the control connection.

3.6 FTP Replies – Some of the FTP replies are :


200 Command okay.
530 Not logged in.
331 User name okay, need a password.
225 Data connection open; no transfer in progress.
221 Service closing control connection.551 Requested action aborted: page type
unknown.
502 Command not implemented.
503 Bad sequence of commands.
504 Command not implemented for that parameter.
Conclusion:
Hence, we have SuccessfullyStudy and Analyze the performance of HTTP, HTTPS and FTP
protocol using Packet tracertool.

Implementation using Packet tracer tool


Assignment No: 14
Problem Statement:Use packet Tracer tool for configuration of 3 router network using
one of the following protocols RIP/OSPF/BGP.
Objectives: To develop an understanding of various protocols, modern technologies and
applications

Outcome: Demonstrate the subnet formation with IP allocation mechanism and apply various
routing algorithms

Software & Hardware Requirments:


Operating System: Ubuntu
Tool: Packet Tracer
Hardware: i3 Processor, 4GB RAM, 500GB HDDTheory:

1. Routing Protocols
A routing protocol specifies how routers communicate with each other to distribute
information that enables them to select routes between nodes on a computer network.
Routers perform the traffic directing functions on the Internet; data packets are
forwarded through the networks of the internet from router to router until they reach
their destination computer. Routing algorithms determine the specific choice of route.
Each router has a prior knowledge only of networks attached to it directly. A routing
protocol shares this information first among immediate neighbors, and then throughout
the network. This way, routers gain knowledge of the topology of the network. The ability
of routing protocols to dynamically adjust to changing conditions such as disabled
connections and components and route data around obstructions is what gives the
Internet its fault tolerance and high availability.
The specific characteristics of routing protocols include the manner in which they avoid
routing loops, the manner in which they select preferred routes, using information about
hop costs, the time they require to reach routing convergence, their scalability, and other
factors such as relay multiplexing and cloud access framework parameters. Certain
additional characteristics such as multilayer interfacing may also be employed as a means
of distributing uncompromised networking gateways to authorized ports
2. Routing Information Protocol (RIP)
Routing Information Protocol (RIP) is a dynamic routing protocol which uses hop count as a
routing metric to find the best path between the source and the destination network. It is a
distance vector routing protocol which has AD(Administrative Distance) value 120 and works
on the application layer of OSI model. RIP uses port number 520.

2.1 Hop Count :


Hop count is the number of routers occurring in between the source and destination network.
The path with the lowest hop count is considered as the best route to reach a network and
therefore placed in the routing table. RIP prevents routing loops by limiting the number of
hopes allowed in a path from source and destination. The maximum hop count allowed for RIP
is 15 and hop count of 16 is considered as network unreachable.

In the above figure, when the router 1 forwards the packet to the router 2 then it will count as
1 hop count. Similarly, when the router 2 forwards the packet to the router 3 then it will count
as 2 hop count, and when the router 3 forwards the packet to router 4, it will count as 3 hop
count. In the same way, RIP can support maximum upto 15 hops, which means that the 16
routers can be configured in a RIP.

2.2 Features of RIP :


1. Updates of the network are exchanged periodically.
2. Updates (routing information) are always broadcast.
3. Full routing tables are sent in updates.
4. Routers always trust on routing information received from neighbor routers. This is also
known as Routing on rumours.
2.3 RIP versions :
There are three versions of routing information protocol – RIP Version1, RIP Version2, and
RIPng.
RIP v1 is known as Classful Routing Protocol because it doesn’t send information of subnet
mask in its routing update.
2.4 Commands:
>> Use debug command to get the details :
# debug ip rip
>> Use this command to show all routes configured in router, say for router R1 :
R1# show ip route
>> Use this command to show all protocols configured in router, say for router R1 :
R1# show ip protocols

2.5 RIP Message Format


Now, we look at the structure of the RIP message format. The message format is used to share
information among different routers. The RIP contains the following fields in a message:

o Command: It is an 8-bit field that is used for request or reply. The value of the request
is 1, and the value of the reply is 2. o Version: Here, version means that which version
of the protocol we are using.
Suppose we are using the protocol of version1, then we put the 1 in this field.
o Reserved: This is a reserved field, so it is filled with zeroes. o Family: It is a 16-bit
field. As we are using the TCP/IP family, so we put 2 value in this field.
o Network Address: It is defined as 14 bytes field. If we use the IPv4 version, then we
use 4 bytes, and the other 10 bytes are all zeroes.
o Distance: The distance field specifies the hop count, i.e., the number of hops used to
reach the destination.
2.6 RIP timers:
• Update timer: The default timing for routing information being exchanged by the
routers operating RIP is 30 seconds. Using Update timer, the routers exchange their
routing table periodically.
• Invalid timer: If no update comes until 180 seconds, then the destination router
consider it as invalid. In this scenario, the destination router mark hop count as 16 for
that router.
• Flush time : It is the time after which the entry of the route will be flushed if it doesn’t
respond within the flush time. It is 60 seconds by default. This timer starts after the
route has been declared invalid and after 60 seconds i.e time will be 180 + 60 = 240
seconds.

Note that all these times are adjustable. Use this command to change the timers :
R1(config-router)# timers basic
R1(config-router)# timers basic 20 80 80 90

3. Open Shortest Path First (OSPF) protocol


Open Shortest Path First (OSPF) is a link-state routing protocol that is used to find the best
path between the source and the destination router using its own Shortest Path First). OSPF is
developed by Internet Engineering Task Force (IETF) as one of the Interior Gateway Protocol
(IGP), i.e, the protocol which aims at moving the packet within a large autonomous system or
routing domain. It is a network layer protocol which works on the protocol number 89 and
uses AD value 110. OSPF uses multicast address 224.0.0.5 for normal communication and
224.0.0.6 for update to designated router(DR)/Backup Designated Router (BDR). It is based
on a link-state routing algorithm in which each router contains the information of every
domain, and based on this information, it determines the shortest path. The goal of routing is
to learn routes. The OSPF achieves by learning about every router and subnet within the entire
network. Every router contains the same information about the network. The way the router
learns this information by sending LSA (Link State Advertisements). These LSAs contain
information about every router, subnet, and other networking information. Once the LSAs have
been flooded, the OSPF stores the information in a link-state database known as LSDB. The
main goal is to have the same information about every router in an LSDBs.
3.1 OSPF terms –
1. Router I’d – It is the highest active IP address present on the router. First, highest
loopback address is considered. If no loopback is configured then the highest active IP
address on the interface of the router is considered.
2. Router priority – It is a 8 bit value assigned to a router operating OSPF, used to elect
DR and BDR in a broadcast network.
3. Designated Router (DR) – It is elected to minimize the number of adjacency formed.
DR distributes the LSAs to all the other routers. DR is elected in a broadcast network
to which all the other routers shares their DBD. In a broadcast network, router requests
for an update to DR and DR will respond to that request with an update.
4. Backup Designated Router (BDR) – BDR is backup to DR in a broadcast network.
When DR goes down, BDR becomes DR and performs its functions.
3.2 DR and BDR election – DR and BDR election takes place in broadcast network or multi-
access network. Here are the criteria for the election:
1. Router having the highest router priority will be declared as DR.
3.3 OSPF states – The device operating OSPF goes through certain states. These states are:
1. Down – In this state, no hello packet have been received on the interface.
Note – The Down state doesn’t mean that the interface is physically down. Here, it
means that OSPF adjacency process has not started yet.
2. INIT – In this state, hello packet have been received from the other router.
3. 2WAY – In the 2WAY state, both the routers have received the hello packets from other
routers. Bidirectional connectivity has been established. Note – In between the
2WAY state and Exstart state, the DR and BDR election takes place.
4. Exstart – In this state, NULL DBD are exchanged.In this state, master and slave
election take place. The router having the higher router I’d becomes the master while
other becomes the slave. This election decides Which router will send it’s DBD first
(routers who have formed neighbourship will take part in this election).
5. Exchange – In this state, the actual DBDs are exchanged.
6. Loading – In this sate, LSR, LSU and LSA (Link State Acknowledgement) are
exchanged.
Important – When a router receives DBD from other router, it compares it’s own DBD
with the other router DBD. If the received DBD is more updated than its own DBD
then the router will send LSR to the other router stating what links are needed. The
other router replies with the LSU containing the updates that are needed. In return to
this, the router replies with the Link State Acknowledgement.
7. Full – In this state, synchronization of all the information takes place. OSPF routing
can begin only after the Full state.

3.4 How does OSPF work?


There are three steps that can explain the working of OSPF:
Step 1: The first step is to become OSPF neighbors. The two connecting routers running OSPF
on the same link creates a neighbor relationship.
Step 2: The second step is to exchange database information. After becoming the neighbors,
the two routers exchange the LSDB information with each other.
Step 3: The third step is to choose the best route. Once the LSDB information has been
exchanged with each other, the router chooses the best route to be added to a routing table
based on the calculation of SPF.

3.5 OSPF Message Format


The following are the fields in an OSPF message format:
o Version: It is
an 8-bit field that specifies the OSPF protocol version. o Type: It is an 8-bit field. It
specifies the type of the OSPF packet. o Message: It is a 16-bit field that defines the
total length of the message, including the header. Therefore, the total length is equal to
the sum of the length of the message and header.
o Source IP address: It defines the address from which the packets are sent. It is a
sending routing IP address.
o Area identification: It defines the area within which the routing takes place. o
Checksum: It is used for error correction and error detection. o Authentication type:
There are two types of authentication, i.e., 0 and 1. Here, 0 means for none that specifies
no authentication is available and 1 means for pwd that specifies the password-based
authentication.
o Authentication: It is a 32-bit field that contains the actual value of the authentication
data.

3.6 OSPF Packets


There are five different types of packets in OSPF:
Hello packet
The Hello packet is used to create a neighborhood relationship and check the neighbor's
reachability. Therefore, the Hello packet is used when the connection between the routers need
to be established. Database Description
After establishing a connection, if the neighbor router is communicating with the system first
time, it sends the database information about the network topology to the system so that the
system can update or modify accordingly.
Link state request
The link-state request is sent by the router to obtain the information of a specified route.
Suppose there are two routers, i.e., router 1 and router 2, and router 1 wants to know the
information about the router 2, so router 1 sends the link state request to the router 2. When
router 2 receives the link state request, then it sends the link-state information to router 1.
Link state acknowledgment
The link-state acknowledgment makes the routing more reliable by forcing each router to send
the acknowledgment on each link state update. For example, router A sends the link state
update to the router B and router C, then in return, the router B and C sends the link- state
acknowledgment to the router A, so that the router A gets to know that both the routers have
received the link-state update.

4. Border Gateway Protocol (BGP)

Border Gateway Protocol (BGP) is used to Exchange routing information for the internet and
is the protocol used between ISP which are different ASes.
The protocol can connect together any internetwork of autonomous system using an arbitrary
topology. The only requirement is that each AS have at least one router that is able to run BGP
and that is router connect to at least one other AS’s BGP router. BGP’s main function is to
exchange network reach-ability information with other BGP systems. Border Gateway
Protocol constructs an autonomous systems’ graph based on the information exchanged
between BGP routers.
4.1 What is an autonomous system?
The Internet is a network of networks; it’s broken up into hundreds of thousands of smaller
networks known as autonomous systems (AS). Each of these networks is essentially a large
pool of routers run by a single organization.
If we continue to think of BGP as the postal service of the Internet, AS’s are like individual
post office branches. A town may have hundreds of mailboxes, but the mail in those boxes
must go through the local postal branch before being routed to another destination. The internal
routers within an AS are like mailboxes, they forward their outbound transmissions to the AS,
which then uses BGP routing to get these transmissions to their destinations.
The diagram above illustrates a simplified version of BGP. In this version there are only 6
autonomous systems on the Internet. If AS1 needs to route a packet to AS3, it has two different
options:
Hopping to AS2 and then to AS3:
AS2 → AS3
Or hopping to AS6, then to AS5, AS4, and finally to AS3:
AS6 → AS5 → AS4 → AS3
In this simplified model, the decision seems simple. The AS2 route requires fewer hops than
the AS6 route, and therefore it is the quickest, most efficient route. Now imagine that there are
hundreds of thousands of AS’s and that hop count is only one part of a complex route selection
algorithm. That’s the reality of BGP routing on the Internet.
The structure of the Internet is constantly changing, with new systems popping up and existing
systems becoming unavailable. Because of this, every AS must be kept up to date with
information regarding new routes as well as obsolete routes. This is done through peering
sessions where each AS connects to neighboring AS’s with a TCP/IP connection for the
purpose of sharing routing information. Using this information, each AS is equipped to
properly route outbound data transmissions coming from within.
Here’s where part of our analogy falls apart: Unlike post office branches, autonomous systems
are not all part of the same organization. As such, they have no reason to be friendly to each
other and are often times business competitors! For this reason, BGP routes sometimes take
business considerations into account. Autonomous Systems often charge each other to carry
traffic across their networks, and the price of access can be factored into which route is
ultimately selected.
4.2 Characteristics of Border Gateway Protocol (BGP):
• Inter-Autonomous System Configuration: The main role of BGP is to provide
communication between two autonomous systems.
• BGP supports Next-Hop Paradigm.
• Coordination among multiple BGP speakers within the AS (Autonomous System).
• Path Information: BGP advertisement also include path information, along with the
reachable destination and next destination pair.
• Policy Support: BGP can implement policies that can be configured by the
administrator. For ex:- a router running BGP can be configured to distinguish between
the routes that are known within the AS and that which are known from outside the AS.
• Runs Over TCP.
• BGP conserve network Bandwidth.
• BGP supports CIDR.
• BGP also supports Security.
4.3 Functionality of Border Gateway Protocol (BGP): BGP
peers performs 3 functions, which are given below.
1. The second function mainly focus on sending of negative or positive reach-ability
information.
2. The third function verifies that the peers and the network connection between them are
functioning correctly.
BGP Route Information Management Functions:
• Route Storage:
Each BGP stores information about how to reach other networks.
• Route Update:
In this task, Special techniques are used to determine when and how to use the
information received from peers to properly update the routes.
• Route Selection:
Each BGP uses the information in its route databases to select good routes to each
network on the internet network.
• Route advertisement:
Each BGP speaker regularly tells its peer what is knows about various networks and
methods to reach them.

Conclusion:
Hence, we have successfullyconfigure 3 router network using
RIP/OSPF/BGPprotocol.

1. RIP Configuration Procedure


1. Drag Three Switch(2960-24TT), Six PC(PC0 to PC5), Three Router(Router0,
Router1, Router2)
2. Connect PC0&PC1 to Switch0, PC2&PC3 to Switch1, PC4&PC5 to Switch2 using Copper
Straight Through Cable.
Device Device Port
PC0 Switch0 FastEthernet 0/0
PC1 Switch0 FastEthernet 0/1
PC2 Switch1 FastEthernet 0/0
PC3 Switch1 FastEthernet 0/1
PC4 Switch2 FastEthernet 0/0
PC5 Switch2 FastEthernet 0/1

3. Connect Switch to Router


Device Port Device Port
Switch0 FastEthernet 0/3 Router0 FastEthernet 0/0
Switch1 FastEthernet 0/3 Router1 FastEthernet 0/0
Switch2 FastEthernet 0/3 Router2 FastEthernet 0/0
4. Go to Router Physical Configuration add HWIC-2T,Cisco 2-Port Serial High-Speed WAN
Interface Card which providing 2 serial ports. Add Connect Router0 to Router1,
Router1 to Router2, Router1 to Router2 using following Configuration.
Device Port Device Port
Router0 Serial 0/0/0 Router1 Serial 0/0/0
Router1 Serial 0/0/1 Router2 Serial 0/0/0
Router0 Serial 0/0/1 Router2 Serial 0/0/1

5. Assign IP Address to PC
Device IP Address Subnet Mask Default Gateway
PC0 192.168.1.2 255.255.255.0 192.168.1.1
PC1 192.168.1.3 255.255.255.0 192.168.1.1
PC2 192.168.2.2 255.255.255.0 192.168.2.1
PC3 192.168.2.3 255.255.255.0 192.168.2.1
PC4 192.168.3.2 255.255.255.0 192.168.3.1
PC5 192.168.3.3 255.255.255.0 192.168.3.1

6. Assign IP Address to Router Serial Port and Turn it ON


Device Port IP Address Subnet Mask
Router0 Serial 0/0/0 10.0.0.1 255.0.0.0
Router0 Serial 0/0/1 12.0.0.1 255.0.0.0
Router1 Serial 0/0/0 10.0.0.2 255.0.0.0
Router1 Serial 0/0/1 11.0.0.1 255.0.0.0
Router2 Serial 0/0/0 11.0.0.2 255.0.0.0
Router2 Serial 0/0/1 12.0.0.2 255.0.0.0

7. Go to Router Click on IP Add Following Network Address in each router RIP


Configuration and save it.

IP Address
10.0.0.0
11.0.0.0
12.0.0.0
192.168.1.0
192.168.2.0
192.168.3.0
8. Send Packet from any PC to other PC.

OutPut:
2. OSPF Configuration Procedure
1. Drag Two PC(PC0, PC1) and Three Router(1841) Router0, Router1, Router2.
2. Connect PC0 to Router0, PC1 to Router2.
Device Port Device Port
PC0 FastEthernet 0 Router0 FastEthernet 0/0
PC1 FastEthernet 0 Connect To Router2 FastEthernet 0/0

3. Assign IP Address to PC
Device IP Default Gateway
PCO 192.168.1.2 192.168.1.1
PC1 192.168.2.2 192.168.2.1

4. Assign IP Address to port of Router0


Router0 IP Clock Rate
FastEthernet0/ 192.168.1.1
0
Serial2/0 10.10.0.2 64000
Serial3/0 12.12.0.2 64000

5. Assign IP Address to port of Router1


Router0 IP Clock Rate
Serial2/0 10.10.0.3
Serial3/0 11.11.0.2 64000
6. Assign IP Address to port of Router2
Router0 IP Clock Rate
FastEthernet0/ 192.168.2.1
0
Serial2/0 11.11.0.3
Serial3/0 12.12.0.3

7. Open CLI of Router0 and execute following command


Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 192.168.1.0 0.0.0.255 area 0
Router(config-router)#network 10.0.0.0 0.255.255.255 area 0
Router(config-router)#network 12.0.0.0 0.255.255.255 area 0
Router(config-router)#exit
Router(config)#

8. Open CLI of Router1 and execute following command

Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 10.0.0.0 0.0.0.255 area 0
Router(config-router)#network 11.0.0.0 0.255.255.255 area 0
Router(config-router)#exit
Router(config)#

9. Open CLI of Router2 and execute following command

Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 192.168.2.0 0.0.0.255 area 0
Router(config-router)#network 11.0.0.0 0.255.255.255 area 0
Router(config-router)#network 12.0.0.0 0.255.255.255 area 0
Router(config-router)#exit
Router(config)#
10. Send Packet from PC) to PC1

Output:
BGP Configuration Procedure
1. Drag Three PC(PC0, PC1,pc2) and Three Router(1841) Router0, Router1, Router2.
2. Connect PC0 to Router0, PC1 to Router1, PC2 to Router2.
Device Port Device Port
PC0 FastEthernet 0 Router0 FastEthernet 0/0
PC1 FastEthernet 0 Connect To Router1 FastEthernet 0/0
PC2 FastEthernet 0 Router2 FastEthernet 0/0
3. Go to Router Physical Configuration and add HWIC-2T,Cisco 2-Port Serial High-Speed
WAN Interface Card which providing 2 serial ports. Connect Router0 to Router1, Router1
to Router2, Router1 to Router2 using following Configuration.
Device Port Device Port
Router0 Serial 0/0/0 Router1 Serial 0/0/0
Router1 Serial 0/0/1 Connect To Router2 Serial 0/0/0
Router0 Serial 0/0/1 Router2 Serial 0/0/1
5. Assign IP Address to PC
Device IP Address Subnet Mask Default Gateway
PC0 192.168.3.2 255.255.255.0 192.168.3.1
PC1 192.168.1.2 255.255.255.0 192.168.1.1
PC2 192.168.2.2 255.255.255.0 192.168.2.1
6. Assign IP Address to Router Serial Port and Turn it ON
Device Port IP Address Subnet Mask
Router0 Serial 0/0/0 10.0.0.2 255.0.0.0
Router0 Serial 0/0/1 12.0.0.1 255.0.0.0
Router1 Serial 0/0/0 10.0.0.1 255.0.0.0
Router1 Serial 0/0/1 11.0.0.1 255.0.0.0
Router2 Serial 0/0/0 11.0.0.2 255.0.0.0
Router2 Serial 0/0/1 12.0.0.2 255.0.0.0
7. Open CLI of Router0 and execute following command
Router(config)#router bgp 300
Router(config-router)#network 192.168.3.0
Router(config-router)#network 10.0.0.0
Router(config-router)#network 12.0.0.0
Router(config-router)#neighbor 10.0.0.1 remote-as 100 Router(config-router)#neighbor
12.0.0.2 remote-as 200
Router(config-router)#exit

8. Open CLI of Router1 and execute following command


Router(config)#router bgp 100
Router(config-router)#network 192.168.1.0
Router(config-router)#network 10.0.0.0
Router(config-router)#network 11.0.0.0
Router(config-router)#neighbor 10.0.0.2 remote-as 300 Router(config-router)#neighbor
11.0.0.0 remote-as 200
Router(config-router)#exit
Router(config)#

9. Open CLI of Router2 and execute following command


Router(config)#router bgp 200
Router(config-router)#network 192.168.2.0
Router(config-router)#network 11.0.0.0
Router(config-router)#network 12.0.0.0
Router(config-router)#neighbor 11.0.0.2 remote-as 100 Router(config-router)#neighbor
12.0.0.2 remote-as 300
Router(config-router)#exit
Router(config)#
10. BGP Configuration Done
OutPut:

You might also like