DCCN Lab 1-14

Download as pdf or txt
Download as pdf or txt
You are on page 1of 127

Data Communication and Computer Networks

Lab 01
Introduction to Networking Equipment’s
Modem
Modem is a contraction of the terms modulator and demodulator. Modems perform a simple
function: They translate digital signals from a computer into analog signals that can travel
across conventional phone lines. The modem modulates the signal at the sending end and
demodulates at the receiving end.

ADSL Modem
Asymmetric digital subscriber line (ADSL) is a type of digital subscriber line (DSL) technology, a
data communications technology that enables faster data transmission over copper telephone
lines rather than a conventional voiceband modem can provide.

Figure 1-1: PTCL – ADSL Modem

Hubs
Hubs are simple network devices, and their simplicity is reflected in their low cost. Small hubs
with four or five ports (often referred to as workgroup hubs) costs very less, with the requisite
cables, they provide everything needed to create a small network. Hubs with more ports are
available for networks that require greater capacity. Figure 3.1 shows an example of a
workgroup hub, and Figure 1-7 shows an example of the type of hub you might see on a
corporate network.

Figure 1-2: A NETGEAR’s Hub

1|Page
Data Communication and Computer Networks
Switches
On the surface, a switch looks much like a hub. Despite their similar appearance, switches are
far more efficient than hubs and are far more desirable for today’s network environments.
Figure 1-8 shows an example of a 32-port Ethernet switch. If you refer to Figure 1-7, you’ll
notice few differences in the appearance of the high-density hub and this switch. As with a hub,
computers connect to a switch via a length of twisted-pair cable. Multiple switches are often
interconnected to create larger networks. Despite their similarity in appearance and their
identical physical connections to computers, switches offer significant operational advantages
over hubs.
As discussed earlier in this lab, a hub forwards data to all ports, regardless of whether the data
is intended for the system connected to the port. This arrangement is inefficient; however, it
requires little intelligence on the part of the hub, which is why hubs are inexpensive.
Rather than forwarding data to all the connected ports, a switch forwards data only to the port
on which the destination system is connected. It looks at the Media Access Control (MAC)
addresses of the devices connected to it to determine the correct port. A MAC address is a
unique number that is stamped into every NIC. By forwarding data only to the system to which
the data is addressed, the switch decreases the amount of traffic on each network link
dramatically. In effect, the switch literally channels (or switches, if you prefer) data between the
ports.

Figure 1-3: Cisco Switch

Router
A router is a networking device that forwards data packets between computer networks.
Routers perform the traffic directing functions on the Internet. A data packet is typically
forwarded from one router to another router through the networks that constitute the
internetwork until it reaches its destination node. A router is connected to two or more data
lines from different networks. When a data packet comes in on one of the lines, the router
reads the address information in the packet to determine the ultimate destination. Then, using
information in its routing table or routing policy, it directs the packet to the next network on its
journey. This creates an overlay internetwork.

2|Page
Data Communication and Computer Networks

Figure 1-4: Cisco Router

3|Page
Data Communication and Computer Networks

Lab Task 1.1


“Reviewing Questions”
1 – Differentiate between Access Point and Router?

Access Point Router

4|Page
Data Communication and Computer Networks

Lab 02
Building Cables and Introduction to Networking Equipment’s
Objective
In this lab, you will build and test straight-through and crossover Unshielded Twisted-Pair (UTP)
Ethernet network cables along with introduction of basic Networking Equipment’s.

Theory
With a straight-through cable, the color of wire used by pin 1 on one end is the same color used
by pin 1 on the other cable end, and similarly for the remaining seven pins. The cable will be
constructed using either TIA/EIA T568A or T568B standards for Ethernet, which determines the
color wire to be used on each pin. Straight-through patch cables are normally used to connect a
host directly to a hub or switch or to a wall plate in an office area. With a crossover cable the
second and third pairs on the RJ-45 connector at one end of the cable are reversed at the other
end. The pinouts for the cable are the T568A standard on one end and the T568B standard on
the other end. Crossover cables are normally used to connect hubs and switches or can be used
to directly connect two hosts to create a simple network.

Tools Required
 Two 0.6 to 0.9m (2 to 3 ft.) lengths of cable, Category 5 or 5e
 A minimum of four RJ-45 connectors (more may be needed if miss-wiring or breakage
occurs)
 An RJ-45 crimping tool
 Cable Tester
 Wire cutters
 Wire stripper

Wiring Diagrams and Standard

Figure 2-1

5|Page
Data Communication and Computer Networks
Table 2-1
T568A – Standard
Pin Number Pair Number Wire Color Function
1 3 Green – White Transmit
2 3 Green Transmit
3 2 Orange – White Receive
4 1 Blue Not Used
5 1 Blue – White Not Used
6 2 Orange Receive
7 4 Brown – White Not Used
8 4 Brown Not Used

Table 2-2
T568B – Standard
Pin Number Pair Number Wire Color Function
1 2 Orange – White Transmit
2 2 Orange Transmit
3 3 Green – White Receive
4 1 Blue Not Used
5 1 Blue – White Not Used
6 3 Green Receive
7 4 Brown – White Not Used
8 4 Brown Not Used

Building and testing an Ethernet Straight-Through Patch Cable


Step 1: Obtain and prepare the cable
1. Determine the length of cable required. This could be the distance from a computer to a
switch or between a device and an RJ-45 outlet jack. Add at least 30.48 cm (12 in.) to the
distance. The TIA/EIA standard states the maximum length is 5 m (16.4 ft.). Standard
Ethernet cable lengths are usually .6 m (2 ft.), 1.83 m (6 ft.), or 3.05 m (10 ft.).
2. Which length of cable did you choose and how did you measure its length?

6|Page
Data Communication and Computer Networks

Write answer of bullet – 2


here
3. Stranded UTP cable is commonly used for patch cables (the cables between an end network
device such as a PC and an RJ-45 connector) because it is more durable when bent
repeatedly. It is called stranded because each of the wires within the cable is made up of
many strands of fine copper wire, rather than a single solid wire. Solid wire is used for cable
runs that are between the RJ-45 jack and a punch-down block.
4. Using wire strippers, remove 5.08 cm (2 in.) approx. of the cable jacket from both ends of
the cable. As shown in figure 1-2.

Figure 2-2

Step 2: Prepare and insert the wires


1. Determine which wiring standard will be used. Highlight the selected standard.

[ T568A | T568B ]  Highlight anyone.


2. Locate the correct table or figure from the “Wire Diagrams” based on the wiring standard
used.
3. Spread the cable pairs and arrange them roughly in the desired order based on the standard
chosen. As shown in figure 1-3

Figure 2-3

7|Page
Data Communication and Computer Networks
4. Untwist a short length of the pairs and arrange them in the exact order needed by the
standard moving left to right starting with pin 1. It is very important to untwist as little as
possible. The twists are important because they provide noise cancellation.
5. Straighten and flatten the wires between your thumb and forefinger.
6. Ensure the cable wires are still in the correct order as the standard.

Figure 2-4
7. Cut the cable in a straight line to within 1.25 to 1.9 cm (1/2 to 3/4 in.) from the edge of the
cable jacket. If it is longer than this, the cable will be susceptible to crosstalk (the
interference of bits from one wire with an adjacent wire).
8. The key (the prong that sticks out from the RJ-45 connector) should be on the underside
pointing downward when inserting the wires. Ensure the wires are in order from left to right
starting with pin 1.
9. Insert the wires firmly into the RJ-45 connector until all wires are pushed as far as possible
into the connector.

Step 3: Inspect, crimp, and re-inspect


1. Visually inspect the cable and ensure the right color codes are connected to the correct pin
numbers.
2. Visually inspect the end of the connector. The eight wires should be pressed firmly against
the end of the RJ-45 connector. Some of the cable jacket should be inside the first portion
of the connector. This provides strain relief for the cable. If the cable jacket is not far
enough inside the connector, it may eventually cause the cable to fail.
3. If everything is correctly aligned and inserted properly, place the RJ-45 connector and cable
into the crimper. The crimper will push two plungers down on the RJ-45 connector.

Figure 2-5
4. Visually re-inspect the connector. If improperly installed, cut the end off and repeat the
above process.

8|Page
Data Communication and Computer Networks
Step 4: Terminate the Other End of Cable
1. Use the previously described steps to attach an RJ-45 connector to the other end of the
cable.
2. Visually re-inspect the connector. If improperly installed, cut the end off and repeat the
process.
3. Which standard [T568A | T568B] is used for patch cables in our Lab?

Write answer of bullet – 3


here
Step 5: Test the cable
1. Insert Cable in Cable Tester.
2. Check if all lights blinks / ON.
3. If not re-make the cable.

Build and test an Ethernet crossover cable


Step 1: Obtain and prepare the cable
1. Determine the length of cable required. This could be from a hub to a hub, hub to switch,
switch to switch, computer to router, or from one computer to another computer. Add at
least 30.48 cm (12 in.) to the distance. Which length of cable did you choose, why did you
choose this length and how did you measure its length?

Write answer of bullet – 1


here
2. Cut a piece of cable to the desired length and, using wire strippers, remove 5.08 cm (2 in.)
of the cable jacket from both ends of the cable.

Step 2: Prepare and insert the T568A wires


1. Locate the T568A table (Table – 1) at the beginning of the lab.
2. Spread the cable pairs and arrange them roughly in the desired order based on the T568A
standard.
3. Untwist a short length of the pairs and arrange them in the exact order needed by the
standard moving left to right starting with pin 1. It is very important to untwist as little as
possible. Twists are important because they provide noise cancellation.
4. Straighten and flatten the wires between your thumb and forefinger.
5. Ensure the cable wires are in the correct order based on the standard.

9|Page
Data Communication and Computer Networks
6. Cut the cable in a straight line to within 1.25 to 1.9 cm (1/2 to 3/4 in.) from the edge of the
cable jacket. If it is longer than this, the cable will be susceptible to crosstalk (the
interference of bits from one wire with an adjacent wire).
7. The key (the prong that sticks out from the RJ-45 connector) should be on the underside
pointing downward when inserting the wires. Ensure the wires are in order from left to right
starting with pin 1. Insert the wires firmly into the RJ-45 connector until all wires are pushed
as far as possible into the connector.

Step 3: Inspect, crimp, and re-inspect


1. Visually inspect the cable and ensure the right color codes are connected to the correct pin
numbers.
2. Visually inspect the end of the connector. The eight wires should be pressed firmly against
the RJ-45 connector. Some of the cable jacket should be inside the first portion of the
connector. This provides for cable strain relief which can eventually cause the cable to fail.
3. If everything is correctly aligned and inserted properly, place the RJ-45 connector and cable
into the crimper. The crimper will push two plungers down on the RJ-45 connector.
4. Visually re-inspect the connector. If improperly installed, cut the end off and repeat the
process.

Step 5: Test the cable


1. Insert Cable in Cable Tester.
2. Check if all lights blinks / ON.
3. If not re-make the cable.

10 | P a g e
Data Communication and Computer Networks

Lab Task 2.1


“Reviewing Questions”
1 – Differentiate between the use of Straight and Crossover cables

Cross – over
Straight Cable
Cable

2 – Differentiate among CAT – 5, CAT – 5e and CAT – 6 Cables

CAT - 5 CAT – 5e CAT - 6

11 | P a g e
Data Communication and Computer Networks
3 - What is Face – Plate?

Write answer of Q – 3 here

4 - What is Dogger?

Write answer of Q – 4 here

5 - What is Rollover Cable?

Write answer of Q – 5 here

12 | P a g e
Data Communication and Computer Networks

Lab 03
An Introduction to MATLAB and Digital Modulation
Objective
To understand the Digital Modulation with respect to digital data using MATLAB.

Theory
MATLAB, short for MATrix LABoratory is a programming package specifically designed for quick
and easy scientific calculations and I/O. It has literally hundreds of built-in functions for a wide
variety of computations and many toolboxes designed for specific research disciplines,
including statistics, optimization, solution of partial differential equations, data analysis.
MATLAB integrates mathematical computing, visualization, and a powerful language to provide
a flexible environment for technical computing. The open architecture makes it easy to use
MATLAB and its companion products to explore data, create algorithms and create custom
tools, that provide early insights and competitive advantages.

Modulation is the process of superimposing a low-frequency signal on a high-frequency carrier


signal, in detail Modulation is defined as the process by which some characteristics, usually
amplitude, frequency or phase, of a carrier is varied in accordance with instantaneous value of
some other voltage, called the modulating voltage. Modulation allows us to send a signal over a
bandpass frequency range. If every signal gets its own frequency range, then we can transmit
multiple signals simultaneously over a single channel, all using different frequency ranges.
Another reason to modulate a signal is to allow the use of a smaller antenna.

There are two types of modulation, Analog modulation and Digital modulation. The main
difference is that in Digital modulation the modulating signal is digital and in analog modulation
it is analog. Other than that, in digital modulation, at the receiver we are actually interested in
getting back the 1's and 0's and not the original signal whereas in analog modulation we ideally
desire the exact signal waveform which makes analog modulations more sensitive to noise.
Move over, in Analog modulation modulating signals are continuous analog signals like audio,
voice, video etc. and in Digital modulation the modulating signals are discrete 1 and 0s or bit
streams from computing system.

Baseband signal is always analog for this modulation. There are three properties of a carrier
signal amplitude, frequency and phase thus there are three basic types of analog modulations.

 Amplitude Modulation (AM)


 Frequency Modulation (FM)
 Phase modulation (PM)

