You are on page 1of 27

INDEX

Sr. List of Experiment Date Signature


No

1 Introduction to Network Devices (Repeater, Hub, Bridge, Switch,


Router, Gateways, NIC etc.
2 To make UTP cable with RJ45 connector and built and test simple
network using UTP cable (crossover) and a hub based (straight
thru) cable.

3 Introduction to CISCO Packet Tracer. Design bus, star, mesh and


ring topology and check the connectivity using ping command

4 Test the Network connection using ping command and use of


ipconfig, and trcert command provided by TCP/IP.

5 Performing an Initial Switch Configuration

6 Implementation of CRC algorithm in any language like C++, Java


or Python.
7 Implementation of data link layer framing method such as bit
stuffing in any language like C++, Java or Python.

8 Implementation of hamming code (7, 4) code to limit the noise. We


have to code the bit data in to 7bit data by adding 3 parity bits.
Implement in in any language like C++, Java or Python.

9 Write a program in java to find the IP address of the system.

10 Write a program in java to find the IP address of the any site if


name is given.

Aryan Singh CSE VI A 2001330100073


EXPERIMENT-3
AIM: - Introduction to CISCO Packet Tracer. Design bus , star ,
mesh and ring toplogy and check the connectivity using ping
command

A) CISCO 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.
Packet Tracer can be run on Linux and Microsoft Windows. Similar Android and iOS apps are
also available. Packet Tracer allows users to create simulated network topologies by

dragging and dropping routers, switches and various other types of network
devices. A physical connection between devices is represented by a "cable"
item. Packet Tracer supports an array of simulated Application Layer
protocols, as well as basic routing with RIP, OSPF, EIGRP, BGP, to the
extents required by the current CCNA curriculum. As of version 5.3, Packet
Tracer also supports the Border Gateway Protocol.
In addition to simulating certain aspects of computer networks, Packet
Tracer can also be used for collaboration. As of Packet Tracer 5.0, Packet
Tracer supports a multi-user system that enables multiple users to connect
multiple topologies together over a computer network. Packet Tracer also
allows instructors to create activities that students have to complete. Packet
Tracer is often used in educational settings as a learning aid. Cisco Systems
claims that Packet Tracer is useful for network experimentation.
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.
The application itself only has a small number of features found within the
actual hardware running a current Cisco IOS version. Thus, Packet Tracer is
unsuitable for modelling production networks. It has a limited command set,

Aryan Singh CSE VI A 2001330100073


meaning it is not possible to practice all of the IOS commands that might be
required. Packet Tracer can be useful for understanding abstract networking
concepts, such as the Enhanced Interior Gateway Routing Protocol by
animating these elements in a visual form. Packet Tracer is also useful in
education by providing additional components, including an authoring
system, network protocol simulation and improving knowledge an
assessment system.

1. b) Bus Topology -A bus topology is a topology for a Local Area


Network (LAN) in which all the nodes are connected to a single cable.
The cable to which the nodes connect is called a "backbone". If the
backbone is broken, the entire segment fails.
2. Mesh Topology- Mesh topology is a type of networking where all
nodes cooperate to distribute data amongst each other. This topology
setup allows for most transmissions to be distributed even if one of the
connections goes down. It is a topology commonly used for wireless
networks.
3. Ring Topology- A ring network is a network topology in which
each node connects to exactly two other nodes, forming a single
continuous pathway for signals through each node
- a ring. Data travels from node to node, with each node along the way handling every
packet.

Star Topology-A star topology is a topology for a Local Area Network


(LAN) in which all nodes are individually connected to a central

Aryan Singh CSE VI A 2001330100073


connection point, like a hub or a switch. A star takes more cable than e.g. a
bus, but the benefit is that if a cable fails, only one node will be brought
down.

Aryan Singh CSE VI A 2001330100073


Experiment - 4
AIM: Test the Network connection using ping command and use of
ipconfig, and tracert command provided by TCP/IP.
Theory and Procedure

1.ipconfig

This command details how IP is setup on the machine you are logged into.

At the command prompt, type: ipconfig


There are also a variety of switches for ipconfig that add functions. These are
invoked by entering "ipconfig/{switch}". To obtain a list of switches, enter
"ipconfig /?" or "ipconfig -?". These are shown in the figure below.

/? Display this help message.

Aryan Singh CSE VI A 2001330100073


/all Display full configuration information.

/release Release the IP address for the specified adapter.

/renew Renew the IP address for the specified adapter.

1. TRACERT
This command shows you all the routers that your TCP/IP message
goes through in order to make a connection to another IP address.

Aryan Singh CSE VI A 2001330100073


