CNND Lab Manual
CNND Lab Manual
CNND Lab Manual
Lab Manual
2020-21
Lab Manual
Vision
To be recognized as a center of excellence in the field of Information
Technology where learners are nurtured in a scholarly environment to
evolve into competent professionals to benefit society.
Mission
• Evolve a curriculum which emphasizes on strong engineering
fundamentals with the flexibility to choose advanced courses of
interest and gain exposure to tools and techniques in Information
Technology.
• Encourage a teaching-learning process in which highly competent
faculty share a symbiotic association with the institutes of repute.
• Facilitate creation and dissemination of knowledge through a
digitally enabled learning environment.
• Develop academic and infrastructural facilities with modern
equipment and other learning resources and encourage reciprocal
sharing with other institutes through networking.
• Establish a center of excellence to enhance academia – industry
partnership and work on collaborative projects.
Lab Manual
Program Educational Objectives:
PEO1 To prepare students for successful careers in industry that meet the needs of IT
companies.
PEO2 To develop the ability among students to analyze technical concepts to software or
product design
PEO4 To provide students with a sound foundation in the mathematical, scientific and
engineering fundamentals necessary to formulate, solve and analyze engineering
problems and to prepare them for graduate studies.
PEO6 To provide students experience with the multifaceted aspects of using computers to solve
problems and develop professional application software for some industry/society need
by applying s/w engineering steps during this development.
Program Outcomes:
Graduate will demonstrate skills to use modern engineering tools, softwares and
PO6 equipment to analyze, simulate, model and solve problems in OO Programming
Languages using Object Oriented Concepts.
Lab Manual
Graduate will demonstrate their skills in developing and managing internet based,
PO7 client – server, different database(s), networking applications/projects and latest
computing & communication technologies.
Graduate will be able to communicate effectively in both verbal and written form
PO8 and demonstrate knowledge of professional and ethical responsibilities
PO10 Graduate will develop entrepreneurial approach and ability for life-long learning.
Lab Manual
Semester IV
MSTEAMS
Sign
Endorsed By HOD
Lab Manual
Lab Outcome
LO5 To observe and study the traffic flow and the contents of protocol frames.
LIST OF EXPERIMENT
Semester IV
Subject Computer Networks and Networking Design
Experiment 1
Number
Experiment Understanding Basic networking Commands.
Title
Resources / Hardware:
Apparatus Compatible Computer System
Windows
Required
Theory 1. Ipconfig/ifconfig:
• Stands for Internet protocol configuration.
• It is a fast way of determining your computer's IP address and other
information, such as the address of its default gateway.
• To use the command, just type ipconfig at the Command Prompt.
2. Ping:
• The ping command is one of the most often used networking utilities
for detecting devices on a network and for troubleshooting network
problems.
• When you ping a device, you send that device a short message, which it
then sends back (the echo).
• The general format is ping hostname or ping IP address.
• ping www.google.com or ping 216.58.208.68
• If you receive a reply then the device is working OK, if you don’t then:
❖ The device is faulty, disconnected, switched off, incorrectly
configured.
❖ Your network or the device you are working on is not working
properly.
3. Hostname:
• The hostname is what a device is called on a network.
Lab Manual
• In computer networking, a hostname (archaically node name) is a label
that is assigned to a device connected to a computer network and that
is used to identify the device in various forms of electronic
communication.
• To use the command, just type hostname at the Command Prompt.
4. Trace route command:
• The traceroute command is used to determine the path between two
connections. Often a connection to another device will have to go
through multiple routers. The traceroute command will return the
names or IP addresses of all the routers between two devices.
• Determines the path taken to a destination by sending Internet Control
Message Protocol (ICMP) Echo Request messages to the destination
with incrementally increasing Time to Live (TTL) field values.
• To use the command, just type tracert example.com at the Command
Prompt.
5. ARP Command:
• The ARP commands to view, display, or modify the details/information
in an ARP table/cache.
• Typically, a host uses ARP to determine the hardware address of
another host.
• ARP stands for “Address Resolution Protocol” is a protocol for
mapping an IP address to a physical MAC address on a local area
network.
• When a computer wants to communicate with another computer on a
different network, the IP address would be used. The IP address is like
your mailing address while MAC address is like your name.
• To use this command, type
• arp first then arp -a (for displaying complete ARP cache) also we can
also find the ARP cache entry for a specific IP address by specifying the
IP address with arp command: arp -a 224.0.0.251
6. Netstat command:
• It comes from the word network statistics
• The Netstat command displays a variety of statistics about a computer's
active TCP/IP connections.
• When dealing with excessive traffic and malicious software it’s
advantageous to be informed about the inbound and outbound
connections to your computer
Lab Manual
• Netstat is a cross-platform command, which means it's also available in
other operating systems like macOS and Linux.
• To use the command type netstat on command prompt to see all active
connection.
• Find out how to read only established/ LISTEN, CLOSE_WAIT,
TIME_WAIT connection ports
7. Nslookup Command:
• The name nslookup stands for “name server look up.”
• It is used for querying the Domain Name System (DNS) to obtain
domain name or IP address mapping information.
• The main use of nslookup is for troubleshooting DNS related problems.
• For example, if you can get to www.ebay.com by typing 66.135.192.87
in your browser's address bar but not by typing www.ebay.com, you
have a DNS problem. The simplest use of nslookup is to look up the IP
address for a given DNS name. For example, how did I know that
66.135.192.87 was the IP address for ebay.com? I used nslookup to find
out .
• To use the command type nslookup google.com on command prompt
to see all active connection.
8. Route command:
• In IP networks, routing tables are used to direct packets from one
subnet to another.
• The Route command provides the device’s routing tables.
• To get this result, just type route print.
Output 1.
Lab Manual
2.
3.
Lab Manual
4.
5.
6.
Lab Manual
7.
8.
Lab Manual
Semester IV
Experiment 2
Number
2. Ring
3. Star
4. Mesh
5. Hybrid
Objective To learn and perform the basic topologies used for building
an efficient computer network.
2.Ring Topology:-
In ring topology each device is connected with the
two devices on either side of it. There are two dedicated
point to point links a device has with the devices on the
either side of it. This structure forms a ring thus it is known
as ring topology. If a device wants to send data to another
device then it sends the data in one direction, each device in
ring topology has a repeater, if the received data is intended
for other device then repeater forwards this data until the
intended device receives it.
Advantages of Ring Topology
1. Easy to install.
2. Managing is easier as to add or remove a device from the
topology only two links are required to be changed.
3. Star Topology:-
4.Mesh Topology:-
In mesh topology each device is connected to every
other device on the network through a dedicated point-to-
point link. When we say dedicated it means that the link
only carries data for the two connected devices only. Lets
say we have n devices in the network then each device must
be connected with (n-1) devices of the network. Number of
links in a mesh topology of n devices would be n(n-1)/2.
5.Hybrid Topology:-
Output:-
Lab Manual
Semester IV
Experiment 3
Number
Experiment Design Interconnecting Network using Router in CPT.
Title
Objective To learn and perform the interconnection between routers,
switches and nodes among two buildings
Resources / Hardware: Desktop Software: Cisco packet Tracer
Apparatus
Required
Theory 1.Router
2.Switch
Output
Lab Manual
Lab Manual
Semester IV
Experiment 4
package checksum_sender;
import java.io.*;
import java.net.*;
import java.util.*;
{
// Setting maximum data length
{
servsock = new ServerSocket(port);
socket = servsock.accept();
dis = new
DataInputStream(socket.getInputStream());
dos = new
DataOutputStream(socket.getOutputStream());
while (true)
l = sc.nextInt();
data[i] = sc.nextInt();
sum += c_data[i];
Lab Manual
}
data[i] = sum;
l += 1;
dos.writeInt(l);
if (dis.readUTF().equals("success"))
{
else if (dis.readUTF().equals("failure"))
{
System.out.println("Message was not
received successfully!");
break;
}
}
socket.close();
// Driver Method
{
Checksum_Sender cs = new
Checksum_Sender(45678);
}
}
Lab Manual
// Java code for Checksum_Receiver
package checksum_sender;
import java.net.*;
import java.io.*;
import java.util.*;
nob = (int)(Math.floor(Math.log(data[i]) /
Math.log(2))) + 1;
Lab Manual
c_data[i] = ((1 << nob) - 1) ^ data[i];
}
System.out.println("Sum(in ones complement)
is : "+sum);
System.out.println("Calculated Checksum is :
"+sum);
if(sum == 0)
{
dos.writeUTF("success");
break;
}
else
{
Lab Manual
dos.writeUTF("failure");
break;
}
}
dis.close();
dos.close();
s.close();
// Driver Method
public static void main(String args[])throws IOException
{
// Getting ip address on which the receiver is
running
// Here, it is "localhost"
InetAddress ip = InetAddress.getLocalHost();
Checksum_Receiver cr = new
Checksum_Receiver(ip,5000);
}
Lab Manual
Output
Conclusion
Lab Manual
Semester IV
Experiment 5
Number
Experiment Title Implement CRC Error detection algorithm using Java/Python programming
language
Objective To learn and implement CRC error detection in python.
Theory CRC :
→ CRC or Cyclic Redundancy Check is a method of detecting accidental
changes/errors in the communication channel.
→ CRC stands for Cyclic Redundancy Check.
→ CRC uses Generator Polynomial which is available on both sender and
receiver side.
→ Sender side :
The binary data is first augmented by adding k-1 zeros in the end of the data.
Use modulo-2 binary division to divide binary data by the key and store
remainder of division.
Append the remainder at the end of the data to form the encoded data and send
the same
→ Receiver side :
Perform modulo-2 division again and if the remainder is 0, then there are no
errors.
In this we will focus only on finding the remainder i.e. check word and the code
word.
Lab Manual
pick += 1
if tmp[0] == '1':
tmp = xor(divisor, tmp)
else:
tmp = xor('0' * pick, tmp)
checkword = tmp
return checkword
Lab Manual
print("\n",36*"-","RECEIVER SIDE","-"*36)
def decodeData(data, key):
l_key = len(key)
appended_data = data + '0' * (l_key - 1)
remainder = mod2div(appended_data, key)
codeword = data + remainder
print("CRC/Remainder obtained after decoding: ", remainder)
temp = "0" * (len(key)-1)
if remainder == temp:
print("If CRC/Remainder are '0'...given data received is Correct.")
else:
print("If CRC/Remainder are not '0'...given data received is
Wrong...Please try retransmission.")
Output
Lab Manual
Lab Manual
Semester IV
Experiment 6
Number
Experiment Demonstrate the TCP/IP protocol suite for the current packet running.
Title
Objective To study TCP/IP protocol suite.
Resources Hardware: Software:
/ PC with the Configuration of Intel wireshark
Apparatus Dual core Processor or higher,
Required Minimum 2 GB RAM, Minimum 40
GB Hard disk, Network interface card.
Output
Lab Manual
Lab Manual
Semester IV
Experiment Number 07
Theory Topology:
Geometric representation of how the computers are connected to each
other is known as topology. There are five types of topology – Mesh, Star,
Bus, Ring and Hybrid.
Output First college building:
Semester IV
Experiment 8
Number
Experiment Implement Dijkstra’s algorithm
Title
Objective To study Dijkstra’s algorithm in python.
Code
graph = {'a': {'b': 10, 'c': 3}, 'b': {'c': 1, 'd': 2}, 'c': {'b': 4, 'd': 8, 'e': 2}, 'd':
{'e': 7}, 'e': {'d': 9}}
while unseenNodes:
minNode = None
for node in unseenNodes:
if minNode is None:
minNode = node
elif shortest_distance[node] < shortest_distance[minNode]:
minNode = node
currentNode = goal
while currentNode != start:
try:
path.insert(0, currentNode)
currentNode = predecessor[currentNode]
except KeyError:
print('The given path is not reachable.')
break
path.insert(0, start)
if shortest_distance[goal] != infinity:
print('Shortest distance is ' + str(shortest_distance[goal]))
print('> path is ' + str(path))
Semester IV
Experiment 9
Number
Experiment Write a UDP-based socket program.
Title
Resource Hardware: Computer Software: Python IDLE
s/
Apparatu
s
Required
Objectives
(Skill
Set /
Knowled
ge
Tested /
Imparted
)
Theory Socket programming is a way of connecting two nodes on a network to
communicate with each other. One socket(node) listens on a particular port at
an IP, while other socket reaches out to the other to form a connection. Server
forms the listener socket while client reaches out to the server.[Text Wrapping
Break]They are the real backbones behind web browsing. In simpler terms
there is a server and a client.
Code
Following is the program to demonstrate UDP socket programing:-
Server.py
import socket
localIP = "192.168.1.106"
localPort = 20001
bufferSize = 1024
msgFromServer = "Hello UDP Client"
bytesToSend = str.encode(msgFromServer)
Lab Manual
# Create a datagram socket
UDPServerSocket = socket.socket(family=socket.AF_INET, type=socket.SO
CK_DGRAM)
# Bind to address and ip
UDPServerSocket.bind((localIP, localPort))
print("UDP server up and listening")
# Listen for incoming datagrams
while(True):
bytesAddressPair = UDPServerSocket.recvfrom(bufferSize)
message = bytesAddressPair[0]
address = bytesAddressPair[1]
no1 = UDPServerSocket.recvfrom(bufferSize)
no2 = UDPServerSocket.recvfrom(bufferSize)
clientMsg = "Message from Client:{}".format(message)
clientIP = "Client IP Address:{}".format(address)
sum1 = str.encode(str(int(no1[0])+int(no2[0])))
print(sum1)
# Sending a reply to client
UDPServerSocket.sendto(sum1,address)
Client.py
import socket
msgFromClient = "Hello UDP Server"
bytesToSend = str.encode(msgFromClient)
serverAddressPort = ("192.168.1.106", 20001)
bufferSize = 1024
Lab Manual
no1 = str.encode(input("enter no1"))
no2 = str.encode(input("enter no2"))
# Create a UDP socket at client side
UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SO
CK_DGRAM)
# Send to server using created UDP socket
UDPClientSocket.sendto(bytesToSend, serverAddressPort)
UDPClientSocket.sendto(no1, serverAddressPort)
UDPClientSocket.sendto(no2, serverAddressPort)
msgFromServer = UDPClientSocket.recvfrom(bufferSize)
msg = "Message from Server {}".format(msgFromServer[0])
print(msg)
Output
Server.py
Client.py
Experiment 9
Number
Experiment Write a TCP-based socket program.
Title
Resources / Hardware: Computer Software: Python IDLE
Apparatus
Required
Objectives
(Skill Set /
Knowledg
e Tested /
Imparted)
Theory Socket programming is a way of connecting two nodes on a network to
communicate with each other. One socket(node) listens on a particular port
at an IP, while other socket reaches out to the other to form a connection.
Server forms the listener socket while client reaches out to the server.[Text
Wrapping Break]They are the real backbones behind web browsing. In simpler
terms there is a server and a client.
Code
Following is the program to demonstrate TCP socket programing:-
Server.py
#importing socket
import socket as s
#server socket
socket1 = s.socket()
print("Socket Created")
#address where the server should run
socket1.bind(('192.168.56.1',9999))
print("Bind Completed")
#specifing how many client's connection can be accepted/start lestning for ser
ver
socket1.listen(3)
print("Server Listening")
while True:
#accept connection
c,addr = socket1.accept()
print("Connection established!client connected",addr)
#receiving data from client
n = c.recv(1024).decode()
m = c.recv(1024).decode()
inc = 0
for i in n:
if m == i:
inc+=1
print(inc)
#transmitting data from server to client
Lab Manual
c.send(bytes(str(inc),"utf-8"))
c.close()
Client.py
import socket as s
#create client socket
c = s.socket()
#connecting client socket with server
c.connect(('192.168.56.1',9999))
n = input("Enter string: ")
m = input("Enter char: ")
#sending data from client to server
c.send(bytes(n,"utf-8"))
#sending data from client to server
c.send(bytes(m,"utf-8"))
#receiving data from server
str = c.recv(1024)
#decoding the data
print(str.decode())
Output
Server.py
Lab Manual
Client.py
Semester IV
Experiment 10
Number
Experiment Title Calculate IP addressing values.
Objective Considering IP address, calculate Network address, Broadcast
address, Default Broadcast address,Number of Host.
Resources / Hardware: Computer Software: -Any Python IDLEs
Apparatus like Spyder or Pycharm
Required
Code: def A(ip,l,bit,n):
start,end,first,last=[],[],["0","0","0","0"],["0","0","0","0"]
print("Default Mask=255.0.0.0")
l[0],l[1]="255",bit*'1'+(8-bit)*'0'
l[1]=str(int("0b"+l[1],2))
print("Subnet Mask =",".".join(l))
b=int("0b"+(8-bit)*"1",2)
c=0
for i in range(n):
ip[1]=str((b+1)*i)
end.append(ip[1])
ip[1]=str((b*(i+1)+c))
start.append(ip[1])
c+=1
print("subnet startAdd endAdd")
for i in range(n):
print(i+1,end=" ")
last[1]=end[i]
last[0],last[2],last[3]=ip[0],"0","0"
print(".".join(last),end=" ")
first[1]=start[i]
first[0],first[2],first[3]=ip[0],"255","255"
print(".".join(first))
def B(ip,l,bit,n):
start,end,first,last=[],[],["0","0","0","0"],["0","0","0","0"]
print("Default Mask=255.255.0.0")
l[0],l[1],l[2]="255","255",bit*'1'+(8-bit)*'0'
l[2]=str(int("0b"+l[2],2))
print("Subnet Mask =",".".join(l))
Lab Manual
b=int("0b"+(8-bit)*"1",2)
c=0
for i in range(n):
ip[2]=(b+1)*i
end.append(ip[2])
ip[2]=(b*(i+1)+c)
start.append(ip[2])
c+=1
print("subnet startAdd endAdd")
for i in range(n):
print(i+1,end=" ")
last[2]=str(end[i])
last[0],last[1],last[3]=ip[0],ip[1],"0"
print(".".join(last),end=" ")
first[2]=str(start[i])
first[0],first[1],first[3]=ip[0],ip[1],"255"
print(".".join(first))
def C(ip,l,bit,n):
start,end,first,last=[],[],["0","0","0","0"],["0","0","0","0"]
print("Default Mask=255.255.255.0")
l[0],l[1],l[2],l[3]="255","255","255",bit*'1'+(8-bit)*'0'
l[3]=str(int("0b"+l[3],2))
print("Subnet Mask =",".".join(l))
b=int("0b"+(8-bit)*"1",2)
c=0
for i in range(n):
ip[3]=(b+1)*i
end.append(ip[3])
ip[3]=(b*(i+1)+c)
start.append(ip[3])
c+=1
print("subnet startAdd endAdd")
for i in range(n):
print(i+1,end=" ")
last[3]=str(end[i])
last[0],last[1],last[2]=ip[0],ip[1],ip[2]
print(".".join(last),end=" ")
first[3]=str(start[i])
first[0],first[1],first[2]=ip[0],ip[1],ip[2]
print(".".join(first))
s,l=input("Enter IP address :- "),["0","0","0","0"]
n=int(input("Enter no.subnets :- "))
ip=s.split('.')
for i in range(1,9):
if(2**i>=n):
bit=i
break
Lab Manual
print("Given IP =",s)
if(int(ip[0]) in range(0,128)):
print("Class = A")
A(ip,l,bit,n)
elif(int(ip[0]) in range(128,192)):
print("Class = B")
B(ip,l,bit,n)
elif(int(ip[0]) in range(192,224)):
print("Class = C")
C(ip,l,bit,n)
else:
print("IP is not valid")
Output:
Semester IV
Experimen Lab 11
t Number
Experimen Consider IP address and no of subnets required by the industry,
t Title display details of entire network and each network separately.
Objective Creation of subnets.
Resources Hardware: Desktop Software: python, pycharm
Required
Theory What is Subnetting?
Subnetting is the practice of dividing a network into two or smaller networks.
It increases routing efficiency, which helps to enhance the security of the netw
ork and reduces the size of the broadcast domain.
IP Subnetting designates high-order bits from the host
as part of the network prefix. This method divides a
network into smaller subnets.
It also helps you to reduce the size of the routing tables, which is stored in rout
ers. This method also helps you to extend the existing IP address base
& restructures the IP address.
Why Use Subnetting?
• It helps you to maximise IP addressing efficiency.
• Extend the life of IPV4.
• Public IPV4 Addresses are scarce.
• IPV4 Subnetting reduces network traffic by eliminating collision
and broadcast traffic and thus improves overall performance.
• This method allows you to apply network security policies at the
interconnection between subnets.
• Optimized IP network performance.
• Facilitates spanning of large geographical distances.
• Subnetting process helps to allocate IP addresses that prevent l
arge numbers of IP network addresses from remaining unused.
• Subnets are usually set up geographically for specific offices or p
articular teams within a
business that allows their network traffic to stay within the location
.
• What is Subnet Mask?
A subnet mask is a 32 bits address used to distinguish between a
network address and a host address in IP address.
A subnet mask identifies which part of an IP address is the network address an
Lab Manual
d the host address. They
are not shown inside the data packets traversing the Internet.
They carry the destination IP address, which a router will match with a subnet.
if len(tempArray) != 4:
raise NameError('not a valid ip address')
for i in tempArray:
num = int(i)
if num < 0 or num > 255:
raise NameError('not a valid ip address')
addrArray.append(num)
Output
Lab Manual