Digital modulation in somewhat similar to the analog modulation except baseband signal is of
discrete amplitude level. For binary signal, it has only two level, either high or logic 1 or low or
logic 0. The modulation scheme is mainly three types.

13 | P a g e
Data Communication and Computer Networks
 ASK or Amplitude Shift Key
 FSK or Frequency shift key
 PSK or Phase shift key

Lab Task – 3.1


To observe analog modulated waveforms:
1. Run the code for Amplitude Modulation and add screenshot at the end of Lab – 03.
2. Run the code for Frequency Modulation and Phase Modulation also add screen shot at the
end of Lab – 03.
3. Save both codes before running
4. All screen shots must contain your name

14 | P a g e
Data Communication and Computer Networks
figure('Name','DCCN Lab - 03 : Spring 2017 -- < Your
Name>’,'NumberTitle','off')

Ac=input('Enter carrier signal amplitude: ');

Am=input('Enter message signal amplitude: ');

fc=input('Enter carrier frequency: ');

fm=input('Enter message frequency: '); % fm<fc

m=input ('Enter modulation index: ');

t=input ('Enter time period: ');

t1=linspace(0,t,1000);

y1=sin(2*pi*fm*t1); % message signal

Amplitude Modulation (Analog Modulation)


y2=sin(2*pi*fc*t1); % carrier signal

eq=(1+m.*y1).*(Ac.*y2);

subplot(311);

plot(t1,y1);

xlabel('Time');

ylabel('Amplitude');

title('Message signal')

subplot(312)

plot(t1,y2);

xlabel('Time');

ylabel('Amplitude');

title('Carrier signal');

subplot(313);

plot(t1,eq);
15 | P a g e
plot(t1,eq,'r');
Data Communication and Computer Networks

Figure 3 – 1