At the command prompt, type: tracert xxx Where xxx is the IP address or URL
of the machine that we are trying to connect to.

e.g. tracert192.168.0.18

e.g. tracert yahoo.com

2. Ping command

The ping command is a Command Prompt command used to test the ability of the source
computer to reach a specified destination computer. The ping command is usually used
as a simple way to verify that a computer can communicate over the network with
another computer or network device.

The ping command operates by sending Internet Control Message Protocol (ICMP) Echo
Request messages to the destination computer and waiting for a response. How many
of those responses are returned, and how long it takes for them to return, are the two
major pieces of information that the ping command provides.

Aryan Singh CSE VI A 2001330100073


For example, you might find that there are no responses when pinging a network
printer, only to find out that the printer is offline and its cable needs replaced. Or maybe
you need to ping a router to verify that your computer can connect to it, to eliminate it
as a possible cause for a networking issue.

Example:
Ping www.google.com

Aryan Singh CSE VI A 2001330100073


Experiment-5
AIM :- Performing an Initial Switch Configuration
Topology Diagram

Objectives
 Perform an initial configuration of a Cisco Catalyst 2960 switch.

Background / Preparation
In this activity, you will configure these settings on the customer Cisco Catalyst 2960 switch:
 Host name
 Console password
 vty password
 Privileged EXEC mode password
 Privileged EXEC mode secret
 IP address on VLAN1 interface
 Default gateway
Note: Not all commands are graded by Packet Tracer.

Step 1: Configure the switch host name.


a. From the Customer PC, use a console cable and terminal emulation software to
connect to the console of the customer Cisco Catalyst 2960 switch.
b. Set the host name on the switch to CustomerSwitch using these commands.

Switch>enable

Switch#configure terminal

Switch(config)#hostname CustomerSwitch

Aryan Singh CSE VI A 2001330100073


Step 2: Configure the privileged mode password and secret.
a. From global configuration mode, configure the password as cisco.

CustomerSwitch(config)#enable password cisco

b. From global configuration mode, configure the secret as cisco123.

CustomerSwitch(config)#enable secret cisco123

Step 3: Configure the console password.


a. From global configuration mode, switch to configuration mode to configure the console line.
CustomerSwitch(config)#line console 0

b. From line configuration mode, set the password to cisco and require the
password to be entered at login.

CustomerSwitch(config-line)#password cisco
CustomerSwitch(config-line)#login
CustomerSwitch(config-line)#exit

Step 4: Configure the vty password.


a. From global configuration mode, switch to the configuration mode for the vty lines 0 through
15.

CustomerSwitch(config)#line vty 0 15

b. From line configuration mode, set the password to cisco and require the
password to be entered at login.

CustomerSwitch(config-line)#password cisco
CustomerSwitch(config-line)#login
CustomerSwitch(config-line)#exit

Step 5: Configure an IP address on interface VLAN1.


From global configuration mode, switch to interface configuration mode for VLAN1,
and assign the IP address 192.168.1.5 with the subnet mask of 255.255.255.0.
CustomerSwitch(config)#interface vlan 1

CustomerSwitch(config-if)#ip address 192.168.1.5 255.255.255.0

CustomerSwitch(config-if)#no shutdown
CustomerSwitch(config-if)#exit

Aryan Singh CSE VI A 2001330100073


Step 6: Configure the default gateway.
a. From global configuration mode, assign the default gateway to 192.168.1.1.

CustomerSwitch(config)#ip default-gateway 192.168.1.1

b. Click the Check Results button at the bottom of this instruction window to check your work

Step 7: Verify the configuration.


The Customer Switch should now be able to ping the ISP Server at 209.165.201.10.
The first one or two pings may fail while ARP converges.

CustomerSwitch(confi
g)#end
CustomerSwitch#ping
209.165.201.10

Type escape sequence to abort.


Sending 5, 100-byte ICMP Echos to 209.165.201.10, timeout is 2 seconds:
..!!!
Success rate is 60 percent (3/5), round-trip min/avg/max =

181/189/197 ms CustomerSwitch#

Reflection
a. What is the significance of assigning the IP address to the VLAN1 interface instead of
any of the Fast Ethernet interfaces?

b. What command is necessary to enforce password authentication on the console and vty lines?

c. How many gigabit ports are available on the Cisco Catalyst 2960 switch that you used in the
activity?

Aryan Singh CSE VI A 2001330100073


Experiment – 6
AIM :- Implementation of CRC algorithm in any language like C++ , Java or
Python.

Java
// Java code to implement the approach

Import java.util.Arrays;