16 | P a g e
Data Communication and Computer Networks
figure('Name','DCCN Lab - 03 -- Iqbal Uddin
Khan','NumberTitle','off')

t =0:0.001:1;

Frequency and Phase Modulation (Digital Modulation)


Am = input('Enter Message signal Amplitude(AM) = ');

fm = input('Enter Message signal frequency(FM)=');

Wm =2*pi*fm;

m = Am*cos(Wm*t);

subplot(2,2,1);

plot(t,m);

hold on

title('Message Input Signal');

xlabel('Time --->');

ylabel('Amplitude --->')

17 | P a g e
Data Communication and Computer Networks

Ac = input('Enter Carrier Signal Amplitude(Ac) = ');

fc = input('Enter Carrier Signal Frequency(fc)=');

Wc= 2*pi*fc;

c = Ac*cos(Wc*t);

subplot(2,2,2);

plot(t,c);

hold on

title('Carrier Signal');

xlabel('Time --->');

Frequency and Phase Modulation (Digital Modulation)


ylabel('Amplitude --->')

kf = input('Frequency Sensitivity(kf) = ');

s_fm = Ac*cos(Wc*t+2*pi*kf*cumsum(m));

subplot(2,2,3);

plot(t,s_fm);

hold on

title('Frequency Modulated Signal');

xlabel('Time --->');

ylabel('Amplitude --->')

kp = input('Phase Sensitivity = ');


18 | P a g e
s_pm = Ac*cos(Wc*t+m.*kp );
Data Communication and Computer Networks

Figure 3 – 2

Lab Task – 3.2


To observe Digital Modulated waveforms with respected to your Data:
1. Write your first name in the boxes below, use Upper case letters:

I Q B A L

2. Now write hex ASCII Code of each letter:

49 51 42 41 4C

3. Now write binary equivalent of each hex code:

0100100 0111000 0110001 0110000 0110110


1 1 0 1 0

4. Now place binary values in array section of code, remember there should be 1 space
between each element and 2 spaces between each set
5. Figure 3 – 3 is the screen shot of I Q B A L
6. Attach the screenshot containing your name

19 | P a g e
Data Communication and Computer Networks
figure('Name','DCCN Lab - ASK PSK FSK : Spring 2017 -- Iqbal
Uddin Khan','NumberTitle','off')
f=2;
f2=6;

% Below is the array Containing Binary of I Q B A L


x=[0 1 0 0 1 0 0 1 0 1 1 1 0 0 0 1 0 1 1 0 0 0 1 0 0 1 1
0 0 0 0 1 0 1 1 0 1 1 0 0 ];

nx=size(x,2);
S=size(x,2);

i=1;
while i<nx+1
t = i:0.001:i+1;
if x(i)==1
ask=sin(2*pi*f*t);
fsk=sin(2*pi*f2*t);
psk=sin(2*pi*f*t);
else
ask=0;
ASK PSK FSK Demonstration Code
fsk=sin(2*pi*f*t);
psk=sin(2*pi*f*t+pi);
end

subplot(3,1,1);
plot(t,ask);
hold on;
grid on;
axis([1 (S) -1 1]);
title('Amplitude Shift Key --- ASK')
20 | P a g e
Data Communication and Computer Networks

Figure 3 – 3

Lab Task – 3.3


To simulate ASK Modulation using Simulink
1. Run MATLAB, and type simulink in MATLAB Command window
2. A new window will open soon, find all symbols and connect as in figure 3 – 4
3. Open Sine Parameters and set following:
a. Sine Type: Time Based
b. Time (t): Use Simulation Time
c. Amplitude: 1
d. Bias: 0
e. Frequency (Rad / Sec): 1000*/2*3.14
f. Phase (Rad): 0
g. Sample Time: 1/20000
h. Check: Interpret Vector Parameters as 1-D
4. Open Pulse Parameters and set following:
a. Pulse Type: Time Based
b. Time (t): Use Simulation Time
c. Amplitude: 1
d. Period (Number of Samples): 0
e. Pulse Width (Number of Samples): 1000*/2*3.14
f. Pulse Delay (Number of Samples): 0
g. Sample Time: 1/400
h. Check: Interpret Vector Parameters as 1-D
5. Click run icon, double click on every scope to open their output window

21 | P a g e
Data Communication and Computer Networks
6. If wave forms are not visible use X Zoom button in each scope window
7. Attach screen shot of your outputs by each scope

Figure 3 – 4

Lab Task – 3.4


To simulate FSK Modulation using Simulink
1. Run MATLAB, and type simulink in MATLAB Command window
2. A new window will open soon, find all symbols and connect as in figure 3 – 5
3. Open Sine – H Parameters and set following:
a. Sine Type: Time Based
b. Time (t): Use Simulation Time
c. Amplitude: 2
d. Bias: 0
e. Frequency (Rad / Sec): 500
f. Phase (Rad): 0
g. Sample Time: 0.001
h. Check: Interpret Vector Parameters as 1-D
4. Open Pulse Parameters and set following:
a. Pulse Type: Time Based
b. Time (t): Use Simulation Time
c. Amplitude: 2
d. Period (Sec): 2
e. Pulse Width (% of Period): 50
f. Phase Delay (Sec): 0
g. Check: Interpret Vector Parameters as 1-D
5. Open Sine – L Parameters and set following:
a. Sine Type: Time Based
b. Time (t): Use Simulation Time
c. Amplitude: 2
d. Bias: 0

22 | P a g e
Data Communication and Computer Networks
e. Frequency (Rad / Sec): 100
f. Phase (Rad): 0
g. Sample Time: 0.001
h. Check: Interpret Vector Parameters as 1-D
6. Open Switch Parameters and set following:
a. Threshold: 0.1
b. Sample Time: -1
7. Click run icon, double click on every scope to open their output window
8. If wave forms are not visible use X Zoom button in each scope window
9. Attach screen shot of your outputs by each scope

Figure 3 – 5

Lab Task – 3.5


To simulate PSK Modulation using Simulink
1. Run MATLAB, and type simulink in MATLAB Command window
2. A new window will open soon, find all symbols and connect as in figure 3 – 6
3. Open Sine Parameters and set following:
a. Sine Type: Time Based
b. Time (t): Use Simulation Time
c. Amplitude: 2
d. Bias: 0
e. Frequency (Rad / Sec): 1200*2*3.14
f. Phase (Rad): 0
g. Sample Time: 1/20000
h. Check: Interpret Vector Parameters as 1-D
4. Open Signal Generator Parameters and set following:

23 | P a g e
Data Communication and Computer Networks
a. Wave Form: Time Based
b. Time (t): Use Simulation Time
c. Amplitude: 2
d. Frequency: 200
e. Unit: Hertz
f. Check: Interpret Vector Parameters as 1-D

Figure 3 – 6
5. Open Product Parameters and set following:
a. Number of Inputs: 2
b. Multiplication: Element-Wise
c. Sample Time: -1
6. Click run icon, double click on every scope to open their output window
7. If waveforms are not visible use X Zoom button in each scope window
8. Attach screenshot of your outputs by each scope

24 | P a g e
Data Communication and Computer Networks

Lab 04
Demonstration of Amplitude Shift Keying
Objective
To Demonstrate Amplitude Shift Keying Modulation and De-Modulation.

Theory
Amplitude-shift keying (ASK) is a form of amplitude modulation that represents digital data as
variations in the amplitude of a carrier wave. In an ASK system, the binary symbol 1 is
represented by transmitting a fixed-amplitude carrier wave and fixed frequency for a bit
duration of T seconds. If the signal value is 1 then the carrier signal will be transmitted;
otherwise, a signal value of 0 will be transmitted.
Like AM, an ASK is also linear and sensitive to atmospheric noise, distortions, propagation
conditions on different routes in PSTN, etc. Both ASK modulation and demodulation processes
are relatively inexpensive. The ASK technique is also commonly used to transmit digital data
over optical fiber. For LED transmitters, binary 1 is represented by a short pulse of light and
binary 0 by the absence of light. Laser transmitters normally have a fixed "bias" current that
causes the device to emit a low light level. This low level represents binary 0, while a higher-
amplitude light wave represents binary 1. Figure 4-1 demonstrates ASK diagram and Figure 4-2
illustrate MATLB’s ASK Modulation and Demodulation.

Figure 4-1

25 | P a g e
Data Communication and Computer Networks

Figure 4-2

Lab Task – 4.1


To write a code to generate ASKing Modulation and Demodulation of a predefined binary data.

Theory
Generation of ASK
Amplitude shift keying - ASK - is a modulation process, which imparts to a sinusoid two or more
discrete amplitude levels. These are related to the number of levels adopted by the digital
message. For a binary message sequence, there are two levels, one of which is typically zero.
The data rate is a sub-multiple of the carrier frequency. Thus, the modulated waveform consists
of bursts of a sinusoid. One of the disadvantages of ASK, compared with FSK and PSK, for
example, is that it has not got a constant envelope. This makes its processing (e.g., power
amplification) more difficult, since linearity becomes an important factor. However, it does
make for ease of demodulation with an envelope detector.

Demodulation
ASK signal has a well-defined envelope. Thus, it is amenable to demodulation by an envelope
detector. Some sort of decision-making circuitry is necessary for detecting the message. The
signal is recovered by using a correlation and decision making circuitry is used to recover the
binary sequence.

Algorithm
Initialization commands

ASK modulation
1. Start FOR loop

26 | P a g e
Data Communication and Computer Networks
2. Generate binary data, message signal (on-off form)
3. Generate ASK modulated signal.
4. Plot message signal and ASK modulated signal.
5. End FOR loop.
6. Plot the binary data and carrier.

ASK demodulation
1. Start FOR loop
2. Perform correlation of ASK signal with carrier to get decision variable
3. Make decision to get demodulated binary data. If x>0, choose ‘1’ else choose ‘0’
4. Plot the demodulated binary data.

Figure 4-3

27 | P a g e
Data Communication and Computer Networks

Write Task -1 code here

28 | P a g e
Data Communication and Computer Networks

Lab Task – 4.2


To demonstrate ASKing using Simulink
1. Run Simulink
2. Add Modules from libraries, better to search them
3. Connect as shown in figure 4-4
4. Attach screenshot along with your name
5. Double click on Digital Clock, set Sample time to 0.001
6. Double Click on Bernoulli Binary Generator and set following:
I. Probability of Zero: 0.4
II. Initial Seed: 81
III. Sample Time: 05
IV. Output Data type: Double
7. Figure 4-5 shows the output of Modulation / Demodulation circuit
8. Draw Schematics of ASK Modulator and Demodulator at the end of lab

Figure 4-4

29 | P a g e
Data Communication and Computer Networks

Figure 4-5

30 | P a g e
Data Communication and Computer Networks

Draw Schematic of Modulator ASK here

31 | P a g e
Data Communication and Computer Networks

Draw Schematic of Demodulator ASK here

32 | P a g e
Data Communication and Computer Networks

Lab 05
Demonstration of Frequency Shift Keying
Objective
To Demonstrate Frequency Shift Keying Modulation and De-Modulation.

Theory
Frequency-shift keying (FSK) is a frequency modulation scheme in which digital information is
transmitted through discrete frequency changes of a carrier signal. The technology is used for
communication systems such as amateur radio, caller ID and emergency broadcasts. The
simplest FSK is binary FSK (BFSK). BFSK uses a pair of discrete frequencies to transmit binary (0s
and 1s) information. With this scheme, the "1" is called the mark frequency and the "0" is called
the space frequency. The time domain of an FSK modulated carrier is illustrated in the figures to
the right.
Moreover, as its name suggests, a frequency shift keyed transmitter has its frequency shifted by
the message. Although there could be more than two frequencies involved in an FSK signal, in
this experiment the message will be a binary bit stream, and so only two frequencies will be
involved. The word ‘keyed’ suggests that the message is of the ‘on-off’ (mark-space) variety,
such as one (historically) generated by a Morse key, or more likely in the present context, a
binary sequence. The output from such a generator is shown in in Figure 5-1 below.

Figure 5-1
Conceptually, and in fact, the transmitter could consist of two oscillators (on frequencies F 1 and
F2), with only one being connected to the output at any one time. This is illustrated in block

33 | P a g e
Data Communication and Computer Networks
diagram form in Figure 2 on next page. Unless there are special relationships between the two
oscillator frequencies and the bit clock there will be abrupt phase discontinuities of the output
waveform during transitions of the message. There are different methods of demodulating FSK.
A natural classification is into synchronous (coherent) or asynchronous (non-coherent). The
receiver of Figure 5-3 takes advantage of this. The FSK signal has been separated into two parts
by bandpass filters (BPF) tuned to the MARK and SPACE frequencies.

Figure 4-2

Figure 5-3

Lab Task – 5.1


To write a code to generate FSKing Modulation and Demodulation of a predefined binary data.

Theory
Generation of FSK
Frequency-shift keying (FSK) is a frequency modulation scheme in which digital information is
transmitted through discrete frequency changes of a carrier wave. The simplest FSK is binary
FSK (BFSK). BFSK uses a pair of discrete frequencies to transmit binary (0s and 1s) information.
With this scheme, the "1" is called the mark frequency and the "0" is called the space
frequency. In binary FSK system, symbol 1 & 0 are distinguished from each other by
transmitting one of the two sinusoidal waves that differ in frequency by a fixed amount.

Si (t) = √2E /Tb cos 2πf1t 0≤ t ≤Tb

34 | P a g e
Data Communication and Computer Networks
0 Elsewhere
Where i=1, 2 & Eb=Transmitted energy/bit
Transmitted freq= ƒi = (nc + i) /Tb , and n = constant (integer), Tb = bit interval
Symbol 1 is represented by S1 (t)
Symbol 0 is represented by S0 (t)
BFSK Transmitter
The input binary sequence is represented in its ON-OFF form, with symbol 1 represented by
constant amplitude of √Eb with & symbol 0 represented by zero volts. By using inverter in the
lower channel, we in effect make sure that when symbol 1 is at the input, the two frequency f1
& f2 are chosen to be equal integer multiples of the bit rate 1/T b. By summing the upper &
lower channel outputs, we get BFSK signal.

Figure 5-4

BFSK Receiver
The receiver consists of two correlators with common inputs which are supplied with locally
generated coherent reference signals c1(t) and c2 (t). The correlator outputs are then subtracted
one from the other, and the resulting difference x is compared with a threshold of zero volts. If
x >0, the receiver decides in favor of symbol 1 and if x <0, the receiver decides in favor of
symbol 0.

Figure 5-5

35 | P a g e
Data Communication and Computer Networks
Algorithm
Initialization commands

FSK modulation
Generate two carriers signal.
1. Start FOR loop
2. Generate binary data, message signal and inverted message signal
3. Multiply carrier 1 with message signal and carrier 2 with inverted message signal
4. Perform addition to get the FSK modulated signal
5. Plot message signal and FSK modulated signal.
6. End FOR loop.
7. Plot the binary data and carriers.

FSK demodulation
1. Start FOR loop
2. Perform correlation of FSK modulated signal with carrier 1 and carrier 2 to get two decision
variables x1 and x2.
3. Make decision on x = x1-x2 to get demodulated binary data. If x>0, choose ‘1’ else choose
‘0’.
4. Plot the demodulated binary data

Figure 5-6

36 | P a g e
Data Communication and Computer Networks

Write Task -1 code here

37 | P a g e
Data Communication and Computer Networks

Write Task -1 code here

38 | P a g e
Data Communication and Computer Networks

Lab Task – 5.2


To demonstrate FSKing using Simulink
1. Run Simulink
2. Add Modules from libraries, better to search them
3. Connect as shown in figure 5-7
4. Attach screenshot along with your name
5. Double Click on Bernoulli Binary Generator and set following:
I. Probability of Zero: 0.3
II. Initial Seed: 61
III. Sample Time: 05
IV. Output Data type: Double
6. Figure 5-8 shows the output of Modulation / Demodulation circuit
7. Draw Schematics of FSK Modulator, Demodulator, Cancel and Regenerator at the end of lab

Figure 5-7

39 | P a g e
Data Communication and Computer Networks

Figure 5-8

40 | P a g e
Data Communication and Computer Networks

Draw Schematic of Modulator FSK here

41 | P a g e
Data Communication and Computer Networks

Draw Schematic of Demodulator FSK here

42 | P a g e
Data Communication and Computer Networks

Draw Schematic of Canal here

43 | P a g e
Data Communication and Computer Networks

Draw Schematic of Regenerator here

44 | P a g e
Data Communication and Computer Networks

Lab 06
Demonstration of Phase Shift Keying
Objective
To Demonstrate Phase Shift Keying Modulation and De-Modulation.

Theory
Phase-shift keying (PSK) is a digital modulation scheme that conveys data by changing
(modulating) the phase of a reference signal (the carrier wave). The modulation is impressed by
varying the sine and cosine inputs at a precise time. It is widely used for wireless LANs, RFID and
Bluetooth communication.
Any digital modulation scheme uses a finite number of distinct signals to represent digital data.
PSK uses a finite number of phases; each assigned a unique pattern of binary digits. Usually,
each phase encodes an equal number of bits. Each pattern of bits forms the symbol that is
represented by the particular phase. The demodulator, which is designed specifically for the
symbol-set used by the modulator, determines the phase of the received signal and maps it
back to the symbol it represents, thus recovering the original data. This requires the receiver to
be able to compare the phase of the received signal to a reference signal — such a system is
termed coherent (and referred to as CPSK).
Consider a sinusoidal carrier. If it is modulated by a bipolar bit stream according to the scheme
illustrated in Figure 6-1 below, its polarity will be reversed every time the bit stream changes
polarity. This, for a sinewave, is equivalent to a phase reversal (shift). The multiplier output is a
BPSK signal.

Figure 6-1
The information about the bit stream is contained in the changes of phase of the transmitted
signal. A synchronous demodulator would be sensitive to these phase reversals. The
appearance of a BPSK signal in the time domain is shown in Figure 6-2 (middle trace). The upper
trace is the binary message sequence.
Demodulation of a BPSK signal can be considered a two-stage process. One is translation back
to baseband, with recovery of the bandlimited message waveform second is regeneration from

45 | P a g e
Data Communication and Computer Networks
the bandlimited waveform back to the binary message bit stream. Translation back to baseband
requires a local, synchronized carrier.
In stage – 1, Translation back to baseband is achieved with a synchronous demodulator, as
shown in Figure 6-2. This requires a local synchronous carrier. In this experiment a stolen carrier
will be used.
In stage – 2, The translation process does not reproduce the original binary sequence, but a
bandlimited version of it. The original binary sequence can be regenerated with a detector. This
requires information regarding the bit clock rate. If the bit rate is a sub-multiple of the carrier
frequency, then bit clock regeneration is simplified.

Figure 5-2

Figure 6-2

Lab Task – 6.1


To write a code to generate PSKing Modulation and Demodulation of a predefined binary data.

46 | P a g e
Data Communication and Computer Networks

Theory
Generation of PSK
PSK is a digital modulation scheme that conveys data by changing, or modulating, the phase of
a reference signal (the carrier wave). PSK uses a finite number of phases, each assigned a
unique pattern of binary digits. Usually, each phase encodes an equal number of bits. Each
pattern of bits forms the symbol that is represented by the particular phase. The demodulator,
which is designed specifically for the symbol-set used by the modulator, determines the phase
of the received signal and maps it back to the symbol it represents, thus recovering the original
data. In a coherent binary PSK system, the pair of signal S 1(t) and S2 (t) used to represent binary
symbols 1 & 0 are defined by:

 S1 (t) = √2Eb/ Tb Cos 2πfct


 S2 (t) =√2Eb/Tb (2πfct+π) = - √ 2Eb/Tb Cos 2πfct where 0 ≤ t< Tb and
 Eb = Transmitted signed energy for bit
 The carrier frequency fc =n/Tb for some fixed integer n.

Antipodal Signal
The pair of sinusoidal waves that differ only in a relative phase shift of 180° are called antipodal
signals.

BPSK Transmitter

Figure 6-3
The input binary symbols are represented in polar form with symbols 1 & 0 represented by
constant amplitude levels √Eb & -√Eb. This binary wave is multiplied by a sinusoidal carrier in a
product modulator. The result in a BSPK signal.

BSPK Receiver

Figure 6-4

47 | P a g e
Data Communication and Computer Networks
The received BPSK signal is applied to a correlator which is also supplied with a locally
generated reference signal c1 (t). The correlated o/p is compared with a threshold of zero volts.
If x> 0, the receiver decides in favor of symbol 1. If x< 0, it decides in favor of symbol 0.

Algorithm
Initialization commands

PSK modulation
Generate carrier signal.
1. Start FOR loop
2. Generate binary data, message signal in polar form
3. Generate PSK modulated signal.
4. Plot message signal and PSK modulated signal.
5. End FOR loop.
6. Plot the binary data and carrier.

PSK demodulation
1. Start FOR loop
2. Perform correlation of PSK signal with carrier to get decision variable
3. Make decision to get demodulated binary data. If x>0, choose ‘1’ else choose ‘0’
4. Plot the demodulated binary data.

Figure 6-5

48 | P a g e
Data Communication and Computer Networks

Write Task -1 code here

49 | P a g e
Data Communication and Computer Networks

Write Task -1 code here

50 | P a g e
Data Communication and Computer Networks

Lab Task – 6.2


To demonstrate PSKing using Simulink
1. Run Simulink
2. Add Modules from libraries, better to search them
3. Connect as shown in figure 6-7
4. Attach screenshot along with your name
5. Double Click on Bernoulli Binary Generator and set following:
I. Probability of Zero: 0.3
II. Initial Seed: 61
III. Sample Time: 05
IV. Output Data type: Double
6. Double Click on Digital clock and set sample time to 0.001
7. Figure 6-7 shows the output of Modulation / Demodulation circuit
8. Draw Schematics of FSK Modulator and Demodulator at the end of lab

Figure 6-6

51 | P a g e
Data Communication and Computer Networks

Figure 6-7

52 | P a g e
Data Communication and Computer Networks

Draw Schematic of Modulator PSK here

53 | P a g e
Data Communication and Computer Networks

Draw Schematic of Demodulator PSK here

54 | P a g e
Data Communication and Computer Networks

Lab 07
Demonstration of Line Coding
Objective
To Demonstrate Line Coding: RZ, NRZ and Manchester.

Theory
The terminology line coding originated in telephony with the need to transmit digital
information across a copper telephone line; more specifically, binary data over a digital
repeatered line. The concept of line coding, however, readily applies to any transmission line or
channel. In a digital communication system, there exists a known set of symbols to be
transmitted. These can be designated as: {mi}, i = 1, 2, . . ., N, with a probability of occurrence
{pi}, i = 1, 2, . . ., N, where the sequentially transmitted symbols are generally assumed to be
statistically independent. The conversion or coding of these abstract symbols into real,
temporal waveforms to be transmitted in baseband is the process of line coding. Since the
most common type of line coding is for binary data, such a waveform can be succinctly
termed a direct format for serial bits. The concentration in this lab will be line coding for
binary data.

Common Line Coding Formats


A line coding format consists of a formal definition of the line code that specifies how a string of
binary digits are converted to a line code waveform. There are two major classes of binary line
codes: level codes and transition codes. Level codes carry information in their voltage level,
which maybe high or low for a full bit period or part of the bit period. Level codes are usually
instantaneous since they typically encode a binary digit into a distinct waveform, independent
of any past binary data. However, some level codes do exhibit memory. Transition codes carry
information in the change in level appearing in the line code waveform. Transition codes may
be instantaneous, but they generally have memory, using past binary data to dictate the
present waveform. There are two common forms of level line codes: one is called Return to
zero(RZ) and the other is called Non – Return to Zero(NRZ). In RZ coding, the level of the pulse
returns to zero for a portion of the bit interval. In NRZ coding, the level of the pulse is
maintained during the entire bit interval. Line coding formats are further classified according to
the polarity of the voltage levels used to represent the data. If only one polarity of voltage level
is used, i.e., positive or negative (in addition to the zero level) then it is called unipolar signaling.
If both positive and negative voltage levels are being used, with or without a zero-voltage level,
then it is called polar signaling. The term Bi-polar signaling is used by some authors to designate
a specific line coding scheme with positive, negative, and zero voltage levels. This will be
described in detail later in this section. The formal definition of five common line codes is given
in the following along with a representative waveform, the power spectral density (PSD), the
probability of error, and a discussion of advantages and disadvantages. In some cases, specific
applications are noted.

55 | P a g e
Data Communication and Computer Networks
Unipolar NRZ
One" is represented by a DC bias on the transmission line (conventionally positive), while "zero"
is represented by the absence of bias - the line at 0 volts or grounded. For this reason, it is also
known as "on-off keying." In clock language, a "one" transitions to or remains at a biased level
on the trailing clock edge of the previous bit, while "zero" transitions to or remains at no bias
on the trailing clock edge of the previous bit. Among the disadvantages of unipolar NRZ is that it
allows for long series without change, which makes synchronization difficult - although this is
not unique to the unipolar case. One solution is to not send bytes without transitions. More
critically, and unique to unipolar NRZ, are issues related to the presence of a transmitted DC
level - the power spectrum of the transmitted signal does not approach zero at zero frequency.
This leads to two significant problems - first, the transmitted DC power leads to higher power
losses than other encodings and second, the presence of a DC signal component requires that
the transmission line be DC coupled.

Figure 7-1

Unipolar RZ
Unipolar encoding is a line code. A positive voltage represents a binary 1, and zero volts
indicate a binary 0. It is the simplest line code, directly encoding the bit-stream, and is
analogous to on-off keying in modulation. Its drawbacks are that it is not self-clocking and it has
a significant DC component, which can be halved by using return-to-zero, where the signal
returns to zero in the middle of the bit period. With a 50% duty cycle each rectangular pulse is
only at a positive voltage for half of the bit period. This is ideal if one symbol is sent much more
often than the other and power considerations are necessary, and also makes the signal self-
clocking.

56 | P a g e
Data Communication and Computer Networks

Figure 7-2

Manchester
The name comes from its development at the University of Manchester, where the coding was
used to store data on the magnetic drum of the Manchester Mark 1 computer. Manchester
coding is widely used. There are more complex codes, such as 8B/10B encoding, that use less
bandwidth to achieve the same data rate but may be less tolerant of frequency errors and jitter
in the transmitter and receiver reference clocks.
Manchester code always has a transition at the middle of each bit period and may (depending
on the information to be transmitted) have a transition at the start of the period also. The
direction of the mid-bit transition indicates the data. Transitions at the period boundaries do
not carry information. They exist only to place the signal in the correct state to allow the mid-
bit transition. The existence of guaranteed transitions allows the signal to be self-clocking, and
also allows the receiver to align correctly; the receiver can identify if it is misaligned by half a bit
period, as there will no longer always be a transition during each bit period. The price of these
benefits is a doubling of the bandwidth requirement compared to simpler NRZ coding schemes.

57 | P a g e
Data Communication and Computer Networks

Figure 7-3

Lab Task
1. Write a Matlab code to demonstrate wave form of Unipolar RZ, Unipolar NRZ and
Manchester Coding.
2. Write complete code in Code box, also attached screen shots
3. Reference code Unipolar NRZ:
[t,s] = unrz(bits,bitrate);

plot(t,s,'LineWidth',3);

axis([0 t(end) -0.1 1.1])


grid on;

title(['Unipolar NRZ: [' num2str(bits) ']']);

4. Reference code Unipolar RZ:


[t,s] = urz(bits,bitrate);

plot(t,s,'LineWidth',3);

axis([0 t(end) -0.1 1.1])


grid on;

title(['Unipolar RZ: [' num2str(bits) ']']);

58 | P a g e
Data Communication and Computer Networks
5. Reference code Manchester:
figure;

[t,s] = manchester(bits,bitrate);

plot(t,s,'LineWidth',3);

axis([0 t(end) -1.1 1.1])

grid on;

title(['Manchester: [' num2str(bits) ']']);

Figure 7-3

MATLAB Code

59 | P a g e
Data Communication and Computer Networks

MATLAB Code

60 | P a g e
Data Communication and Computer Networks

Lab 08
Demonstration of PCM and PAM
Objective
To get familiar with PCM and PAM using MATLAB.

Theory
Pulse-code modulation (PCM) is a method used to digitally represent sampled analog signals. It
is the standard form of digital audio in computers, compact discs, digital telephony and other
digital audio applications. In a PCM stream, the amplitude of the analog signal is sampled
regularly at uniform intervals, and each sample is quantized to the nearest value within a range
of digital steps. A PCM stream has two basic properties that determine the stream's fidelity to
the original analog signal: the sampling rate, which is the number of times per second that
samples are taken; and the bit depth, which determines the number of possible digital values
that can be used to represent each sample.

Modulation
In the figure 7-1, a sine wave (red curve) is sampled and quantized for PCM. The sine wave is
sampled at regular intervals, shown as vertical lines. For each sample, one of the available
values (on the y-axis) is chosen by some algorithm. This produces a fully discrete representation
of the input signal (blue points) that can be easily encoded as digital data for storage or
manipulation. For the sine wave example at right, we can verify that the quantized values at the
sampling moments are 8, 9, 11, 13, 14, 15, 15, 15, 14, etc. Encoding these values as binary
numbers would result in the following set of nibbles: 1000
(23×1+22×0+21×0+20×0=8+0+0+0=8), 1001, 1011, 1101, 1110, 1111, 1111, 1111, 1110, etc.
These digital values could then be further processed or analyzed by a digital signal processor.
Several PCM streams could also be multiplexed into a larger aggregate data stream, generally
for transmission of multiple streams over a single physical link. One technique is called time-
division multiplexing (TDM) and is widely used, notably in the modern public telephone system.
The PCM process is commonly implemented on a single integrated circuit generally referred to
as an analog-to-digital converter (ADC).

Figure 8-1
Demodulation
To recover the original signal from the sampled data, a "demodulator" can apply the procedure
of modulation in reverse. After each sampling period, the demodulator reads the next value

61 | P a g e
Data Communication and Computer Networks
and shifts the output signal to the new value. As a result of these transitions, the signal has a
significant amount of high-frequency energy caused by aliasing. To remove these undesirable
frequencies and leave the original signal, the demodulator passes the signal through analog
filters that suppress energy outside the expected frequency range (greater than the Nyquist
frequency ⁄ ). The sampling theorem shows PCM devices can operate without introducing
distortions within their designed frequency bands if they provide a sampling frequency twice
that of the input signal. For example, in telephony, the usable voice frequency band ranges
from approximately 300 Hz to 3400 Hz. Therefore, per the Nyquist–Shannon sampling theorem,
the sampling frequency (8 kHz) must be at least twice the voice frequency (4 kHz) for effective
reconstruction of the voice signal. The electronics involved in producing an accurate analog
signal from the discrete data are similar to those used for generating the digital signal. These
devices are Digital-to-analog converters (DACs). They produce a voltage or current (depending
on type) that represents the value presented on their digital inputs. This output would then
generally be filtered and amplified for use.
Pulse-amplitude modulation (PAM), is a form of signal modulation where the message
information is encoded in the amplitude of a series of signal pulse. It is an analog pulse
modulation scheme in which the amplitudes of a train of carrier pulses are varied according to
the sample value of the message signal. Demodulation is performed by detecting the amplitude
level of the carrier at every single period. Principle of PAM: (1) original signal, (2) PAM signal, (a)
amplitude of signal, (b) time.

Figure 8-2
Lab Task – 8.1
Simulating PCM
In this simulation, we will quantize a sinewave signal (message) and encode it to binary bits. We
will reconstruct the sine wave from binary bits. We will also calculate the SQNR for the 8-level
and 16-level quantization. For the simulation, generate a sinusoidal signal with amplitude 1,
and co=l. Using a uniform PCM scheme, quantize it once to 8 levels and once to 16 levels. Plot
the original signal and the quantized signals on the same axis. Compare the resulting SQNRs in
the two cases.
We arbitrarily choose the duration of the signal to be 10s. The resulting SQNRs are 18.90 dB for
the 8-level PCM and 25.13 dB for 16-level PCM, compare these values with the results that you
get from your simulation. The plots are shown in figure 8-3. A sinusoidal signal before and after

62 | P a g e
Data Communication and Computer Networks
quantization. You can compare this figure 7-2 with your simulation results. A zoomed portion of
this figure is given in the following figure 7-4.

Figure 8-3

MATLAB functions required


Length, abs, max, round, log10, dec2bin, plot, grid, title, X label, Y label, Subplot, Figure

Simulation procedure
The following procedure only gives you an idea of how the PCM modulation and de-modulation
are performed. Actual implementation may vary.
1. Construct a time array from 0 to 10 Sec with 0.1 intervals. Name it ‘t’.
2. Find the size of the array t. Use ‘length’ function. Name the size ‘m’.
3. Construct signal array ‘a’. Signal is a sinewave with unity amplitude and angular frequency.
4. Assign the number of quantization level n equal to 8.
5. Calculate, amax = max (abs (a)). See figure 8-3.
6. Calculate the following as shown in figure 8-3.
b = a + amax
c = (n-1) x (b/(2amax))
d = round(c)
a_quan = 2 x amax.d/(n-l) – amax
a_error = a-a_quan

63 | P a g e
Data Communication and Computer Networks

Figure 8-4
7. Calculate

8. Calculate Signal to noise ratio,


SQNR=10 log 10(S/N)
9. Calculate binary coding to corresponding quantized value using dec2 bin function.
10. Repeat 4-9 with quantization level n=16.
11. Plot the input signal and quantized signal as in Figure 8-3. Use black solid line for signal, red
solid line for 8 levels quantized and blue solid line for 16 level quantized signals. Use ‘figure’
function for multiple figures (you have to plot another figure in step 12).
12. Plot your variables a, b, c, d, a_quant and a_error for quantization level 8. Show your plots
exactly as shown in the Figure 8-4 in a single template. Use ‘subplot’ function for that.
13. Compare the two quantized signals. Which is more close to input signal?
14. Tabulate few sample binary codes for both cases.
15. Reconstruct the original sinewave from the binary codes (both) using the MATLAB function
‘bin2dec’. How is it different from the original signal?

Lab Task – 8.2


In pulse amplitude modulation, the amplitude of individual pulses in the pulse train is varied
from its default value in accordance with the instantaneous amplitude of the modulating signal
at sampling intervals. The width and position of the pulses is kept constant. In the figure 8-2
first graph represents the PAM.

64 | P a g e
Data Communication and Computer Networks
1. Connect all modules as in figure 8-5 and start running
2. Attach screen shots of your outputs
3. What type of waveform appears at scope?
4. Set the simulation parameters (Simulation -> Configuration Parameters) as follows:
 Start time to 0.0
 Stop time to 100.0
 Type to Variable-step
 Solver to discrete (no continuous states)
 Max. step size to auto

Figure 8-5
Remember, available of options might vary from version to version.

65 | P a g e
Data Communication and Computer Networks

Lab 09
Introduction to Basic Network Commands
Objective
To get familiar eight most used networking command.

Theory
There are a lot of IP commands with short descriptions listed here but you should only need the
ones mentioned here at the top of the page to diagnose and configure your network.

1 – HOSTNAME
This is the simplest of all TCP/IP commands. It simply displays the name of your computer.

Write the result of hostname


2 – IPCONFIG
The ipconfig command displays information about the host (the computer your sitting at)
computer TCP/IP configuration.

Write the result of ipconfig

3 – PING
Ping is the most basic TCP/IP command, and it’s the same as placing a phone call to your best
friend. You pick up your telephone and dial a number, expecting your best friend to reply with
“Hello” on the other end. Computers make phone calls to each other over a network by using a
Ping command.

66 | P a g e
Data Communication and Computer Networks

Write the result of ping www.google.com

4 – NETSTAT
Netstat displays a variety of statistics about a computers active TCP/IP connections. This tool is
most useful when you’re having trouble with TCP/IP applications such as HTTP, and FTP.

Write the result of netstat

5 – TRACERT
The tracert command displays a list of all the routers that a packet has to go through to get
from the computer where tracert is run to any other computer on the internet.

67 | P a g e
Data Communication and Computer Networks

Write the result of tracert www.google.com

6 – PATHPING
Pathping is unique to Window’s, and is basically a combination of the Ping and Tracert
commands. Pathping traces the route to the destination address then launches a 25-second
test of each router along the way, gathering statistics on the rate of data loss along each hop.

68 | P a g e
Data Communication and Computer Networks

Write the result of pathping www.google.com

7 – NSLOOKUP
Nslookup is used for diagnosing DNS problems. If you can access a resource by specifying an IP
address but not its DNS, you have a DNS problem.

Write the result of nslookup www.google.com

69 | P a g e
Data Communication and Computer Networks

8 – ARP
ARP is short for address resolution protocol, it will show the IP address of your computer along
with the IP address and MAC address of your router.

Write the result of arp -a

Lab Task – 9.1


1. Perform all above commands by adding <complete command> >>
<command>.txt and attach printout of every result along with you name and CMS-ID.
2. List down LINUX version of each commands discussed above.

HOSTNAME

IPCONFIG

PING

NETSTAT

TRACERT

PATHPING

NSLOOKUP

ARP

70 | P a g e
Data Communication and Computer Networks

Lab 10
Introduction to Routers and IOSs
Objective
To introduce Cisco Routers and their IOSs.

Theory
What is a router?
Routers are devices whose primary purpose is to connect two or more networks and to filter
network signals so that only desired information travels between them. For example, routers
are often used to regulate the flow of information between school networks and the Internet.
However, routers can inspect a good deal more information than bridges, and they therefore
can regulate network traffic more precisely. They also have another important capability: they
are aware of many possible paths across the network and can choose the best one for each
data packet to travel.

Routers operate primarily by examining incoming data for its network routing and transport
information—for example, information carried within the TCP/IP portions of the network signal.
This information includes the source and destination network routing addresses.
Routers can be programmed to prevent information from being sent to or received from certain
networks or computers based on all or part of their network routing addresses. If you have
sensitive student records on a server, for example, you can use a router to filter packets headed
for the server so that only authorized personnel for example, personnel whose network
addresses match a specified list can connect to it.

71 | P a g e
Data Communication and Computer Networks

Figure 10-1

Chassis overview of a Cisco Router


This section contains views of the front and back panels of the Cisco 2900 series routers,
showing locations of the power and signal interfaces, module slots, status indicators, and
chassis identification labels.
Routers support the following slot types: Service Modules (SMs), Enhanced High-Speed
Interface Card (EHWICs), High-speed WAN Interface cards (HWICs), Voice WAN interface cards
(VWICs), WAN interface cards (WICs), Internal Services Modules (ISMs), and Packet Voice DSP
Modules (PVDM3s).

Front Panel of the Cisco 2901 Router

Figure 10-2

72 | P a g e
Data Communication and Computer Networks
1. System – LED
2. Activity – LED
3. Power Over Ethernet (POE) – LED
4. AC / Active Power Cord Connected – LED
5. AC Power Switch
6. AC Power Socket
Back Panel Slots and Connectors of the Cisco 2901 Router

Figure 10-3
1. DW-EHWICs can fit into slot 0 and 1, and into slot 2 and 3. EHWIC slots support HWIC, VIC,
and WIC.
2. Universal Serial Bus (USB)
3. Auxiliary Port
4. RJ-45 serial console port
5. 10/100/1000 Ethernet ports (GE0/1)
6. 10/100/1000 Ethernet ports (GE0/0)
7. Earth / Ground Screw
8. USB0 and USB1
9. Compact Flash 0 and 1, Only Advanced Capability CompactFlash (CF)

73 | P a g e
Data Communication and Computer Networks
Back Panel LEDs of Cisco 2901 Router

Figure 10-4
1. CompactFlash 0 and 1
2. Internal Services Module (ISM)
3. PVDM3 0 and 1
4. Enable USB Console (EN)
5. Enable RJ-45 Console (EN)
6. Speed (S)
7. Link (L)

Lab Task– 10.1


Follow the below steps:

1. Connect the rollover cable between router and your PC.


2. Start Putty (serial connectivity tool), check related COM port and set baud rate to 9600.
3. Stat router and wait for it till its prompt appear: router>
4. Run the following commands and answer in their respective cells of table 10-1.

74 | P a g e
Data Communication and Computer Networks

Figure 10-5

1 - show version

To display the configuration of the system hardware, the software version, the names and
sources of configuration files, and the boot images, use the show version EXEC command.

Table 10-1

S. No Required Details Details Appeared

1 System Version

2 ROM Version

3 Time Elapsed Since Last Boot

4 Shared Memory

5 Main Memory

6 Recognized Hardware

75 | P a g e
Data Communication and Computer Networks
2 – show interfaces

Use the show interfaces EXEC command to display statistics for all interfaces configured on the
router or access server. The resulting output varies, depending on the network for which an
interface has been configured.

Table 10-2

S. No Required Details Details Appeared

1 Interface(s) Status

2 Slot(s) Available

3 Input Drops and Why?

4 Output Drops and Why?

5 Queuing Algorithm

6 Number of Interfaces Reset

3 – show logging

Use the show logging EXEC command to display the state of logging (syslog). This command
displays the state of syslog error and event logging, including host addresses, and whether
console logging is enabled. This command also displays Simple Network Management Protocol
(SNMP) configuration parameters and protocol activity.

Table 10-3

S. No Required Details Details Appeared

1 Messages Dropped

2 XML Status

3 Logging Exception size (MB)

76 | P a g e
Data Communication and Computer Networks
4 – show running-config

To display the configuration information currently running on the terminal, use the show
running-config EXEC command.

Table 10-4

S. No Required Details Details Appeared

1 Ethernet interface(s) Status

5 – show buffer
To display statistics for the buffer pools on the network server, use the show buffers EXEC
command.

Table10-5

S. No Required Details Details Appeared

1 Buffer Elements in Free List

2 Buffer Bytes FastEthernet0/0

3 Buffer Bytes FastEthernet0/1

6 - show process cpu


The show processes CPU command displays detailed CPU utilization statistics about the active
processes.

77 | P a g e
Data Communication and Computer Networks
Table10-6

S. No Process Name PID

1 AAA Server

2 IP Traceroute

3 ICMP Event Handler

4 SNMP Timer

5 TCP Timer

6 TCP Protocol

7 – conf t
To enter global configuration mode, use configure privileged EXEC command. T (terminal) will
executes configuration commands from the terminal. After typing conf t the following will
appear:
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#
Invoking interface Fast Ethernet 0/0
Now type int f 0/0, following will appear on your console window:
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#
Now you are ready to set IP of interface f0/0

8 – ip add
To set a primary or secondary IP address for an interface, use the IP address interface
configuration command. To remove an IP address or disable IP processing, use the no form of
this command. An interface can have one primary IP address and multiple secondary IP
addresses. Packets generated by the Cisco IOS software always use the primary IP address.
Therefore, all routers and access servers on a segment should share the same primary network
number.
Setting IP address of Fast Ethernet 0/0
Type the ip add 10.0.0.1 255.255.255.0 press enter and type no shutdown (to power UP the
interface) and following will appear:
R1(config-if)#ip add 10.0.0.1 255.255.255.0
R1(config-if)#no shutdown

78 | P a g e
Data Communication and Computer Networks
R1(config-if)#
*Mar 1 00:12:05.443: %LINK-3-UPDOWN: Interface FastEthernet0/0,
changed state to up
*Mar 1 00:12:06.443: %LINEPROTO-5-UPDOWN: Line protocol on
Interface FastEthernet0/0, changed state to up
R1(config-if)#
To exit from Interface configuration mode type exit.
R1(config-if)#exit
R1(config)#

9 – router rip

To configure the Routing Information Protocol (RIP) routing process, use the router rip global
configuration command. To turn off the RIP routing process, use the no form of this command.
Type router rip to enter in router configuration mode:
R1(config)#router rip
R1(config-router)#

10 – auto summary
To restore the default behavior of automatic summarization of subnet routes into network-
level routes, use the auto-summary router configuration command. To disable this feature and
transmit sub prefix routing information across classful network boundaries, use the no form of
this command. RIP Version 1 always uses automatic summarization. If you are using RIP Version
2, you can turn off automatic summarization by specifying no auto-summary. Disable automatic
summarization if you must perform routing between disconnected subnets. When automatic
summarization is off, subnets are advertised.

Setting RIP Version and Inserting a Network in RIP


Type no auto-summary and hit enter, set RIP version by typing version 2 and hit enter. Enter
network in RIP by typing network name 10.0.0.0 and press enter. First exit to exit from router
configuration mode than second exit to return from global configuration mode.

R1(config-router)#no auto-summary
R1(config-router)#version 2
R1(config-router)#net 10.0.0.0
R1(config-router)#exit
R1(config)#exit
R1#

11 - ping
Now ping our interface f0/0 having IP 10.0.0.1, the following will appear:
R1#ping 10.0.0.1

Type escape sequence to abort.

79 | P a g e
Data Communication and Computer Networks
Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2
seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max =
1/1/1 ms
R1#
Now your f0/0 is configured and that ends the Lab Task – 1.

Lab Task– 10.2


Copy running IOs to PC
To Copy running IOS of a router you must have a running TFTP server on PC, SolarWinds is a
common TFTP too.
Note:
SolarWinds require Dot Net 3.5 when running and Windows’ Firewall should be turned
OFF.
Follow the following steps:
1. Connect a ethernet cable to your PC’s preconfigured LAN card
2. Make sure rollover cable is already connected to serial port
3. Start SolarWinds (TFTP Server)
4. Run PUTTY and then power on the router with working IOS
5. Set IP at any Ethernet port of working router, for reference is dump in figure 10-6
6. After setting IP on any one Ethernet port, check the available IOS in your flash, see dump in
figure 10-6
7. Type copy flash: tftp: at enable mode, if it will be successful you will find IOS in
TFTP-Root folder in your PC.

80 | P a g e
Data Communication and Computer Networks
%% ---- Configuring Ethernet port

iqbal# conf t

Enter configuration commands, one per line. End with CNTL/Z.

iqbal(config)# int e0

iqbal(config-if)# ip address 192.168.1.4 255.255.255.0

iqbal(config-if)# no sh

iqbal(config-if)# exit

%% ---- Checking available image in Flash

iqbal(config)# tftp-server flash:?

flash:c806-o3sy6-mz.122-4.YH.bin

iqbal(config)#exit

iqbal#

%% ---- Copying image to TFTP-Root folder in connected PC

iqbal# copy flash: tftp:

Source filename [c806-o3sy6-mz.122-4.YH.bin]? c806-o3sy6-mz.122-


4.YH.bin

Address or name of remote host []? 192.168.1.3

Destination filename [c806-o3sy6-mz.122-4.YH.bin]?

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

81 | P a g e
Data Communication and Computer Networks
!!!!!!!!!!!!!!!!!!!!!!!!!!

3900220 bytes copied in 27.56 secs (144452 bytes/sec)

iqbal#

Figure 10-6

82 | P a g e
Data Communication and Computer Networks

Lab Task -10.2 (Extension)


Copying IOS in a router (Stuck in ROMMON mode)
Follow the following steps:
1. Connect rollover cable to console port to serial of router
2. Connect Ethernet cable from pre-configured PC’s LAN port to first port of Router (e.g. F0/0
or E0)
3. Copy downloaded IOS image in TFTP_Root folder and start TPTP server on your PC
4. Start PUTTY, wait for rommon> mode
5. Configure all below variables, for reference see figure 10-1, remember they are case
sensitive
IP_ADDRESS= < IP address for first LAN port >
IP_SUBNET_MASK= < Net Mask for used IP scheme >
DEFAULT_GATEWAY= < Gateway of selected scheme >
TFTP_SERVER= < IP of PC, running TFTP server, should be on same network
/subnet >
TFTP_FILE= < Complete name of IOS image in TFTP-Root folder to be copied in
router >
6. Check the inserted values, type set at rommon > mode, for reference check figure 9-10

83 | P a g e
Data Communication and Computer Networks
rommon 1 > set

PS1=rommon ! >

?=0

RET_2_RTS=

BSI=0

rommon 2 > IP_ADDRESS=192.168.1.4

rommon 3 > IP_SUBNET_MASK=255.255.255.0

rommon 4 > DEFAULT_GATEWAY=192.168.1.1

rommon 5 > TFTP_SERVER=192.168.1.3

rommon 6 > TFTP_FILE=c806.bin

rommon 7 > tftpdnld

IP_ADDRESS: 192.168.1.4

IP_SUBNET_MASK: 255.255.255.0

DEFAULT_GATEWAY: 192.168.1.1

TFTP_SERVER: 192.168.1.3

TFTP_FILE: c806.bin

Invoke this command for disaster recovery only.

WARNING: all existing data in all partitions on flash will be lost!

Do you wish to continue? y/n: [n]: y

Receiving c806.bin from 192.168.1.3


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

File reception completed.

Copying file c806.bin to flash.

Erasing flash ..............................................

Programming flash ..............................................

rommon 8 > reset▒

Figure 10-10

84 | P a g e
Data Communication and Computer Networks

Lab 11
To Understand IPv4, Sub Netting and VLSM
Objective
To make understanding of Sub netting, Static IP, DHCP and VLSM.

Theory
IP Addressing
An IP address uniquely identifies a device on an IP network. Allocating, recycling, and
documenting IP addresses and subnets in a network can get confusing very quickly if you have
not laid out an IP addressing plan. A sound plan will help you prepare the network foundation
to support additional services such as unified communications, wireless access, and enhanced
network security. IP addressing is a Network Foundation service, which makes it core to the
network design. It provides the base for all other network and user services.
IP version 4 (IPv4) addresses, which uniquely identify a device on an IP network, are 32 bits in
length and are typically communicated in a format known as dotted decimal.
The 32 binary bits are:

 Divided into a network portion and host portion


 Broken into four octets (1 octet = 8 bits). Each octet can be converted to binary.
Consider this IP address, which is presented in dotted decimal: 10.10.16.1. The address breaks
down into the following octets:

 10
 10
 16
 1
The value in each octet ranges from 0 to 255 decimals, or 00000000 – 11111111 binaries. In
binary, the address 10.10.16.1 is represented as: 00001010 .0001010 .0010000 .0000001.

IP Address Classes
IP addresses are split up into several different categories, including Class A, B, C, D (Multicast),
and E (Reserved). Address classes are defined, in part, based on the number of bits that make
up the network portion of the address, and in turn, on how many are left for the definition of
individual host addresses.

 In Class A addresses, the first octet is the network portion.


 In Class B, the first two octets are the network portion.
 In Class C, the first 3 octets are the network portion.
Figure 11-1 shows how the network and host IDs are different for each class of IP addresses
(Classful address).

85 | P a g e
Data Communication and Computer Networks
Sub-netting
Sub-netting allows you to create multiple logical networks that exist within a single Class A, B,
or C network. If you do not subnet, you can only use one network from your Class A, B, or C
network, which is simply unrealistic. Each data link on a network must have a unique network
address, with every host on that link being a member of the same network.

Figure 11-1
If you break a major network (Class A, B, or C) into smaller subnetworks, you can create a
network of interconnected subnetworks. Each data link on this network would then have a
unique network/subnetwork ID. To subnet a network, extend the mask using some of the bits
from the host ID portion of the address to create a subnetwork ID. For example: Given a
network of 192.168.5.0/24, which has a mask of 255.255.255.0, you can create subnets in this
manner:
192.168.5.0 -
11000000.10101000.00000101.00000000
255.255.255.224 -
11111111.11111111.11111111.11100000
--------------------------------------------[sub]-----
-
The address on the left is in dotted decimal notation, and the binary representation is on the
right. When planning IP sub-netting, sometimes it is easier to visualize the different portions of
the network address when looking at the binary format. The subnet mask is also represented in

86 | P a g e
Data Communication and Computer Networks
dotted decimal and binary. Any address bits that have corresponding mask bits set to 1
represent the network ID. Any address bits that have corresponding mask bits set to 0
represent the host ID.
By extending the mask to be 255.255.255.224, you’ve taken three bits (indicated by sub) from
the original host portion of the address and used them to make subnets. With these three bits,
you can create eight subnets. With the remaining five host ID bits, each subnet can have up to
32 host addresses. A single subnet can be split up into eight 32-host subnets. Eight 32-host
subnets, however, may not be flexible enough. For example:
192.168.5.0 255.255.255.224 address range 0 to 31
192.168.5.32 255.255.255.224 address range 32 to 63

192.168.5.224 255.255.255.224 address range 224 to 255

87 | P a g e
Data Communication and Computer Networks
Technical Tip
There are two ways to denote subnet masks:
1. Since you are using three bits more than the originally specified 255.255.255.0 mask, the
mask is now 255.255.255.224.
2. The mask can also be denoted as /27 as there are 27 bits that are set in the mask. The mask
is denoted with the notation prefix/length. For example: 192.168.5.32/27 denotes the
network 192.168.5.32 with a mask of 255.255.255.224.

Variable Length Subnet Masks


Variable Length Subnet Masks (VLSMs) allow you to use different masks for each subnet, and
thereby use address space efficiently. With private address space, it is rarely necessary to shrink
below a /24 subnet mask as space is plentiful. Use VLSM to:

 Create a larger subnet of more than 255 host addresses


 Create very small subnets for WAN links
 Configure loopback addresses

VLSM Example
Given the 192.168.5.0/24 network and requirements below, develop a sub-netting scheme with
the use of VLSM:
1. Network_A must support 330 hosts
2. Network_B must support 6 hosts for a point-to-point WAN link supporting Hot Standby
Router Protocol
3. Network_C must support 2 hosts for a T1 circuit to a remote site
4. Network_D must support a single address for a router loopback
The first step is to determine what mask allows the required number of hosts.
1. Network_A requires a /23 (255.255.254.0) mask to support 510 hosts
2. Network_B requires a /29 (255.255.255.248) mask to support 6 hosts
3. Network_C requires a /30 (255.255.255.252) mask to support 2 hosts
4. Network_D requires a /32 (255.255.255.255) mask to support 1 address
The easiest way to assign the subnets is to assign the largest first. For example: You can assign
the subnets in this manner:
1. Network_A — 192.168.5.0/23 address range 5.0 to 6.255
2. Network_B — 192.168.7.0/28 address range 0 to 7
3. Network_C — 192.168.7.8/28 address range 8 to 11
4. Network_D — 192.168.7.12/32 address of 12

Lab Task – 11.1


Task – 1A
Determine IPv4 Address Sub-netting, in this part you will determine the network and broadcast
addresses, as well as the number of hosts, given an IPv4 address and subnet mask. Determine

88 | P a g e
Data Communication and Computer Networks
the network and broadcast addresses and number of host bits and hosts for the given IPv4
addresses and prefixes in the table 11 – 1.
Table 11 – 1
Total Total
IPv4 Broadcast
Network Address Number of Number of
Address/Prefix Address
Host Bits Hosts

192.168.100.25/28

172.30.10.130/30

10.1.113.75/19

198.133.219.250/24

128.107.14.191/22

172.16.104.99/27

Task – 1B
It consists of 05 problems along with a reference problem, following are IPv4 address, the
original subnet mask and the new subnet mask, you will be able to determine:
1. Network address of this subnet
2. Broadcast address of this subnet
3. Range of host addresses of this subnet
4. Number of subnets created
5. Number of hosts per subnet

Reference Problem
The table 10-2, shows a problem along with the solution for solving problem:
Table 10-2
Given

Host IP Address: 172.16.77.120

Original Subnet Mask 255.255.0.0

New Subnet Mask: 255.255.240.0

Find

Number of Subnet Bits 4

89 | P a g e
Data Communication and Computer Networks

Number of Subnets Created 16

Number of Host Bits per Subnet 12

Number of Hosts per Subnet 4,094

Network Address of this Subnet 172.16.64.0

IPv4 Address of First Host on this Subnet 172.16.64.1

IPv4 Address of Last Host on this Subnet 172.16.79.254

IPv4 Broadcast Address on this Subnet 172.16.79.255

How problem is solved?


The original subnet mask was 255.255.0.0 or /16. The new subnet mask is 255.255.240.0 or /20.
The resulting difference is 4 bits. Because 4 bits were borrowed, we can determine that 16
subnets were created because 24 = 16. The new mask of 255.255.240.0 or /20 leaves 12 bits for
hosts. With 12 bits left for hosts, we use the following formula: 212 = 4,096 – 2 = 4,094 hosts per
subnet. Binary ANDing will help you determine the subnet for this problem, which results in the
network 172.16.64.0.
Finally, you need to determine the first host, last host, and broadcast address for each subnet.
One method to determine the host range is to use binary math for the host portion of the
address. In above example, the last 12 bits of the address is the host portion. The first host
would have all significant bits set to zero and the least significant bit set to 1. The last host
would have all significant bits set to 1 and the least significant bit set to 0. In this example, the
host portion of the address resides in the 3rd and 4th octets.

Description 1st Octet 2nd Octet 3rd Octet 4th Octet Description

Network/Host nnnnnnnn nnnnnnnn nnnnhhhh hhhhhhhh Subnet Mask

Binary 10101100 00010000 01000000 00000001 First Host

Decimal 172 16 64 1 First Host

Binary 10101100 00010000 01001111 11111110 Last Host

Decimal 172 16 79 254 Last Host

Binary 10101100 00010000 01001111 11111111 Broadcast

Decimal 172 16 79 255 Broadcast

90 | P a g e
Data Communication and Computer Networks
Fill out the next tables with appropriate answers given the IPv4 address, original subnet mask,
and new subnet mask.

Problem – 1
Given

Host IP Address: 192.168.200.139

Original Subnet Mask 255.255.255.0

New Subnet Mask: 255.255.255.224

Find

Number of Subnet Bits

Number of Subnets Created

Number of Host Bits per Subnet

Number of Hosts per Subnet

Network Address of this Subnet

IPv4 Address of First Host on this Subnet

IPv4 Address of Last Host on this Subnet

IPv4 Broadcast Address on this Subnet

Problem – 2
Given

Host IP Address: 10.101.99.228

Original Subnet Mask 255.0.0.0

New Subnet Mask: 255.128.0.0

Find

Number of Subnet Bits

Number of Subnets Created

Number of Host Bits per Subnet

91 | P a g e
Data Communication and Computer Networks

Number of Hosts per Subnet

Network Address of this Subnet

IPv4 Address of First Host on this Subnet

IPv4 Address of Last Host on this Subnet

IPv4 Broadcast Address on this Subnet

Problem – 3
Given

Host IP Address: 172.22.32.12

Original Subnet Mask 255.255.0.0

New Subnet Mask: 255.255.224.0

Find

Number of Subnet Bits

Number of Subnets Created

Number of Host Bits per Subnet

Number of Hosts per Subnet

Network Address of this Subnet

IPv4 Address of First Host on this Subnet

IPv4 Address of Last Host on this Subnet

IPv4 Broadcast Address on this Subnet

Continued to next page

92 | P a g e
Data Communication and Computer Networks
Problem – 4
Given

Host IP Address: 192.168.1.245

Original Subnet Mask 255.255.255.0

New Subnet Mask: 255.255.255.252

Find

Number of Subnet Bits

Number of Subnets Created

Number of Host Bits per Subnet

Number of Hosts per Subnet

Network Address of this Subnet

IPv4 Address of First Host on this Subnet

IPv4 Address of Last Host on this Subnet

IPv4 Broadcast Address on this Subnet

Problem – 5
Given

Host IP Address: 128.107.0.55

Original Subnet Mask 255.255.0.0

New Subnet Mask: 255.255.255.0

Find

Number of Subnet Bits

Number of Subnets Created

Number of Host Bits per Subnet

Number of Hosts per Subnet

Network Address of this Subnet

93 | P a g e
Data Communication and Computer Networks

IPv4 Address of First Host on this Subnet

IPv4 Address of Last Host on this Subnet

IPv4 Broadcast Address on this Subnet

Lab Task – 11.2


Assigning Static IP to following scenario, steps to follow:
1. Connect two Routers (1700 /2600 / 2800) via serial cable as shown in figure 11 – 2
2. Connect Console Cable to Router_1
3. Configure its serial Interface IP and add entry in RIP
4. Repeat step 2 and 3, for Router_2
5. Now ping Router_1 interface from Router_2 and vice versa
6. Ping Should be successful
7. Write your configuration steps in below given boxes

Figure 11-2

Steps of Router_1

94 | P a g e
Data Communication and Computer Networks

Steps of Router_2

Lab Task – 11.3


Configuring Basic DHCPv4 on a Router, follow the steps below (you may also use Simulator):
1. Create topology as shown in figure 11-3
2. Configure Router_1 for DHCP, see dump in figure 11-4
3. Set each workstation on DHCP, if using Virtual PC Simulator type ip dhcp in its console
4. After completing all configuration ping Worstatio_2 from Workstation_1 and vice versa
5. Write dump of ping of each workstation on respective boxes on next page

Figure 11-3

95 | P a g e
Data Communication and Computer Networks
Router_1(config)#int f0/0

Router_1(config-if)#ip add 10.0.1.1 255.255.255.0

Router_1(config-if)#no sh

Router_1(config-if)#

Router_1(config)#ip dhcp pool Router_1

Router_1(dhcp-config)#network 10.0.1.0 255.255.255.0

Router_1(dhcp-config)#default-router 10.0.1.1

Router_1(dhcp-config)#exit

Router_1(config)#int f0/1

Router_1(config-if)#ip add 10.0.2.1 255.255.255.0

Router_1(config-if)#no sh

Router_1(config-if)#

Router_1(config-if)#exit

Router_1(config)#ip dhcp pool Router_1

Router_1(dhcp-config)#network 10.0.2.0 255.255.255.0

Router_1(dhcp-config)#default-router 10.0.2.1

Router_1(dhcp-config)#exit

Router_1(config)#router rip

Router_1(config-router)#version 2

Router_1(config-router)#no auto-summary

Router_1(config-router)#net 10.0.1.0

Router_1(config-router)#net 10.0.2.0

Router_1(config-router)#exit

Router_1(config)#exit

Figure 11-4

96 | P a g e
Data Communication and Computer Networks

Ping dump of Workstation_2

Ping dump of Workstation_2

Lab Task– 11.4


Create an addressing scheme using variable length subnet masking (VLSM)

Scenario
The assignment is the Class B address 172.28.10.0 and it must support the network shown
in the figure 10-5. The use of IP unnumbered or NAT is not permitted on this network. Create
an addressing scheme that meets the said requirements. Fill the boxes for appropriate
answering.

97 | P a g e
Data Communication and Computer Networks

Figure 11-5

Sub-netting

IP and Sub net assigning on Serial Links


Serial Link 1

Serial Link 2

98 | P a g e
Data Communication and Computer Networks

Serial Link 3

IP and Sub net assigning on Ethernet Links


Ethernet 1

Ethernet 2

Ethernet 3

Ethernet 4

99 | P a g e
Data Communication and Computer Networks

Lab 12
To Understand Configuration of Static Routing
Objective
To make understanding of Configuring Static Routing and Cisco Discovery Protocol.

Theory
Routing is at the core of every data network, moving information across an internetwork from
source to destination. Routers are the devices responsible for the transfer of packets from one
network to the next. Static routes are very common and do not require the same amount of
processing and overhead as dynamic routing protocols.
Static routing table is created, maintained, and updated by a network administrator, manually.
A static route to every network must be configured on every router for full connectivity. This
provides a granular level of control over routing, but quickly becomes impractical on large
networks. Routers will not share static routes with each other, thus reducing CPU/RAM
overhead and saving bandwidth. However, static routing is not fault-tolerant, as any change to
the routing infrastructure (such as a link going down, or a new network added) requires manual
intervention. Routers operating in a purely static environment cannot seamlessly choose a
better route if a link becomes unavailable. Static routes have an Administrative Distance (AD) of
1, and thus are always preferred over dynamic routes, unless the default AD is changed.
Most hosts use static routing to configure their default route. Keeping static routing tables
entries consistent on routers is tedious, even in networks with a small number of routers.
Therefore, most routers run a routing protocol that automatically updates routing tables to
reflect changes of the network topology. Static routing entries can be added, even if a router
runs a routing protocol, however, static routes may interfere with the path calculation
determined by a routing protocol. When static routing entries are entered manually at a
command line interface, they remain valid only until the operating system is rebooted. To
ensure that static routing table entries remain valid after the operating system is rebooted,
commands to add static routes must be written in a configuration file, such as the startup
configuration file in IOS. Certain routing table entries are automatically configured. For
example, whenever a network interface is configured with an IP address, most operating
systems automatically add a routing table entry for the IP network to which the interface is
directly connected.

Note:
Do not confuse routing protocols with routed protocols:

 A routed protocol is a Layer 3 protocol that applies logical addresses to devices and routes
data between networks (such as IP).
 A routing protocol dynamically builds the network, topology, and next hop information in
routing tables (such as RIP, EIGRP, etc.)

100 | P a g e
Data Communication and Computer Networks
Advantages
1. Minimal CPU/Memory overhead
2. No bandwidth overhead (updates are not shared between routers)
3. Granular control on how traffic is routed

Disadvantages
1. Infrastructure changes must be manually adjusted
2. No “dynamic” fault tolerance if a link goes down
3. Impractical on large network

Cisco Discovery Protocol


Cisco Discovery Protocol (CDP) is a proprietary protocol designed by Cisco to help
administrators collect information about both locally attached and remote devices. By using
CDP, you can gather hardware and protocol information about neighbor devices, which is useful
info for troubleshooting the network. CDP messages are generated every 60 seconds as
multicast messages on each of its active interfaces. The information shared in a CDP packet
about a Cisco device includes the following:

 Name of the device configured with the hostname command


 IOS software version
 Hardware capabilities, such as routing, switching, and/or bridging
 Hardware platform, such as 2600, 2950, or 1900
 The layer-3 address(es) of the device
 The interface the CDP update was generated on
CDP allows devices to share basic configuration information without even configuring any
protocol specific information and is enabled by default on all interfaces. CDP is a Datalink
Protocol occurring at Layer 2 of the OSI model. CDP is not routable and can only go over to
directly connected devices. CDP is enabled, by default, on all Cisco devices. CDP updates are
generated as multicasts every 60 seconds with a hold-down period of 180 seconds for a missing
neighbor. With CDP, network management applications can learn the device type and the
SNMP agent address of neighboring devices. This feature enables applications to send SNMP
queries to neighboring devices. CDP runs on all LAN and WAN media that support Subnetwork
Access Protocol (SNAP). Each CDP-configured device sends periodic messages to a multicast
address. Each device advertises at least one address at which it can receive SNMP messages.
The advertisements also contain the time-to-live, or hold time information, which indicates the
length of time a receiving device should hold CDP information before discarding it.

Lab Task– 12.1


Configure static routes between routers to allow data transfer between routers without the use
of
dynamic routing protocols. Follow the steps below:
1. Create the topology as shown in figure 12-1
2. Configure PCs and Routers as mentioned
3. Now ping PC2 from PC1 and vice versa, write replies in respective boxes below

101 | P a g e
Data Communication and Computer Networks

Reply from PC2

Reply from PC1

Figure 12-1
4. Now run sh ip route on each router

Output of Router_HIET

102 | P a g e
Data Communication and Computer Networks

Output of Router_HCMD

5. Now add static routes on each router


a) Router_HIET:

HIET (config)# 10.0.16.0 255.255.255.0 10.0.15.2

b) Router_HCMD:

HCMD (config)# 10.0.14.0 255.255.255.0 10.0.15.1

6. Now repeat step 3, was ping successful? ________.


7. Repeat step 4, what difference you see? Write observed difference of any router in the box
below.

Write difference

Lab Task – 12.2


As you know, CDP discovers and shows information about directly connected Cisco devices,
including routers and switches. CDP is a Cisco proprietary protocol that runs at the data link
layer of the OSI model. The data link layer is Layer 2 of the OSI model. This allows devices that
may be running different network Layer 3 protocols, such as IP or IPX, to learn about each
other. CDP begins automatically upon a device system startup. CDP may be enabled globally
using the cdp run command. It may be enabled on any interface as required using the cdp
enable command. CDP is enabled on all interfaces by default. Using the command show
cdp interface gathers the information that CDP uses for its advertisement and discovery
frame transmission. Use show cdp neighbors and show cdp neighbors detail
to display the CDP updates received on the local router.

Steps to follow:

1. Set topology as shown in figure 12-2

103 | P a g e
Data Communication and Computer Networks
2. Configure each device as mentioned, do not type no sh on any interface of each router
3. Now type sh interfaces on ROUTER_HIET and fill table 12 – 1 below
4. Now enable all interfaces on each router and fill table 12 – 2 on next page

Table 12 – 1
Interface Name Up / Down Line protocol Up / Down

Figure 12-2

104 | P a g e
Data Communication and Computer Networks
Table 12 – 2
Interface Name Up / Down Line protocol Up / Down

5. Enter command show cdp interface, in Router_HIET and answer below:


a) How often is the router sending CDP packets? ___________
b) What is the hold time value? ___________
6. Enter show cdp neighbors command in Router_HIET prompt and fill the table 12 - 3:

Table 12 – 2
Device and Port
Local Interface Hold Time Capability Platform
ID

7. Enter show cdp neighbors detail in Router_HCMD and fill table 12-3 below

Table 12 – 3
Information Gathered Router_HCMD

Neighbor device name

Neighbor device type

Interface attached to your router

Port ID of your router that the neighbor is on

105 | P a g e
Data Communication and Computer Networks
Port ID of neighbor router that your router is
on

IOS version of neighbor router

8. Enter debug cdp packets command in Router_HCMD, write output of command in


below box
If nothing appears, wait for 2 – 3 minutes

Write output of cdp packets

9. Enter show cdp traffic command in Router_HCMD, write output of command in


below box

106 | P a g e
Data Communication and Computer Networks

Write output of show cdp traffic

107 | P a g e
Data Communication and Computer Networks