Class Program {

// Returns XOR of 'a' and 'b'

// (both of same length)

static String Xor(String a, String b)

// Initialize result

String result = "";

int n = b.length();

// Traverse all bits, if bits are

// same, then XOR is 0, else 1

for (int I = 1; i < n; i++) {

if (a.charAt(i) == b.charAt(i))

result += “0”;

else
result += "1";
}

return result;

// Performs Modulo-2 division

Aryan Singh CSE VI A 2001330100073


static String Mod2Div(String dividend, String divisor)

{
// Number of bits to be XORed at a time. int

pick = divisor.length();

// Slicing the dividend to appropriate

// length for particular step

String tmp = dividend.substring(0, pick);


int n = dividend.length();
while (pick < n) {

if (tmp.charAt(0) == '1')
// Replace the dividend by the result

// of XOR and pull 1 bit down

tmp = Xor(divisor, tmp)

+ dividend.charAt(pick);

else
// If leftmost bit is '0'.

// If the leftmost bit of the dividend (or

// the part used in each step) is 0, the

// step cannot use the regular divisor; we


// need to use an all-0s divisor.

tmp = Xor(new String(new char[pick])

.replace("\0", "0"),

tmp)

+ dividend.charAt(pick);
// Increment pick to move further

pick += 1;

// For the last n bits, we have to carry it out

Aryan Singh CSE VI A 2001330100073


// normally as increased value of pick will cause

// Index Out of Bounds.

if (tmp.charAt(0) == '1')

tmp = Xor(divisor, tmp);

else

tmp = Xor(new String(new char[pick])

.replace("\0", "0"),

tmp);
return tmp;
}
// Function used at the sender side to encode

// data by appending remainder of modular division

// at the end of data.

static void EncodeData(String data, String key)

int l_key = key.length();


// Appends n-1 zeroes at end of data
String appended_data= (data+ new
String(new char[l_key - 1])

.replace("\0", "0"));
String remainder = Mod2Div(appended_data, key);

// Append remainder in the original data

String codeword = data + remainder;

System.out.println("Remainder : " + remainder);

System.out.println("Encoded Data (Data +

Remainder) :" + codeword+ "\n");

// checking if the message received by receiver is

// correct or not. If the remainder is all 0 then it is

Aryan Singh CSE VI A 2001330100073


// correct, else wrong.

static void Receiver(String data, String key)

String currxor= Mod2Div(data.substring(0, key.length()), key); int curr = key.length();


while (curr != data.length()) {

if (currxor.length() != key.length()) {

currxor += data.charAt(curr++);

else {

currxor = Mod2Div(currxor, key);

}
if (currxor.length() == key.length()) {

currxor = Mod2Div(currxor, key);

if (currxor.contains("1"))

System.out.println("there is some error in data");

else {

System.out.println("correct message received");

// Driver code

public static void main(String[] args)

Aryan Singh CSE VI A 2001330100073


String data = "100100";

String key = "1101";

System.out.println("\nSender side...");

EncodeData(data, key);

System.out.println("Receiver side...");

Receiver(data+Mod2Div(data+new String(new char[key.length() - 1])

.replace("\0", "0"),key),key);

OUTPUT

Aryan Singh CSE VI A 2001330100073


Experiment - 7
AIM :- Implementation of data link layer framing method such as bit stuffing
in any language like C++ ,Java or Python.

// Java program for the above approach


class GFG {
// Function for bit stuffing

static void bitStuffing(int N, int arr[])

{
// Stores the stuffed array

int[] brr = new int[30];

// Variables to traverse arrays

int i, j, k;

i = 0;

j = 0;

// Loop to traverse in the range [0, N)

while (i < N) {

// If the current bit is a set bit if (arr[i] ==

1) {

// Stores the count of consecutive ones int count = 1;

// Insert into array brr[]


brr[j] = arr[i];
// Loop to check for

// next 5 bits

for (k = i + 1; k < N && arr[k] == 1


&& count < 5;

k++) {

j++;

Aryan Singh CSE VI A 2001330100073


brr[j] = arr[k]; count++;

// If 5 consecutive set bits

// are found insert a 0 bit if (count == 5) {

j++;

brr[j] = 0;

i = k;

}
// Otherwise insert arr[i] into

// the array brr[] else {

brr[j] = arr[i];

} i++; j++;

}
// Print Answer for (i

= 0; i < j; i++)

System.out.printf("%d", brr[i]);
}
// Driver Code

public static void main(String[] args)

int N = 6;

int arr[] = { 1, 1, 1, 1, 1, 1 };
bitStuffing(N, arr);

Aryan Singh CSE VI A 2001330100073


OUTPUT

Aryan Singh CSE VI A 2001330100073


Experiment - 8
AIM :- Implementation of hamming code (7, 4) code to limit the noise. We
have to code the bit data in to 7bit data by adding 3 parity bits. Implement in
in any language like C++ , Java or Python.

// Python program to demonstrate


# hamming code
def calcRedundantBits(m):
# Use the formula 2 ^ r >= m + r + 1

# to calculate the no of redundant bits.

# Iterate over 0 .. m and return the value

# that satisfies the equation

for i in range(m):

if(2**i >= m + i + 1):

return i

def posRedundantBits(data, r):

# Redundancy bits are placed at the positions

# which correspond to the power of 2.


j=0

k=1

m = len(data)

res = ''
# If position is power of 2 then insert '0'

# Else append the data

for i in range(1, m + r+1):

if(i == 2**j):

res = res + '0'

j += 1

Aryan Singh CSE VI A 2001330100073


else:

res = res + data[-1 * k] k += 1

# The result is reversed since positions

are

# counted backwards. (m + r+1 ... 1)

return res[::-1]

def calcParityBits(arr, r):

n = len(arr)

# For finding rth parity bit, iterate over

# 0 to r - 1
for i in range(r):

val = 0

for j in range(1, n + 1):


# If position has 1 in ith significant
# position then Bitwise OR the array value
# to find parity bit value.
if(j & (2**i) == (2**i)):

val = val ^ int(arr[-1 * j])

# -1 * j is given since array is reversed


# String Concatenation

# (0 to n - 2^r) + parity bit + (n - 2^r + 1 to n)


arr = arr[:n-(2**i)] + str(val) + arr[n-(2**i)+1:]

return arr

def detectError(arr, nr):

n = len(arr)

res = 0

# Calculate parity bits again

for i in range(nr):

val = 0

Aryan Singh CSE VI A 2001330100073


for j in range(1, n + 1):

if(j & (2**i) == (2**i)):

val = val ^ int(arr[-1 * j])


# Create a binary no by appending

# parity bits together.

res = res + val*(10**i)

# Convert binary to decimal

return int(str(res), 2)

#’ Enter the data to be

transmitted ‘

data = '1011001'

# ‘Calculate the no of Redundant

Bits Required ‘

m = len(data)

r = calcRedundantBits(m)
# Determine the positions of Redundant Bits
arr = posRedundantBits(data, r)

# Determine the parity bits

arr = calcParityBits(arr, r)

# Data to be transferred

print("Data transferred is " +

arr)

# Stimulate error in transmission

by changing

# a bit value.

# 10101001110 -> 11101001110, error in 10th position.


arr = '11101001110'

Aryan Singh CSE VI A 2001330100073


print("Error Data is " + arr)
correction = detectError(arr, r)

if(correction==0):

print("There is no error in the received message.")

else:

print("The position of error is ",len(arr)-correction+1,"from the left")

OUTPUT

Aryan Singh CSE VI A 2001330100073


Experiment - 9

AIM : - Write a program in java to find the IP address of the system.

// Java program to find IP address of your


computer
// java.net.InetAddress class provides method to get

// IP of any host name

import java.net.*;

import java.io.*;

import java.util.*;
import java.net.InetAddress;
public class JavaProgram

public static void main(String args[]) throws Exception

// Returns the instance of InetAddress containing

// local host name and address

InetAddress localhost = InetAddress.getLocalHost();

System.out.println("System IP Address : " +

(localhost.getHostAddress()).trim());
// Find public IP address String

systemipaddress = "";

try

URL url_name = new URL("http://bot.whatismyipaddress.com");

Aryan Singh CSE VI A 2001330100073


BufferedReader sc = new BufferedReader(new InputStreamReader(url_name.openStream()));
// reads system IPAddress

systemipaddress = sc.readLine().trim();

catch (Exception e)

systemipaddress = "Cannot Execute Properly";

System.out.println("Public IP Address: " + systemipaddress +"\n");

Output:
System IP Address : 10.0.8.204
Public IP Address : 35.168.48.97

Aryan Singh CSE VI A 2001330100073


Experiment-10
AIM :- Write a program in java to find the IP address of the any site if name is
given.

// Java program to demonstrate


// how to fetch public IP Address

import java.net.*;

import java.*;

class GFG {

public static void main(String args[])

throws UnknownHostException

String s = "https:// www.google.com/";


try {

InetAddress ip = InetAddress.getByName(new URL(s).getHost());

System.out.println("Public IP Address of: " + ip);

catch (MalformedURLException e) {

// It means the URL is invalid System.out.println("Invalid URL");

Output:
Public IP Address of:
www.google.com/216.58.196.164
Aryan Singh CSE VI A 2001330100073
Aryan Singh CSE VI A 2001330100073

You might also like