Lab 13
To Understand Configuration of Dynamic Routing
Objective
To make understanding of Configuring RIP, RIP v2, EIGRP and OSPF.

Theory
The role of a router and a host are very different when it comes to routing. A host is only
responsible for maintaining a routing table, it is a silent/passive observer of the routing process.
A host listens to routing messages that are broadcast on the local subnet (e.g. router
advertisements) to fill in the necessary entries in its routing tables. A router on the other hand,
is responsible for:
1. Identifying neighbors (other routers)
2. Discovering routes (from other routers)
3. Selecting a route (next hop to a destination)
4. Maintaining routing information (dynamically participating in router message exchanges)
Depending on where a router falls in the Autonomous System (AS), it may be responsible for
only interior routing (e.g., a router inside an AS), only exterior routing (e.g., a router in a
backbone WAN) or maybe both (e.g., a gateway router, one interface is interior whereas the
other is exterior). The most common dynamic routing protocols use very different algorithms
for path determination. The distance vector based routing algorithms exchange information
only with its immediate neighbors and uses that to make hop by hop routing decisions, the link
state based algorithm exchanges full state information with all the nodes in a specified area,
the path vector.

RIP (Routing Information Protocol)


RIP is a standardized Distance Vector protocol, designed for use on smaller networks. RIP was
one of the first true Distance Vector routing protocols and is supported on a wide variety of
systems. RIP adheres to the following Distance Vector characteristics:

 RIP sends out periodic routing updates (every 30 seconds)


 RIP sends out the full routing table every periodic update
 RIP uses a form of distance as its metric (in this case, hop count)
 RIP uses the Bellman-Ford Distance Vector algorithm to determine the best “path” to a
particular destination
Other characteristics of RIP include:

 RIP supports IP and IPX routing


 RIP utilizes UDP port 520
 RIP routes have an administrative distance of 120
 RIP has a maximum hop count of 15 hops.

108 | P a g e
Data Communication and Computer Networks
Any network that is 16 hops away or more is considered unreachable to RIP, thus the maximum
diameter of the network is 15 hops. A metric of 16 hops in RIP is considered a poison route or
infinity metric. If multiple paths exist to a particular destination, RIP will load balance between
those paths (by default, up to 4) only if the metric (hop count) is equal. RIP uses a round-robin
system of load-balancing between equal metric routes, which can lead to pinhole congestion.
For example, two paths might exist to a particular destination, one going through a 9600-baud
link, the other via a T1. If the metric (hop count) is equal, RIP will load-balance, sending an
equal amount of traffic down the 9600-baud link and the T1. This will (obviously) cause the
slower link to become congested. We can control the version of RIP a particular interface will
“send” or “receive.” Unless RIPv2 is manually specified, a Cisco will default to RIPv1 when
configuring RIP.

RIP Versions
RIP has two versions, Version 1 (RIPv1) and Version2 (RIPv2).

RIPv1
RIPv1 (RFC 1058) is classful, and thus does not include the subnet mask with its routing table
updates. Because of this, RIPv1 does not support Variable Length Subnet Masks (VLSMs). When
using RIPv1, networks must be contiguous, and subnets of a major network must be configured
with identical subnet masks. Otherwise, route table inconsistencies (or worse) will occur.
RIPv1 sends updates as broadcasts to address 255.255.255.255.

RIPv2
RIPv2 (RFC 2543) is classless, and thus does include the subnet mask with its routing table
updates. RIPv2 fully supports VLSMs, allowing dis-contiguous networks and varying subnet
masks to exist.
Other enhancements offered by RIPv2 include:

 Routing updates are sent via multicast, using address 224.0.0.9


 Encrypted authentication can be configured between RIPv2 routers
 Route tagging is supported
RIPv2 can interoperate with RIPv1. By default:

 RIPv1 routers will sent only Version 1 packets


 RIPv1 routers will receive both Version 1 and 2 updates
 RIPv2 routers will both send and receive only Version 2 updates

Lab Task – 13.1


Configuring RIP
1. Create the topology as shown in figure 13-1
2. Configure PCs and Routers as mentioned
3. Now ping PC2 from PC1 and vice versa, was ping successful from either side? ___________
4. Run sh ip route on each router, write output in boxes below

109 | P a g e
Data Communication and Computer Networks

Output of HIET# s hip route

Output of HCMD# sh ip route

5. Now add network in RIP, as following


A. Router_HIET
HIET(config)#router rip
HIET(config-router)#net 10.0.14.0
HIET(config-router)#net 10.0.15.0
HIET(config-router)#exit
HIET(config)#exit
B. Router_HCMD
HCMD(config)#router rip
HCMD(config-router)#net 10.0.15.0
HCMD(config-router)#net 10.0.16.0
HCMD(config-router)#exit
HCMD(config)#exit
6. Run sh ip route on each router, write output in boxes below, highlight the change in
output

Output of HIET# s hip route

110 | P a g e
Data Communication and Computer Networks

Output of HCMD# sh ip route

7. Now ping PC2 from PC1 and vice versa, was ping successful from either side? ___________

Enable RIP v2 routing


Following is continued from above, follow steps:
8. Change RIP to RIPv2
A. Router_HIET
HIET(config)#router rip
HIET(config-router)#version 2
HIET(config-router)#end
B. Router_HCMD
HCMD(config)#router rip
HCMD(config-router)#version 2
HCMD(config-router)#end
9. Change subnet of 10.0.14.0 from 255.255.255.0 to 255.255.255.240
A. Router_HIET
HIET(config)#int f0/0
HIET(config-router)#ip add 10.0.14.1 255.255.255.240
HIET(config-router)#end
B. PC1 (Following steps are for simulation only using VPCS)
PC1> ip 10.0.14.2 255.255.255.240 10.0.14.1
10. Run sh ip route on each router, write output in boxes below, highlight the changes in
output

111 | P a g e
Data Communication and Computer Networks

Output of HIET# sh ip route

Output of HCMD# sh ip route

Figure 13-1

Lab Task – 13.2


A Brief Introduction
EIGRP is an enhanced version of IGRP developed by Cisco. Unlike RIP, EIGRP does not send out
periodic route updates. EIGRP updates are sent out only when the network topology changes.
Key capabilities that distinguish EIGRP from other routing protocols include fast convergence,
support for variable-length subnet mask, support for partial updates, and support for multiple
network layer protocols.
A router running EIGRP stores all the neighbor routing tables so that it can quickly adapt to
alternate routes. If no appropriate route exists, EIGRP queries its neighbors to discover an

112 | P a g e
Data Communication and Computer Networks
alternate route. These queries propagate until an alternate route is found. Its support for
variable-length subnet masks permits routes to be automatically summarized on a network
number boundary. In addition, EIGRP can be configured to summarize on any bit boundary at
any interface.

Figure 13-2
Configuring EIGRP
1. Create topology as illustrated in n figure 13-2
2. Configure PCs and Routers as mentioned
3. Now ping PC2 from PC1 and vice versa, was ping successful from either side? ___________
4. Now configure EIGRP on each router as following:
A. Router_HIET
HIET(config)#ip host HCMD 10.0.15.2 10.0.15.1
HIET(config)#router eigrp 101
HIET(config-router)#net 10.0.14.0
HIET(config-router)#net 10.0.15.0
HIET(config-router)#net 10.0.0.0
HIET(config-router)#exit
B. Router_HCMD
HCMD(config)#ip host HIET 10.0.15.1 10.0.15.2
HCMD(config)#router eigrp 101
HCMD(config-router)#net 10.0.15.0
HCMD(config-router)#net 10.0.16.0
HCMD(config-router)#exit
5. Type sh ip route on each router and write its output in the boxes on next page

6. Are there any EIGRP entries in the routing table now? ____________

7. What is the address type in the EIGRP 192.168.2.0 route? ________________________

8. What does the D mean in the first column of the routing table? _____________________

113 | P a g e
Data Communication and Computer Networks
9. Now type show ip eigrp topology all-links on each router and write output
in it relevant boxes

Output of HIET# sh ip route

Output of HCMD# sh ip route

HIET# show ip eigrp topology


all-links

114 | P a g e
Data Communication and Computer Networks

HCMD# show ip eigrp topology


all-links

Lab Task 13 – 3
A Brief Introduction
Open Shortest Path First (OSPF) was developed by the Internet Engineering Task Force (IETF) as
a replacement to overcome the shortcomings of RIP in RFC 2328. Unlike the Cisco proprietary
protocol EIGRP which was developed by Cisco to replace RIPv2, OSPF is vendor independent
and is the most used routing protocol by enterprise networks today. So, we have to give a
special attention on it as a network engineer. Let’s look at a detailed theoretical and practical
approach to OSPF.
Open Shortest Path First (OSPF), based on Dijkstra’s algorithm, generates link-state packets that
contain local information for each router. Each router exchanges local and external link state
information and generates a shortest path tree. Each router uses this exact topology to
calculate the shortest path to each destination. Recalculation occurs only if there are any
changes.

OSPF Advantages
 It is the highest-performance open standard routing protocol.
 It is a classless routing protocol.
 It provides shortest path routing and is fast to fault-discovery and rerouting.
 It consumes minimal link overhead when the network is in steady state.
 It has been endorsed by the IETF and implemented by many vendors.

OSPF Disadvantages
 It demands a higher processing and memory requirement than RIP.
 It consumes a large bandwidth at the initial link-state packet flooding.

115 | P a g e
Data Communication and Computer Networks
Configuring OSPF (Simulation)

Figure 13-3

Configuring OSPF
1. Create topology as illustrated in n figure 13-3
2. Configure PCs and Routers as mentioned
3. Now ping PC2 from PC3 and vice versa, was ping successful from either side? ___________
4. Now ping PC1 from PC3 and vice versa, was ping successful from either side? ___________
5. Now ping PC1 from PC2 and vice versa, was ping successful from either side? ___________
6. Now configure OSPF on each router as following:
A. Router_FEST
FEST(config)#router ospf 100
FEST(config-router)#net 10.0.11.0 0.0.0.255 area 0
FEST(config-router)#net 10.0.1.0 0.0.0.255 area 0
FEST(config-router)#net 10.0.3.0 0.0.0.255 area 0
FEST(config-router)#exit
B. Router_HCMD

116 | P a g e
Data Communication and Computer Networks
HCMD(config)#router ospf 210
HCMD(config-router)#net 10.0.12.0 0.0.0.255 area 0
HCMD(config-router)#net 10.0.2.0 0.0.0.255 area 0
HCMD(config-router)#net 10.0.1.0 0.0.0.255 area 0
HCMD(config-router)#exit
C. Router_FEM
EM(config)#router ospf 220
FEM(config-router)#network 10.0.3.0 0.0.0.255 area 0
FEM(config-router)#network 10.0.2.0 0.0.0.255 area 0
FEM(config-router)#network 10.0.13.0 0.0.0.255 area 0
FEM(config-router)#exit
7. Now type sh ip route on each router, write down the output at each router

Output of FEST# sh ip route

Output of HCMD# sh ip route

117 | P a g e
Data Communication and Computer Networks

Output of FEM# sh ip route

8. What is the IP assigned to FEST_PC1? ________________________________


9. What is the IP assigned to HCMD_PC1? ________________________________
10. What is the IP assigned to FEM_PC1? ________________________________
11. Now ping PC2 from PC3 and vice versa, was ping successful from either side? ___________
12. Now ping PC1 from PC3 and vice versa, was ping successful from either side? ___________
13. Now ping PC1 from PC2 and vice versa, was ping successful from either side? ___________
14. Why now Ping to each network interface is successful? Write answer in below box.

Answer of bullet 14

118 | P a g e
Data Communication and Computer Networks

Lab 14
To analyze the working of HTTP (Application Layer)
Objective
To analyze the working HTTP GET/response and CONDITIONAL GET/response interactions using
WireShark packet analyzer.

WireShark
Introduction
Wireshark is a network packet analyzer. A network packet analyzer will try to capture network
packets and tries to display that packet data as detailed as possible. You could think of a
network packet analyzer as a measuring device used to examine what’s going on inside a
network cable, just like a voltmeter is used by an electrician to examine what’s going on 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, all that has changed. It
is perhaps one of the best open source packet analyzers available today.
It can capture traffic from many different network media types - and despite its name including
wireless LAN as well. Which media types are supported, depends on many things like the
operating system you are using.
As Wireshark runs on many different platforms with many different window managers,
different styles applied and there are different versions of the underlying GUI toolkit used, your
screen might look different from the provided screenshots. But as there are no real differences
in functionality these screenshots should still be well understandable.

Screen Layout (GUI)


Wireshark’s main window consists of parts that are commonly known from many other GUI
programs.

119 | P a g e
Data Communication and Computer Networks
1
2 3

6
7

Figure 14-1

1. The menu
Wireshark’s main menu is located either at the top of the main window (Windows, Linux) or at
the top of your main screen (OS X). An example is shown in Figure 0-5. It is used to start actions.

2. The Main Toolbar


The main toolbar provides quick access to frequently used items from the menu. This toolbar
cannot be customized by the user, but it can be hidden using the View menu, if the space on
the screen is needed to show even more packet data. As in the menu, only the items useful in
the current program state will be available. The others will be greyed out (e.g. you cannot save
a capture file if you haven’t loaded one). It also provides quick access to frequently used items
from the menu.
3. The Filter Toolbar
The filter toolbar lets you quickly edit and apply display filters. Wireshark has two filtering
languages: One used when capturing packets, and one used when displaying packets. Display
filters allow you to concentrate on the packets you are interested in while hiding the currently
uninteresting ones. They allow you to select packets by:

 Protocol
 The presence of a field

120 | P a g e
Data Communication and Computer Networks
 The values of fields
 A comparison between fields
4. The Packet List Pane
The packet list pane displays all the packets in the current capture file. Each line in the packet
list corresponds to one packet in the capture file. If you select a line in this pane, more details
will be displayed in the “Packet Details” and “Packet Bytes” panes. While dissecting a packet,
Wireshark will place information from the protocol dissectors into the columns. As higher level
protocols might overwrite information from lower levels, you will typically see the information
from the highest possible level only.
For example, let’s look at a packet containing TCP inside IP inside an Ethernet packet. The
Ethernet dissector will write its data (such as the Ethernet addresses), the IP dissector will
overwrite this by its own (such as the IP addresses) and the TCP dissector will overwrite the IP
information, and so on.

Figure 14-2

5. The Packet Details Pane


This pane shows the protocols and protocol fields of the packet selected in the “Packet List”
pane. The protocols and fields of the packet shown in a tree which can be expanded and
collapsed.
6. The Packet Bytes Pane
The “Packet Bytes” pane shows a canonical hex dump of the packet data. Each line contains the
data offset, sixteen hexadecimal bytes, and sixteen ASCII bytes. Non-printable bytes are
replaced with a period (‘.’). Depending on the packet data, sometimes more than one page is
available, e.g. when Wireshark has reassembled some packets into a single chunk of data.
7. The Status Bar
The status bar displays informational messages. In general, the left side will show context
related information, the middle part will show information about the current capture file, and
the right side will show the selected configuration profile. Drag the handles between the text
areas to change the size.

121 | P a g e
Data Communication and Computer Networks

(HTTP) Hypertext Transfer Protocol


Theory
The Hypertext Transfer Protocol (HTTP), the Web's application-layer protocol, is at the heart of
the Web. HTTP is implemented in two programs: a client program and server program. The
client program and server programs, executing on different end systems, talk to each other by
exchanging HTTP messages. HTTP defines the structure of these messages and how the client
and server exchange the messages. Before explaining HTTP in detail, it is useful to review some
Web terminology.
HTTP defines how Web clients (i.e., browsers) request Web pages from servers (i.e., Web
servers) and how servers transfer Web pages to clients. We will observe the interaction
between client and server in detail below, but the general idea is illustrated in Figure 7-1. When
a user requests a Web page (e.g., clicks on a hyperlink), the browser sends HTTP request
messages for the objects in the page to the server. The server receives the requests and
responds with HTTP response messages that contain the objects. Through 1997 essentially all
browsers and Web servers implement version HTTP/1.0. Beginning in 1998 Web servers and
browsers began to implement version HTTP/1.1. HTTP/1.1 is backward compatible with
HTTP/1.0; a Web server running 1.1 can "talk" with a browser running 1.0, and a browser
running 1.1 can "talk" with a server running 1.0.

HTTP Request

HTTP Response
Windows’ PC

Web Server
HTTP Request

Android Phone HTTP Response

HTTP Request

HTTP Response
LINUX based PC

Figure14-3

In this lab, we’ll explore several aspects of the HTTP protocol: the basic GET/response
interaction, HTTP message formats and retrieving large HTML files.

122 | P a g e
Data Communication and Computer Networks

Lab Task – 14.1


The Basic HTTP GET/response interaction.
1. Start up your web browser.
2. Start up the Wireshark. Enter “http” (without quotation marks) in the display-filter-
specification window, so that only captured HTTP messages will be displayed later in the
packet-listing window. (As we are only interested in the HTTP protocol here, and don’t
want to see the other all captured packets).
3. For safe side clear all cache of your browser. Make sure Cache is checked wile deleting
recent history.
4. Wait a bit more than one minute, select interface and then begin Wireshark packet capture.
5. Enter the following to your browser:
http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file1.html
6. Your browser should display the very simple, one-line HTML file.
7. Stop Wireshark packet capture.
8. Attach captured HTTP packet with lab manual.

Your capture traces should be similar as screen shot below:

Figure 14-4
Now answer the following by analyzing the packets you have captured.
1. Is your browser running HTTP version 1.0 or 1.1? What version of HTTP is the server
running?

Answer of Bullet - 1

2. What is the IP addresses and port number of your computer and gaia.cs.umass.edu server?

123 | P a g e
Data Communication and Computer Networks

Answer of Bullet – 2 – Your PC

Answer of Bullet – 2 – gaia.cs.umass.edu

3. What is the status code returned from the server to your browser?

Answer of Bullet - 3

4. When the HTML file that you are retrieving was last modified at the server?

Answer of Bullet - 4

5. How many bytes of content are being returned to your browser?

Answer of Bullet - 5

Lab Task – 14.2


The HTTP CONDITIONAL GET/response interaction
1. Start up your web browser.
2. Start up the Wireshark. Set HTTP filter.
3. For safe side clear all cache of your browser. Make sure Cache is checked wile deleting
recent history.
4. Wait a bit more than one minute, select interface and then begin Wireshark packet capture.
5. Enter the following to your browser:
6. http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file2.html
7. Your browser should display a very simple five-line HTML file.
8. No refresh the page or enter the above URL again.
9. Stop Wireshark packet capture.
10. Attach captured HTTP packet with lab manual.

Your capture traces should be similar as screen shot below:

124 | P a g e
Data Communication and Computer Networks

Figure 14-5

Now answer the following by analyzing the packets you have captured.
1. Inspect the contents of the first HTTP GET request from your browser to the server. Do you
see an “IF-MODIFIED-SINCE” line in the HTTP GET?

Answer of Bullet - 1

2. Inspect the contents of the server response. Did the server explicitly return the contents of
the file? How can you tell?

Answer of Bullet - 2

3. Now inspect the contents of the second HTTP GET request from your browser to the server.
Do you see an “IF-MODIFIED-SINCE:” line in the HTTP GET? If so, what information follows
the “IF-MODIFIED-SINCE:” header?

Answer of Bullet - 3

What is the HTTP status code and phrase returned from the server in response to this second
HTTP GET? Did the server explicitly return the contents of the file? Explain.

125 | P a g e
Data Communication and Computer Networks

Answer of Bullet - 4

Lab Task – 14.3


Retrieving excessive text File using HTTP
In our last two tasks, the documents retrieved have been simple and short HTML files. Let’s see
what happens when we download a long HTML file. Do the following:

1. Start up your web browser, and make sure your browser’s cache is cleared, as discussed
above.
2. Start up the Wireshark packet sniffer and set HTTP filter
3. Enter the following URL into your browser
http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file3.html
4. Your browser should display the rather lengthy US Bill of Rights.
5. Stop Wireshark packet capture.
In the packet-listing window, you should see your HTTP GET message, might be followed by a
multiple-packet TCP response to your HTTP GET request. Analyze the packet and answer the
following:
1. How many HTTP GET request messages did your browser send? Which packet number in
the trace contains the GET message for the Bill or Rights? Why?

Answer of Bullet - 1

2. Which packet number in the trace contains the status code and phrase associated with the
response to the HTTP GET request?

Answer of Bullet - 2

3. What is the status code and phrase in the response?

Answer of Bullet - 3

126 | P a g e
Data Communication and Computer Networks
4. How many data-containing TCP segments were needed to carry the single HTTP response
and the text of the Bill of Rights?

Answer of Bullet - 4

Lab Task – 14.4


Retrieving HTML Documents with Embedded Objects

1. Follow the same procedure.


2. URL is: http://gaia.cs.umass.edu/wireshark-labs/HTTP-wireshark-file4.html
Answer the following:
How many HTTP GET request messages did your browser send? To which Internet addresses
were these GET requests sent? Can you tell whether your browser downloaded the two images
serially, or whether they were downloaded from the two web sites in parallel? Explain.

Answer for task – 4

127 | P a g e

You might also like