You are on page 1of 81

COMPUTER LABORATORY MANUAL

Computer Networks
(EE – 353)
Fall -2022

DEPARTMENT OF COMPUTER SOFTWARE ENGINEERING


Military College of Signals
National University of Sciences and Technology
www.mcs.nust.edu.pk

1 Computer Networks Lab Manual


PREFACE
This lab manual has been prepared to facilitate the students of software engineering in studying and analysing various
functions of a computer network. You will have to plan the IP address scheme, configure and test the several network
devices. You will also learn the socket programming to build a network application. The manual describe how network
can be established using Java codes among different machines. Client Server applications are also developed. Different
tools are used to monitor network traffic and analyse packets. The lab sessions are designed to improve the abilities of the
students by giving hands on experience. After completing the laboratory exercises, you should be familiar with the
practical issues of the different concepts explained in the course, as well as with the real equipment used nowadays in
computer networks

PREPARED BY
Lab manual is prepared by Asst Prof. Bilal Rauf and Demonstrator Kabeer Ahmed under the supervision of Head of
Department Dr. Naveed Iqbal Rao in year 2014.

GENERAL INSTRUCTIONS
a. Students are required to maintain the lab manual with them till the end of the semester.
b. All readings, answers to questions and illustrations must be solved on the place provided. If more space is required
then additional sheets may be attached. You may add screen print to the report by using the ‘Print Screen’ command
on your keyboard to get a snapshot of the displayed output.
c. It is the responsibility of the student to have the manual graded before deadlines as given by the instructor
d. Loss of manual will result in re submission of the complete manual.
e. Students are required to go through the experiment before coming to the lab session. Lab session details will be given
in training schedule.
f. Students must bring the manual in each lab.
g. Keep the manual neat clean and presentable.
h. Plagiarism is strictly forbidden. No credit will be given if a lab session is plagiarised and no re submission will be
entertained.
i. Marks will be deducted for late submission.
j. In the exercises, you have to put the output in your Lab report.
k. Name your reports using the following convention:
Lab#_Rank_YourFullName
(1) ‘#’ replaces the lab number.
(2) ‘Rank’ replaces Maj/Capt/TC/NC/PC
(3) ‘YourFullName’ replaces your complete name.
l. You need to submit the report even if you have demonstrated the exercises to the lab engineer/instructor or shown
them the lab report during the lab session.

VERSION HISTORY
Date Update By Details
July 2013 AP Bilal Rauf First Version Created
Demo Kabeer Ahmed
Aug 2014 AP Bilal Rauf Second Version Created
Demo Kabeer Ahmed
Aug 2016 AP Bilal Rauf Third Version Created
Demo Kabeer Ahmed
Aug 2017 AP Bilal Rauf Forth Version Created
Demo Kabeer Ahmed
Feb 2021 AP Bilal Rauf Fifth Version Created, updated Exercises.
Demo Kabeer Ahmed
Feb 2022 Demo Kabeer Ahmed Lab Rubrics updated.

2 Computer Networks Lab Manual


COURSE LEVEL OUTCOMES

Course Outcomes:

Course Learning Outcomes (CLOs)


At the end of the course the students will be able to: PLOs BT Level*
1. Explain the layered Architecture of Computer Networks 1 C-2
2. Investigate and analyse the behaviour of network traffic 4 C-4
3. Apply the knowledge of computer networking to understand
2 C-3
contemporary networking issues
4. Produce solutions as per contemporary networking issues 5 P-3
Mapping of CLOs to Program Learning Outcomes
PLOs/CLOs CLO1 CLO2 CLO3 CLO4
PLO 1 (Engineering Knowledge) √
PLO 2 (Problem Analysis) √
PLO 3 (Design/Development of Solutions)
PLO 4 (Investigation) √
PLO 5 (Modern tool usage) √
PLO 6 (The Engineer and Society)
PLO 7 (Environment and Sustainability)
PLO 8 (Ethics)
PLO 9 (Individual and Team Work)
PLO 10 (Communication)
PLO 11 (Project Management)
PLO 12 (Lifelong Learning)

S No List of Experiments CLO R-G


1 Introduction to network device and cabling 4 2
2 Network topologies and LAN setup 4 2
3 Introduction to packet tracer and designing topology 4 2
4 Network diagnostic commands / tools 4 2
5 Network monitoring using wireshark 4 2
6 Java concepts and socket programming 4 2
7 UDP socket programming 4 2
8 TCP socket programming 4 2
9 A complete client-server application 4 2
10 DHCP configuration / IP subnetting 4 2
11 Router configuration and routing (static & dynamic using rip) 4 2
12 Dynamic routing using OSPF 4 2
13 Establishment of routed WAN 4 2
14 Access control list 4 2
15 Lab exam / Project 4 3

3 Computer Networks Lab Manual


Mapping of Lab Experiments

Lab Rubrics (Group 2)


Criteria Unacceptable Substandard Adequate Proficient
(Marks=0) Marks=1 Marks=2 Marks=3

R1 The system execution let to


The system was correctly The system was correctly
Completeness The system failed to inaccurate or incomplete
functional and most of functional, and all the
and Accuracy produce the right results. It was not correctly
the features were features were
accurate result functional or not all the
implemented implemented
features were implemented

R2 Demonstrates limited Demonstrates some Demonstrates sufficient Demonstrates thorough


knowledge and knowledge and knowledge and knowledge and
Network understanding of key understanding of key understanding of key understanding of key
components concepts of network concepts of network concepts of network concepts of network
components and components and components and components and
architectures architectures architectures architectures

R3 The student has


The student has basic demonstrated on
Demonstration The student failed to The student has moderate
knowledge of accurate understanding
demonstrate a clear knowledge of
understanding but asked of the lab objective and
understanding of the understanding. Answer to
questions were not concepts. All the
assigned task the question are basic
answered. questions are answered
completely and correctly

R4 The student The student failed to The student followed


clearly failed to follow the some of the The student followed the verbal and
Followed follow the verbal verbal and written most of the verbal and written instructions
Directions and written instructions to written instructions to to successfully
instructions to successfully complete complete all the complete
successfully all requirements of the requirements of the lab requirements of the
complete the lab lab lab

R5 The student clearly


The student knows the basic The student has moderate The student effectively
failed to use
Modern tool knowledge of simulation knowledge of simulation uses simulation tools to
simulation tools to
Usage tools to design, configure, tools to design, configure, design, configure, test
design, configure, test
test and troubleshoot the test and troubleshoot the and troubleshoot given
(Wireshark & and troubleshoot the
given scenario. given scenario scenario.
packet Tracer) given scenario.

4 Computer Networks Lab Manual


Lab Rubrics (Group 3)

Criteria Unacceptable Substandard Adequate Proficient


(Marks=0) Marks=1 Marks=2 Marks=3

The system execution let


to inaccurate or
The system was The system was
R1 The system failed to incomplete results. It
correctly functional and correctly functional,
Completeness produce the right was not correctly
most of the features and all the features
and Accuracy accurate result functional or not all the
were implemented were implemented
features were
implemented

The student has


demonstrated on
The student has basic The student has accurate
The student failed to
R2 knowledge of moderate knowledge of understanding of the
demonstrate a clear
understanding but asked understanding. Answer lab objective and
Demonstration understanding of the
questions were not to the question are concepts. All the
assigned task
answered. basic questions are
answered completely
and correctly

Complete working
program is copied
Most of working Most of working Complete working
R3 indicating no effort
program is copied. program is contributed program is
on student’s part
Plagiarism Minor contribution by by the student. Minor contributed by the
resulting in a total
the student copied components student
score of zero for all
rubrics

R4 Shows little Demonstrates Demonstrates Actively helps to


commitment to commitment to group commitment to group identify group goals
Contribution/ group goals and fails goals, but has difficulty goals and carries out and works effectively
Group to perform assigned performing assigned assigned roles to meet them in all
participation roles roles effectively roles assumed

Poor presentation;
Well-organized, clear
cannot explain topic; Presentation lacks clarity Presentation
R5 presentation; good
scientific and organization; little acceptable; adequate
use of scientific
Presentation terminology lacking use of scientific terms use of scientific terms;
vocabulary and
skills or confused; lacks and vocabulary; poor acceptable
terminology; good
understanding of understanding of topic understanding of topic
understanding of topic
topic

5 Computer Networks Lab Manual


MARKS

Instructor
Max. Marks Obtained
Date Experiment Sign
Marks
R1 R2 R3 R4 R5

Grand Total

6 Computer Networks Lab Manual


LIST OF EXPERIMENTS
EXPERIMENT 1 – INTRODUCTION TO NETWORK DEVICE AND CABLING ........................................................... 8
EXPERIMENT 2 – NETWORK TOPOLOGIES AND LAN SETUP ................................................................................. 13
EXPERIMENT 3 – INTRODUCTION TO PACKET TRACER AND DESIGNING TOPOLOGY .................................. 19
EXPERIMENT 4 – NETWORK DIAGNOSTIC COMMANDs / TOOLS ......................................................................... 26
EXPERIMENT 5 – NETWORK MONITORING USING WIRESHARK .......................................................................... 30
EXPERIMENT 6 – JAVA CONCEPTS AND SOCKET PROGRAMMING ..................................................................... 33
EXPERIMENT 7 – UDP SOCKET PROGRAMMING .......................................................................................................40
EXPERIMENT 8 – TCP SOCKET PROGRAMMING ....................................................................................................... 46
EXPERIMENT 9 – A COMPLETE CLIENT-SERVER APPLICATION ...........................................................................51
EXPERIMENT 10 – DHCP CONFIGURATION / IP SUBNETTING ............................................................................... 52
EXPERIMENT 11 – ROUTER CONFIGURATION AND ROUTING (STATIC & DYNAMIC USING RIP) ................58
EXPERIMENT 12 – DYNAMIC ROUTING USING OSPF ............................................................................................... 65
EXPERIMENT 13 – ESTABLISHMENT OF ROUTED WAN .......................................................................................... 74
EXPERIMENT 14 – ACCESS CONTROL LIST ................................................................................................................ 77

7 Computer Networks Lab Manual


EXPERIMENT 1 – INTRODUCTION TO NETWORK DEVICE AND CABLING
Objective
 Lab structure orientation
 Study of different types of Network cables and practically implement the cross-wired cable and straight
through cable using clamping tool.
 Study Network Devices in Detail
Time Required : 3 hrs
Programming Language : NIL
Software Required : NIL
Hardware Required :
 UTP Wire
 Crimping Tool
 Connector
 Network Devices (Router, Switch, Hub, etc)

Structure of the lab


 Network Lab consists of 33 computers connected each other using start topology. Further this Lab is
connected with central point (MIS Cell) through fiber Optical cable.
 IP addresses used in this lab are Class B IP Address i.e. [172.23.x.x] and the subnet mask for this lab is
[255.255.252.0].
 Internet service is accessible round the clock which is shared from the central point (MIS Cell).

Network Cable
There are many types of network cables used in the real-world applications. Some of them are given below:

Unshielded twisted pair: As the name indicates, the wires are twisted with one another and there is no shield.

Shielded twisted pair: Shield with twisted pair.

8 Computer Networks – Introduction to Network Device and Cabling


Coaxial cable: Similar to our cable TV cables.

Implement the cross-wired cable and straight through cable


 Start by stripping off about 2 inches of the plastic jacket off the end of the cable. Be very careful at this
point, as to not nick or cut into the wires, which are inside. Doing so could alter the characteristics of your
cable, or even worse render is useless. Check the wires, one more time for nicks or cuts. If there are any, just
whack the whole end off, and start over.

 Spread the wires apart, but be sure to hold onto the base of the jacket with your other hand. You do not want
the wires to become untwisted down inside the jacket. Category 5 cable must only have 1/2 of an inch of
'untwisted' wire at the end; otherwise it will be 'out of spec'. At this point, you obviously have ALOT more
than 1/2 of an inch of un-twisted wire.

 You have 2 end jacks, which must be installed on your cable. If you are using a pre-made cable, with one of
the ends whacked off, you only have one end to install - the crossed over end. Below are two diagrams,
which show how you need to arrange the cables for each type of cable end. Decide at this point which end
you are making and examine the associated picture below.

Straight through cable: The straight-through cable is used to connect


• Host to switch or hub
• Router to switch or hub

9 Computer Networks – Introduction to Network Device and Cabling


Crossover cable: The crossover cable can be used to connect
 Switch to switch
 Hub to hub
 Host to host
 Hub to switch
 Router direct to host

Note:- Other two pairs are used for Power on Ethernet


 PoE +VDC: 4 & 5
 PoE -VDC: 7 & 8

Roll over cable: Here, the connections


are made in reverse order. This type of
cable is used to connect the router/switch
to the PC via console port for
management purposes.

Network Devices
Repeater: Functioning at Physical Layer. A
repeater is an electronic device that receives a
signal and retransmits it at a higher level and/or
higher power, or onto the other side of an
obstruction, so that the signal can cover longer
distances. Repeater has two ports, so cannot be
use to connect for more than two devices.

Hub: An Ethernet hub or concentrator is a


device for connecting multiple twisted pair or
fiber optic Ethernet devices together and making
them act as a single network segment. Hubs
work at the physical layer (layer 1) of the OSI
model. The device is a form of multiport repeater.
Repeater hubs also participate in collision
detection, forwarding a jam signal to all ports if
it detects a collision.
10 Computer Networks – Introduction to Network Device and Cabling
Switch: A network switch or switching hub is a computer networking device that connects network segments. It
routes data at the data link layer (layer 2) of the OSI model. Switches that additionally process data at the
network layer (layer 3 and above) are often referred to as Layer 3 switches or multilayer switches.

Router: A router is an electronic


device that interconnects two or
more computer networks, and
selectively interchanges packets of
data between them. Each data
packet contains address
information that a router can use to
determine if the source and
destination are on the same
network, or if the data packet must
be transferred from one network to
another. Where multiple routers are
used in a large collection of
interconnected networks, the
routers exchange information about
target system addresses, so that each router can build up a table showing the preferred paths between any two
systems on the interconnected networks.

Gate Way: In a communications network, a network node equipped for interfacing with another network that
uses different protocols.

Summary
In this lab practical students understand the fundamental terminologies and concepts of computer networks.
Further they will be able to define topologies of network.

Web Resources
http://www.wikihow.com/Make-a-Network-Cable
http://fcit.usf.edu/network/chap4/chap4.htm
http://www.ertyu.org/steven_nikkel/ethernetcables.html
http://www.archonmagnus.com/mods/crossOverCable/xOverCable.php

Videos Resources
http://www.youtube.com/watch?v=q6wZ9vwKSEs
http://www.youtube.com/watch?v=bfp7oskfDXY
http://www.youtube.com/watch?v=iyZ9nEA_vCQ

11 Computer Networks – Introduction to Network Device and Cabling


EXERCISES
Exercise 1.1 [1]
Which type of cable will be used between switch and router?

Exercise 1.2 [1]


Which device is used to connect two dissimilar type of network (Use different protocol)?

Exercise 1.3 [3]


Write the colour coding of Cross cable.

Exercise 1.4 [3]


Write the colour coding of cable, which connects the PC to Switch.

Exercise 1.5 [2]


What is the difference between Hub and Switch?

12 Computer Networks – Introduction to Network Device and Cabling


EXPERIMENT 2 – NETWORK TOPOLOGIES AND LAN SETUP
Objective
 Learn to create a simple LAN with two PCs using an Ethernet hub and two straight-through cables to
connect the workstations
 Learn to configure and verify the network connectivity.
Time Required : 3 hrs
Programming Language : NIL
Software Required : NIL
Hardware Required :
 Switch
 4x Patch Cords

Networks Topology

The network topology defines the way in which computers, printers, and other devices are connected, physically.
A network topology describes the layout of the wire and devices as well as the paths used by data transmissions

Mesh topology
Advantages
 The arrangement of the network nodes is such that it is possible to
transmit data from one node to many other nodes at the same time.
 The failure of a single node does not cause the entire network to fail
as there are alternate paths for data transmission.
 It can handle heavy traffic, as there are dedicated paths between any
two network nodes.
 Point-to-point contact between every pair of nodes, makes it easy to
identify faults.
Disadvantages
 The arrangement wherein every network node is connected to every other node of the network, many
connections serve no major purpose. This leads to redundancy of many network connections.
 A lot of cabling is required. Thus, the costs incurred in setup and maintenance are high.
 Owing to its complexity, the administration of a mesh network is difficult.
Start topology
Advantages
 Due to its centralized nature, the topology offers simplicity of
operation.
 It also achieves isolation of each device in the network.
 Adding or removing network nodes is easy, and can be done
without affecting the entire network.
 Due to the centralized nature, it is easy to detect faults in the
network devices.
 As the analysis of traffic is easy, the topology poses lesser
security risk.
 Data packets do not have to pass through many nodes, like in
the case of a ring network. Thus, with the use of a high-capacity
central hub, traffic load can be handled at fairly decent speeds.

13 Computer Networks – Network Topologies and LAN Setup


Disadvantages
 Network operation depends on the functioning of the central hub. Hence, central hub failure leads to failure
of the entire network.
 Also, the number of nodes that can be added, depends on the capacity of the central hub.
 The setup cost is quite high.

Bus topology
Advantages
 It is easy to set up, handle, and implement.
 It is best-suited for small networks.
 It costs very less.

Disadvantages
 The cable length is limited. This limits the number of network nodes that can be connected.
 This network topology can perform well only for a limited number of nodes. When the number of devices
connected to the bus increases, the efficiency decreases.
 It is suitable for networks with low traffic. High traffic increases load on the bus, and the network efficiency
drops.
 It is heavily dependent on the central bus. A fault in the bus leads to network failure.
 It is not easy to isolate faults in the network nodes.
 Each device on the network "sees" all the data being transmitted, thus posing a security risk.

Ring topology
Advantages
 The data being transmitted between two nodes passes through all the
intermediate nodes. A central server is not required for the
management of this topology.
 The traffic is unidirectional and the data transmission is high-speed.
 In comparison to a bus, a ring is better at handling load.
 The adding or removing of network nodes is easy, as the process
requires changing only two connections.
 The configuration makes it easy to identify faults in network nodes.
 In this topology, each node has the opportunity to transmit data.
Thus, it is a very organized network topology.
 It is less costly than a star topology.

Disadvantages
 The failure of a single node in the network can cause the entire network to fail.
 The movement or changes made to network nodes affect the entire network's performance.
 Data sent from one node to another has to pass through all the intermediate nodes. This makes the
transmission slower in comparison to that in a star topology. The transmission speed drops with an increase
in the number of nodes.
 There is heavy dependency on the wire connecting the network nodes in the ring.

14 Computer Networks – Network Topologies and LAN Setup


Introduction to IP addressing
Each Network Interface Card (NIC or Network card) present in a PC is assigned one Network address called as
IP address [or Network address or Logical address]. This IP address is assigned by the administrator of the
network. No two PCs can have the same IP address.

There is a burned-in address on the NIC called as Physical Address [or MAC address or Hardware address].
The MAC address of a network card indicates the vendor of that card and a unique serial number.

Rules of IPv4 addressing


IP address format: IPv4 is made up of four parts, in the pattern as w. x. y. z. Each part has 8 binary bits and
the values in decimal can range from 0 to 255.

IP address classes: IP addresses are divided into different classes. These classes determine the maximum
number of hosts per network ID. Only three classes are actually used for network connectivity. The following
table lists all of the address class.

Grouping of IP addresses into different classes.


 Class A, B, C, D, E
 Class A: first bit in w is 0 and others can be anything
 0.0.0.0 to 127.255.255.255
 ii. First bits are used for network part and the remaining for host part.
 Class B: First bit in w is1 and second bit is 0.
 128.0.0.0 to 191.255.255.255
 ii. First 16 bits for network part and remaining host part
 Class C: first bit in w is 1, second bit in w is 1 and third bit is 0
 192.0.0.0 to 223.255.255.255
 ii. First 24 bits for network part and last 8 bits for host part.
 Class D: first, second, third bits in w are 1 and fourth bit is 0; used for multicast.
 i. 224.0.0.0 to 247.255.255.255
 Class E: future use or experimental purposes.

Default Subnet mask: It is used to identify the network part from the host part. Put binary one for the parts that
represent network part and zero for the part that represent host part.
 Class A: 255.0.0.0
 Class B: 255.255.0.0
 Class C: 255.255.255.0
Note:- We can’t have mix of 1s and 0s in subnet mask. Only consecutive 1s is followed by consecutive 0s

The following table lists the default subnet masks for each available class of TCP/IP networks.

15 Computer Networks – Network Topologies and LAN Setup


Setting up a simple network
In this Lab, we will learn how to connect two PCs to create a simple Peer-to-Peer network. The instructions for
this lab focus on the Windows 2003 operating system. You will share a folder on one workstation and connect
to that folder from the other workstation. A simple topology is shown bellow in which a four node Ethernet
LAN using Ethernet Hub. A UTP cable is used to connect the NIC installed inside the PC to a port on the hub.

Tools / Preparation: The workstations should have Network


Interface Cards (NIC) installed with the proper drivers. The following
resources will be required:
 Two Pentium-based workstations with a NIC in each (NIC
drivers should be available and installed)
 An Ethernet switch (4 or 8 port) and two CAT5 straight-wired
cables.

Check Local Area Network Connections


You should check the cables to verify that you have good layer 1
physical connections.
A Network Connection via Hub
Plug in and connect the equipment
You should check the workstations and hub for exercise.

Check the TCP/IP Protocol Settings


Task: Use the Control Panel/Network Connections (or Properties in Context Menu of My Network Places) to
display Network Connections Window. Then use Properties in Context Menu of Local Area Connection to
display Local Area Connection Properties Window. Select the TCP/IP protocol from the Configuration Tab and
click on properties. Check the IP Address and Subnet mask for both workstations on the IP Address Tab.

16 Computer Networks – Network Topologies and LAN Setup


The IP addresses can be set to anything as long as they are compatible and on the same network. Record the
existing settings before making any changes in case they need to be set back (for instance, they may be DHCP
clients now). For this lab, use the Class C IP network address of 192.168.230.0 and set workstation 1 to static IP
address 192.168.230.1 and set workstation 2 to 192.168.230.2. Set the default subnet mask on each workstation
to 255.255.0.0. For the purpose of this lab, you can leave the Gateway and DNS Server entries blank.

Check the TCP/IP Settings with the IPCONFIG Utility


Use the ipconfig.exe command to see your TCP/IP settings on one screen. Click on Start -> Command Prompt.
Enter ipconfig /all command to see all TCP/IP related settings for your workstation.
Fill in the blanks below using the results of the IPCONFIG command from each workstation:

Check the network connection with the Ping Utility


Use the Ping Command to check for basic TCP/IP connectivity. Click on Start-> Command Prompt. Enter the
Ping command followed by the IP address of the other workstation (Example - ping 192.168.230.1 or
192.168.230.2).
Summary
In this lab practical students understand the how to set up a small network and diagnose network problems.
Further they will be able to view the Network statistics using command line.
Web Resources
http://www.wikihow.com/Configure-Your-PC-to-a-Local-Area-Network
http://thestarman.pcministry.com/DOS/DOS7NET.htm
Videos Resources
http://www.youtube.com/watch?v=G9ixcE9Bj44
http://www.youtube.com/watch?v=CK_xa_avd44

17 Computer Networks – Network Topologies and LAN Setup


EXERCISES
Exercise 2.1: [1]
The two PCs will be connected with a hub between them. A hub allows for more than just two workstations to
be connected depending on the number of ports on the hub. Hubs can have from 4 to 32 ports.

Exercise 2.2 [2]


Which address class (es) will allow you to have more than 250 hosts per network?

Exercise 2.3 [2]


Which address (es) will allow only 254 hosts per network?

Exercise 2.4 [2.5]


Write the address class next to each IP address.

Exercise 2.5 [2.5]


Which of the following is valid subnet mask?
a. 255.192.0.0
b. 255.255.96.0
c. 255.255.255.128
d. 255.255.255.250
e. 255.255.255.224

18 Computer Networks – Network Topologies and LAN Setup


EXPERIMENT 3 – INTRODUCTION TO PACKET TRACER AND DESIGNING TOPOLOGY
Objective
 Introduction to Packet Tracer interface.
 Learn how to use existing topologies and build your own.
Time Required : 3 hrs
Programming Language : NIL
Software Required : Packet Tracer
Hardware Required : NIL

Introduction to Packet Tracer


What is Packet Tracer? Packet Tracer is a protocol simulator developed by Dennis Frezzo and his team at
Cisco Systems. Packet Tracer (PT) is a powerful and dynamic tool that displays the various protocols used in
networking, in either Real Time or Simulation mode. This includes layer 2 protocols such as Ethernet and PPP,
layer 3 protocols such as IP, ICMP, and ARP, and layer 4 protocols such as TCP and UDP. Routing protocols
can also be traced.

Introduction to the Packet Tracer Interface using a Hub Topology


Step 1:Start Packet Tracer and Entering Simulation Mode and Launch Packet Tracer program from the program
list.
Step 2:Open an existing topology and Perform the following steps to open the 2c1 topology.

By default, the topology opens in Realtime mode.

We will examine the difference between Real-time and Simulation modes in a moment.
To view the IP address, subnet mask, default gateway, and MAC address of a host, move the cursor over that
computer.
Be sure the Select box is checked at the top of the tool box. Viewing PC0 information using the Select tool:

19 Computer Networks – Introduction to Packet Tracer and Designing Topology


Once the file is opened, click the Simulation icon, to enter simulation mode. Simulation mode allows you to
view the sequence of events associated with the communications between two or more devices.
Realtime mode performs the operation with all of the sequence of events happening at “real time”.

Step 3:PC0 pinging PC1


For those not familiar with ping: We will examine pings and the ICMP protocol in much more detail later. The
ping program generates an IP packet with an encapsulated ICMP Echo Request message. It is a tool used to test
basic layer 2 and layer 3 communications between two devices.
When the user issues the ping command, most operating systems send multiple (four or five) ICMP Echo
messages. When the destination device receives the ping, Echo Request, it issues an Echo Reply.

Command issued from PC0: ping 10.0.0.2


20 Computer Networks – Introduction to Packet Tracer and Designing Topology
Packet Tracer allows us to either issue the command from the command prompt or to use the Add Simple PDU
tool. We will look at both ways to do this. In order to view only the “pings”, in the Event List Filter, click on
SHOW ALL/NONE to clear all protocols, and then click on ICMP to select only that protocol.

Using the Simple PDU Tool One method for pinging a device from another device is to use the Simple PDU
tool. This tool performs the ping without having to issue the ping command. Choose the Add Simple PDU tool
from the tool box:

Click once on PC0, the device issuing the ping (ICMP Echo Request) and then click once on PC1 (the
destination of the ICMP Echo Request).

21 Computer Networks – Introduction to Packet Tracer and Designing Topology


By clicking on the Auto Capture/Play button, this will capture all events in interval of 0.001 second. For
example, the first event is the building of the ICMP packet and encapsulating it in an Ethernet frame. The next
event will send this Ethernet frame from the Ethernet NIC in PC0 to the Hub.

Notice that the hub floods all of the frames out all ports except the port incoming port.
Normally, before the ICMP Echo Request, ping, is sent out by PC0, an ARP Request might first be sent. We
will discuss this later, but we disabled the display of ARP in the Event List earlier.
Note: Using this tool, only a single ping, ICMP Echo Request is sent by PC0, instead of the four pings when
using the command prompt.

22 Computer Networks – Introduction to Packet Tracer and Designing Topology


Step 4:Viewing the frame (Protocol Analyzer)
To examine the actual protocols being sent, click on the colored Info box in the Event List. The Event List
shows where this Ethernet Frame is currently, “At Device”, the previous devices, “Last Device”, and the type of
information encapsulated in the Ethernet Frame, “Info”. Single click on the second event’s Info box to view the
Ethernet frame with the encapsulated IP Packet and the encapsulated ICMP message “At Device” PC0.

The PDU (Protocol Data Unit) is displayed in two different formats, OSI Model and Outbound PDU Details.
View them both, paying particular attention to the Layer 2 Ethernet frame. We will discuss IP and ICMP later.
If you only see the IP packet and the ICMP message, and do not see the Ethernet II frame, click on the next
ICMP Info box. This happened because we are looking at the IP packet before it got encapsulated into an
Ethernet frame.

23 Computer Networks – Introduction to Packet Tracer and Designing Topology


The default is the OSI Model view with a brief description with what is occurring with this packet. Click on the
Outbound PDU Details tab to see the protocol details including the layer 2 Ethernet frame, the layer 3 IP packet
and ICMP message.

Summary
In this lab practical students understand the how to setup network using Packet tracer tool. Further they will
show to simulate the packet passes through source and destination.
Web Resources
http://www.cisco.com/web/learning/netacad/course_catalog/docs/Cisco_PacketTracer_DS.pdf

Videos Resources
http://www.packettracernetwork.com/tutorials/video-tutorials.html
http://www.youtube.com/watch?v=hrRT2UxS_L8
http://engweb.info/cisco/Packet%20Tracer%20Tutorials.html
http://www.youtube.com/watch?v=VqMeJ-WH4E0
24 Computer Networks – Introduction to Packet Tracer and Designing Topology
EXERCISES

Exercise 3.1: [10]


Build two topologies separately having four PC i.e. PC1, PC2, PC3 and PC4 connected to central location (switch and
hub). Send 5, 10, 15, 20 and 25 packet from PC1 to PC4 using ping command in each topology.

OUTPUTS: Draw the graph showing the performance of both topologies between no packet and total time taken in each
session.

25 Computer Networks – Introduction to Packet Tracer and Designing Topology


EXPERIMENT 4 – NETWORK DIAGNOSTIC COMMANDs / TOOLS
Objective
 Students are able to Learn and Understand Network diagnostic tools
 Learn about various network related commands
Time Required : 3 hrs
Programming Language : NIL
Software Required : Windows Command line Utility
Hardware Required : NIL

PING Command
Ping is a basic Internet program that lets you verify that a particular IP address exists and can accept requests.
The verb ping means the act of using the ping utility or command. Ping is used diagnostically to ensure that a
host computer you are trying to reach is actually operating. Various options available in the ping command:
-t repetitively sends packets.
-n number of echo to be sent
-l sending buffer size [Max: 65500 bytes]
-r countr record route for count hops [3rd layer device]

Activity 4.1
In order to send a packet to a host [192.168.230.1] with size of 60000 bytes each. We wish to send the packets
repetitively.
ping -t -l 60000 192.168.230.1

TRACERT Command
If someone would like to know how he goes from his house to his office he could just tell the list of the
crossroads where he passes. The same way we can ask the data sent over from your computer to the web server
which way does it go, through which devices? We ask it by using the utility called trace route. In most
computers today you can use this tool from the command line: In MS Windows machines it is called tracert.
Various options available in the tracert command:
-d Don’t resolve addresses to hostnames.
-h maximum_hops Maximum number of hops to search for target
-w time-out wait timeout milliseconds for each reply.

Activity 4.2
To check the trace from your PC to a server
tracert 172.23.16.1

PATHPING Command
This command is used as IP trace utility and so it is similar to the tracert command. It has some extra features
compared to tracert command. It also has various options to perform.
-n Don't resolve addresses to hostnames
-h max_hops Max number of hops to search
-p period Wait between pings (milliseconds)
-q num_queries Number of queries per hop
-w timeout Wait timeout for each reply (milliseconds)

NETSTAT Command
This command is used to get information about the open connections on your system
26 Computer Networks – Network Diagnostic Commands / Tools
(ports, protocols are being used, etc.), incoming and outgoing data and also the ports of remote systems to
which you are connected.
Various options available in the netstat command:
-a Displays all connections and listening ports.
-e Displays Ethernet statistics. This may be combined with the -s option.
-n Displays addresses and port numbers in numerical form.
-p proto Shows connections for the protocol specified by proto; proto may be TCP or UDP. If used with
the –s option to display per-protocol statistics, proto may be TCP, UDP, or IP.
-r Displays the routing table.
-s Displays per-protocol statistics. By default, statistics are shown for TCP, UDP and IP; the -p
option may be used to specify a subset of the default.
Activity 4.3
To display all connections and listening ports
netstat –a
To find out the statistics on your Ethernet card
netstat –e
To get to know the routing table.
netstat -r

ROUTE Command
This command manipulates network routing tables. Various options available in the ROUTE command:
-f Clears the routing tables of all gateway entries. If this is used in conjunction with one of the commands,
the tables are cleared prior to running the command.
Command Specifies one of four commands
PRINT Prints a route
ADD Adds a route
DELETE Deletes a route
CHANGE Modifies an existing route
Destination Specifies the host to send command.
MASK If the MASK keyword is present, the next parameter is interpreted as the netmask
parameter.
Netmask If provided specifies a sub-net mask value to be associated with this route entry. If not
specified, if defaults to 255.255.255.255.
Gateway Specifies gateway.

Activity 4.4
To display the routing table.
route PRINT
To add a route a destination
route add <destination> mask <subnetmask><gateway> metric <number>

ARP Command

27 Computer Networks – Network Diagnostic Commands / Tools


The address resolution protocol (ARP) is a protocol used by the Internet Protocol (IP), specifically IPv4, to map
IP network addresses to the hardware addresses used by a data link protocol. Various options available in the
ARP command:
-a Displays current ARP entries by interrogating the current protocol data. If inet_addr is specified, the IP
and Physical addresses for only the specified computer are displayed. If more than one network interface
uses ARP, entries for each ARP table are displayed.
-d Deletes the host specified by inet_addr.

Activity 4.5
To display the entries in ARP cache
arp -a
To delete an ARP entry in the cache
arp –d 192.168.50.203

IPCONFIG Command
This command is used to get IP configurations present in your PC.
IPCONFIG /all Display full configuration information.
IPCONFIG /renew [adapter] Renew the IP address for the specified adapter.
IPCONFIG /flushdns Purge the DNS Resolver cache.
IPCONFIG /displaydns Display the contents of the DNS Resolver Cache. ##

Activity 4.6
> ipconfig ... Show information.
> ipconfig /all ... Show detailed information
> ipconfig /renew ... renew all adapters

Summary
In this lab practical students understand the how to set up a small network and diagnose network problems.
Further they will be able to view the Network statistics using command line.

Web Resources
http://www.wikihow.com/Configure-Your-PC-to-a-Local-Area-Network
http://thestarman.pcministry.com/DOS/DOS7NET.htm

Videos Resources
http://www.youtube.com/watch?v=G9ixcE9Bj44
http://www.youtube.com/watch?v=CK_xa_avd44

28 Computer Networks – Network Diagnostic Commands / Tools


EXERCISES

Student name must be shown in output screen


Exercise 4.1: We will use ping command here. [3]
Test the reach ability towards a google server using both name and IP. Show output screen.

a. What is the time value observed for all four replies? _____________________
b. What is the TTL observed? _____________________

Command we will use:


ping google.com

Exercise 4.2: We will use TRACERT here. [2+1+3]


Find the route from your PC to hotmail server and answer the following questions. Show output screen.

a. _______________ number of hops exist between your PC to hotmail server.


b. What is the average delay of each hop? Show it in tabular form.
Command we will use:
tracert hotmail.com

Exercise 4.3: [3]


Get to know about the TCP/IP configuration on your PC. Show output screen.

a. What is IP address? ____________________


Laptop doesn't has these properties .
b. What is subnet mask? ____________________
c. What is Physical address? ____________________

Exercise 4.4: [3]


ARP is a communication protocol that maps the IP address to the MAC address. First ping hotmail.com and
display ARP table. Is hotmail server IP & MAC address listed in ARP table (if yes circle it otherwise gives
reason).
arp .... thats it.

29 Computer Networks – Network Diagnostic Commands / Tools


EXPERIMENT 5 – NETWORK MONITORING USING WIRESHARK
Objective
 Configure FTP Server using XLight Software
 Capture FTP traffic using Wireshark
 Monitor FTP packets
Time Required : 3 hrs
Programming Language : NIL
Software Required : Wireshark Software, XLight Software
Hardware Required : NIL

Configure the FTP Service


 To configure the FTP Service to allow only anonymous connections, follow these steps:
 Start Start -> Administrative Tools -> Internet Information Services Manager.
 Expand Server_name, where Server_nameis the name of the server.
 Expand FTP Sites
 Right-click Default FTP Site, and then right-click and select Properties.
 Click the Security Accounts tab.
 Click to select the Allow Anonymous Connections check box (if it is not already selected), and then click to
select the Allow only anonymous connections check box.
 When you click to select the Allow only anonymous connections check box, you configure the FTP Service
to allow only anonymous connections. Users cannot log on by using user names and passwords.
 Click the Home Directory tab. The default home directory is c:\inetpup\ftproot.
 You may change it if you wish.
 Click to select the Read and Log visits check boxes (if they are not already selected), and then click to clear
the Write check box (if it is not already cleared).
 Quit Internet Information Services Manager.
 The FTP server is now configured to accept incoming FTP requests. Copy or move the files that you want to
make available to the FTP publishing folder for access.

Analysis of TCP Session


Step 1:Open Wireshark and go to CaptureInterfaces. Select an appropriate Network Interface Card and press
start to begin capturing packets. Wireshark will start capturing all the packets on LAN, whether these are
destined for or originating from your PC or not!
Step 2:Now apply a filter to capture TCP packets only. Also apply another filter so that you can see only the
traffic destined for or originating from your PC. Here is the composite filter string

(ip.src==your_ip_addr|| ip.dst==your_ip_addr) && tcp

Note: Here “||” stands for logical OR and “&&” stands for logical AND.
Step 3:Open command prompt and establish an ftp session to an FTP server. For this lab, an FTP server has
been established at Server_name. At home, you can use ftp.mozilla.orgas FTP server. Coming back to FTP
session, type following commands in command prompt to setup a session:
 Type ftp Server_name, where Server_nameis the name of the server.
 Enter your first name as username
 Give an arbitrary password. You will not be authenticated with these credentials; however this is sufficient
for analyzing a TCP session.
 Type bye to end up the ftp session.
Step 4:Now go back to Wireshark and stop capturing packets by going to Capture  Stop.
30 Computer Networks – Network Monitoring using Wireshark
Activity 5.1
Look for the three-way handshake packets (SYN, SYN/ACK, ACK) and click on the SYN/ACK packet to view
its details. Examine the IP header, compared to the discussion. Look for the following:
 Which IP version this session used? IPv4 or IPv6?
 What is the value of time-to-live field?
 What is the upper layer Protocol ID?
 What is the source IP address?
 What is the destination IP address?

Activity 5.2
Expand the TCP segment and answer the following:
 What is the source port?
 What is the destination port?
 Which TCP header flags are set?
 What is the window size?

Analysis of FTP message


Now you are required scan through some data packets and see what is contained in FTP message. Expand some
FTP messages and try reading what’s inside them. Can you find packets originating from your PC to FTP server
that contained your username and password?

Activity 5.3
Do you think FTP uses safe authentication procedures? If not, why not?

Filter traffic with different criteria


Once again go back to Wireshark and Start capturing. Now open some browser and open any favorite website.
Apply httpfilter in wireshark and see how packets are being transacted while you browse through the webpage.
Filter String:(ip.src==your_ip_addr || ip.dst==your_ip_addr) && http
You can even find the packets containing complete images with in the webpage. You may encounter some
ungraceful tear-downs. Also notice that request to just one URL may result in multiple TCP sessions.

Summary
In this lab practical students understand the how to configure and user File transfer protocol in windows
environment. Further they will be able to analyse the packet using wireshark tool.

Web Resources
http://www.techrepublic.com/blog/linux-and-open-source/use-wireshark-to-inspect-packets-on-your-network/
http://blog.schertz.name/2011/10/wireshark-capture-tips/

Videos Resources
http://www.youtube.com/watch?v=jWC2cBvC0tY
http://www.youtube.com/watch?v=OWjLH1Xsh_I
http://www.youtube.com/watch?v=8Lfh2k4favc

31 Computer Networks – Network Monitoring using Wireshark


EXERCISE
Exercise: 5.1 Analysis of ICMP Traffic [10]

 Open Wireshark and go to CaptureInterfaces.Select an appropriate Network Interface Card and press
Start to begin capturing packets.
 Now apply a filter to capture ICMP packets only.

 Filter String:(ip.src==your_ip_addr ||ip.dst==your_ip_addr) &&icmp

 Ping some PC in the lab or simply your Default Gateway.


 After the ping is complete, go back to wireshark and stop capturing.
 Click on the ping request packet and expand the ICMP message in the packet details pane. What is the
value of Typefield and what does it indicate? 8 Probably.
 Click on the ping reply packet and expand the ICMP message in the packet details pane. What is the value
of Typefield and what does it indicate? 0
 Click on Data field of ICMP ping request packet and observe its ASCII value in “Packets Byte Pane” (the
lower most section), what is it containing? will do it for the reply packet instead. and paste the croped photo of
lower most section.
 Answer the questions asked throughout the manual and submit it as lab report of today’s lab session.

32 Computer Networks – Network Monitoring using Wireshark


EXPERIMENT 6 – JAVA CONCEPTS AND SOCKET PROGRAMMING
Objective
 Students will able to trace the ports of a particular host.
 Students will able to Implement of echo client/server application
Time Required : 3 hrs
Programming Language : JDK 7.0 (Latest)
Software Required : NetBeans IDE
Hardware Required : NIL

How to run program


To execute the java program you will have to set the path of JDK. Create a batch file (setp.bat) using notepad,
which contains the following line:
set PATH=C:\Program Files\Java\jdk1.6.0\bin;
On command line execute the setp to set the JDK path. Now you have set the path.
You can use the statements javac and java.
javac statement compiles the code into byte code and generates the .class file.
java statement executes the code.

Activity 6.1 : First I /O Program (InputCL.java)


import java.util.Scanner; // program uses class Scanner
public class InputCL{
public static void main( String args[] ){
// create Scanner to obtain input from command window
Scanner input = new Scanner( System.in );

int number1; // first number to add


int number2; // second number to add
int sum; // sum of number1 and number2

System.out.print( "Enter first integer: " );


number1 = input.nextInt(); // read first number from user

System.out.print( "Enter second integer: " );


number2 = input.nextInt(); // read second number from user

sum = number1 + number2;


System.out.printf( "Sum is %d\n", sum );
} // end method main
} // end class Addition

Note:- In java programming java class name must be java class


In Activity 6.1 you will have to take the input from user on command line. You are required to execute this
program and show the output.

Modification in Activity 6.1


Most Java applications use windows or a dialog box. You are required to display input dialog box for getting
the input and displaying the output from/to user. The Class JOptionPane allows us to use dialog boxes in
javax.swing package. This package has classes for using Graphical User Interfaces (GUIs).

Activity 6.2 : GUI I /O Program (InputGUI.java)


import javax.swing.JOptionPane; // program uses JOptionPane
public class InputGUI{
public static void main( String args[] ){

33 Computer Networks – Socket and Server Socket Programming


String firstNumber; // first string entered by user
String secondNumber; // second string entered by user
int number1; // first number to add
int number2; // second number to add
int sum; // sum of number1 and number2

firstNumber = JOptionPane.showInputDialog( "Enter first integer" );


secondNumber = JOptionPane.showInputDialog( "Enter second integer" );

// convert numbers from type String to type int


number1 = Integer.parseInt( firstNumber );
number2 = Integer.parseInt( secondNumber );
sum = number1 + number2;

JOptionPane.showMessageDialog( null, "The sum is " + sum,"Results",


JOptionPane.PLAIN_MESSAGE ); // display result

System.exit( 0 ); // terminate application with window

} // end method main

} // end class Addition


Note:- In java programming java class name must be java class

In Activity 6.2 you will have to display two input dialog boxes for take the input from user and a display box to
show the output of both numbers. You are required to execute this program and show the output.

String Handling in Java


Java string class contains variety of function to manipulate the strings. In the following you should learn how to
use the split function in java.

Activity 6.3 : String Handling (StringSplit.java)


public class StringSplit{
public static void main(String args[]){
/* String to split. */
String str = "one-two-three";
String[] temp;

/* delimiter */
String delimiter = "-";
temp = str.split(delimiter);
for(int i =0; i < temp.length ; i++)
System.out.println(temp[i]);
System.out.println("");
str = "192.168.15.1";
delimiter = "\\.";

34 Computer Networks – Socket and Server Socket Programming


temp = str.split(delimiter);
for(int i =0; i < temp.length ; i++)
System.out.println(temp[i]);
}
}
Note:- Some special characters need to be escaped while providing them as delimiters like "." and "|".

In Activity 6.3 explain the importance of dividing the string into part according specified delimiter. This will
help you printout he four section of IP address.

Socket-Definition
A socket is one endpoint of a two-way communication link between two programsrunning on the network. A
socketis bound to a port number so that the TCP layer can identify the application that data is destined to be sent.

Server
A server runs on a specific computer and has a socket that is bound to a specific port number. The server just
waits, listening to the socket for a client to make a connection request.

Client
The client knows the hostname of the machine on which the server (has a socket) is running and the port
number on which the server is listening. The client also needs to identify itself to the server so it binds to a local
port number that it will use during this connection.

server Connection request


port listen
Client

[a]: a client making a connection request to the server

server
port listen

port
port Connection Client

[b]: session established with temporary ports used for two way communication.

Socket and ServerSocket


Socket and ServerSocket classes are used to implement socket programming. ServerSocket has constructors that create
new ServerSocket objects, methods that listen for connections on a specified port, and methods that return a Socket object
when a connection is made so that you can send and receive data. A new ServerSocket is created on a particular port using
a ServerSocket( ) constructor.
There are three overloaded public constructors:

public ServerSocket(int port) throws IOException, BindException

In following activity student will be able to find out open port on Loacal machine.

35 Computer Networks – Socket and Server Socket Programming


Activity 6.4 : Local open port (LocalPortScanner.java)
import java.net.*;
import java.io.*;
public class LocalPortScanner{
public static void main(String args[]) throws IOException{
for(int port=1024;port<=65535;port++){
try
{
ServerSocket server=new ServerSocket(port);
}
catch(IOException e)
{
System.out.println("There is a open port"+port);
}
}
}
}

Implementation of echo client-server Application


This Activity implements a client, EchoClient that connects to the Echo server. The Echo server simply receives
data from its client and echoes it back. The Echo server is a service built into most operating systems.
EchoClient creates a socket and gets a connection to the Echo server. It reads input from the user on the
standard input stream, and then forwards that text to the Echo server by writing the text to the socket. The server
echoes the input back through the socket to the client. The client program reads and displays the data passed
back to it from the server.

Activity 6.5 : Echo Client-Server Application (EchoServer.java)


import java.io.*;
import java.net.*;
public class EchoServer{
public EchoServer(int portnum){
try{
server = new ServerSocket(portnum);
}
catch (Exception err){
System.out.println(err);
}
}
public void serve(){
try{
while (true){
Socket client = server.accept();
BufferedReader r = new BufferedReader(new InputStreamReader
(client.getInputStream()));
PrintWriter w = new PrintWriter(client.getOutputStream(), true);
w.println("Welcome to the Java EchoServer. Type 'bye' to close.");
String line;
do{
line = r.readLine(); //read from Cleint
if ( line != null )
w.println("Got: "+ line);
}
while ( !line.trim().equals("bye") );
client.close();
}
}
catch (Exception err){
36 Computer Networks – Socket and Server Socket Programming
System.err.println(err);
}
}
public static void main(String[] args){
EchoServer s = new EchoServer(9999);
s.serve();
}
private ServerSocket server;
}

(EchoClient.java)
import java.io.*;
import java.net.*;
public class EchoClient{
public static void main(String[] args){
try{
Socket s = new Socket("127.0.0.1", 9999);
BufferedReader r = new BufferedReader(new InputStreamReader
(s.getInputStream()));
PrintWriter w = new PrintWriter(s.getOutputStream(), true);
BufferedReader con = new BufferedReader(new InputStreamReader(System.in));
String line;
do{
line = r.readLine(); //Read from Server
if ( line != null )
System.out.println(line); //print if not null
line = con.readLine(); //Read from user
w.println(line); //send to server
}while ( !line.trim().equals("bye") );
}
catch (Exception err){
System.err.println(err);
}
}
}

Summary
In this lab practical students understand basic concept of Java programming language and learn how to handle
string class objects. Further they will perform practice to validate the ip address v4. Students also understand
the fundamental concepts of socket programming and learn how to setup server and establish communication
between client and server.

Web Resources
http://www.oracle.com/technetwork/java/socket-140484.html
http://www.tutorialspoint.com/java/java_networking.htm

Videos Resources
http://www.youtube.com/watch?v=aEDV0WlwXTs
http://www.youtube.com/watch?v=G-9zeneN8vc
http://www.youtube.com/watch?v=jli6XTzmRnU

37 Computer Networks – Socket and Server Socket Programming


Exercises
Exercise 6.1: Identification/Verification of IP address and its class [2]
Take two strings from the users via dialog boxes. Verify whether the input strings are IP addresses or not!
Moreover you will also classify the class of IP address either as Class A, B, C, D or E.

 (Class B : 128-191)

Exercise 6.2: Identification of Host/Network Portion bits [2]


Take two strings from the users via dialog boxes. One is IP address and second is subnet mask. Print the
Network and Host portion of IP address based on subnet mask.

For example Input


 IP address = 192.168.13.0
 Subnet mask = 255.255.255.0
Output
 Host portion contains 8 bits
 Network portion contains 24 bits

Note:- Explore the string class via JDK documentation.

Exercise 6.3: [2]


Develop a simple port scanner from remote machine. You can use to scan a host (any machine of your lab) for
open ports.

38 Computer Networks – Socket and Server Socket Programming


Exercise 6.4: [2]
Change Echo Client server Application so that server receive a number from client and returns square and cube
of number to client.

Exercise 6.5: [2]


Write a client/server system in which the client program sends five numbers to a server program which returns
the sum of the five numbers.

39 Computer Networks – Socket and Server Socket Programming


EXPERIMENT 7 – UDP SOCKET PROGRAMMING
Objective
 Client sends request to Server using port using UDP
 Server Accept the Client request and setup a communication path
Time Required : 3 hrs
Programming Language : JDK 7.0 (Latest)
Software Required : NetBeans IDE
Hardware Required : NIL

TCP/IP and UDP/IP communications


There are two communication protocols that one can use for socket programming:
 Datagram communication
 Stream communication.

Datagram communication
The datagram communication protocol, known as UDP (user datagram protocol), is aconnectionless protocol,
meaning that each time you send datagrams, you also need to send the local socket descriptor and the receiving
socket's address. As you can tell, additional data must be sent each time a communication is made.

In UDP, as you have read above, every time you send a datagram, you have to send thelocal descriptor and the
socket address of the receiving socket along with it. Since TCP is a connection-oriented protocol, on the other
hand, a connection must establish beforecommunications between the pair of sockets start.So there is a
connection setup time in TCP.

In UDP, there is a size limit of 64 kilobytes on datagrams you can send to a specified location, while in TCP
there is no limit. Once a connection is established, the pair of sockets behaves like streams: All available data
are read immediately in the same order in which they are received. UDP is an unreliable protocol and so there is
no guarantee that the datagrams you have sent will be received in the same order bythe receiving socket. On the
other hand, TCP is a reliable protocol; it is guaranteed that the packets you send will be received in the order
inwhich they were sent.

Sockets using UDP connection


Creating a datagram socket: If you are programming a client, then you would open a socket like this:

40 Computer Networks – UDP Socket Programming


If you are programming a server, then you would open a socket like this:

41 Computer Networks – UDP Socket Programming


Advantages
It is Less overhead (no connection establishment) and more efficient (no guaranteed delivery). Data can be
received from more than one machine. UDP used in Real-time applications (no error checking or flow-control)
E.g., weather, time, video, audio, games

Client/Server socket interaction

Sending/Receiving Packets

42 Computer Networks – UDP Socket Programming


Activity 7.1 : UDP Client-Server Application (UDPServer.java)
import java.io.*;
import java.net.*;
class UDPServer {
public static void main(String args[]) throws Exception {
DatagramSocket serverSocket = new DatagramSocket(9876);
byte[] receiveData = new byte[1024];
byte[] sendData = new byte[1024];

while(true) {
DatagramPacket receivePacket = new DatagramPacket(receiveData,
receiveData.length);
serverSocket.receive(receivePacket);
String sentence = new String(receivePacket.getData());
InetAddress IPAddress = receivePacket.getAddress();

int port = receivePacket.getPort();


String capitalizedSentence = sentence.toUpperCase();
sendData = capitalizedSentence.getBytes();

DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress,


port);
serverSocket.send(sendPacket);
}
}
}
Note:- The port no can be change according to your requirements

(UDPClient.java)
import java.io.*;
import java.net.*;
class UDPClient {
public static void main(String args[]) throws Exception {
BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));
DatagramSocket clientSocket = new DatagramSocket();
InetAddress IPAddress = InetAddress.getByName("hostname");
byte[] sendData = new byte[1024];
byte[] receiveData = new byte[1024];
String sentence = inFromUser.readLine();
sendData = sentence.getBytes();
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress,
9876);
clientSocket.send(sendPacket);
DatagramPacket receivePacket = new DatagramPacket(receiveData,
receiveData.length);
clientSocket.receive(receivePacket);
String modifiedSentence = new String(receivePacket.getData());
System.out.println("FROM SERVER:" + modifiedSentence);
clientSocket.close();
}
}
Note:-Hostname and port no can be change according to your requirements

43 Computer Networks – UDP Socket Programming


Summary
In this lab practical students understand the UDP fundamental concepts of socket programming and learn how
to setup server and establish communication between client and server using UDP protocol.

Web Resources
http://jpkc.ncwu.edu.cn/jsjwl/net/ross/book/apps/udpDev.html
http://systembash.com/content/a-simple-java-udp-server-and-udp-client/
http://eduunix.ccut.edu.cn/index2/html/java/Que.Special.Edition.Using.Java.2.Standard.Edition.internal.eBook-
LiB/ch23lev1sec7.html

Videos Resources
http://www.youtube.com/watch?v=yre19cIpYrQ
http://www.youtube.com/watch?v=VFF0JRCFCH0

44 Computer Networks – UDP Socket Programming


EXERCISES

Exercise 7.1: [10]


Write a UDP client/server system in which the client program sends a number between 1 and 10 and the server
program returns the corresponding element in an array of strings e.g.

Client>Input any number between 1 and 10 : 5


Client> Response from server is : Five

Exercise 7.2: [10]


 Write the server side of the application in a file named DayTimeServer.java.
 The DayTimeServer simply listens on port 1078 and as soon as it receives a request from the
DayTimeClient, it returns the current Date on the server using the following function of the java.util
package Date now = new Date();
 Similarly you need to write the client side of the application in a file named DayTimeClient.java.
 The client simply sends a request to the server when it is run and the server returns the current Date at the
server as mentioned above.

45 Computer Networks – UDP Socket Programming


EXPERIMENT 8 – TCP SOCKET PROGRAMMING
Objective
 Client sends request to Server using port using TCP
 Server Accept the Client request and setup a communication path
Time Required : 3 hrs
Programming Language : JDK 7.0 (Latest)
Software Required : NetBeans IDE
Hardware Required : NIL

TCP/IP and UDP/IP communications


There are two communication protocols that one can use for socket programming:
 Datagram communication
 Stream communication.

Stream communication
The stream communication protocol is known as TCP (transfer control protocol). Unlike UDP, TCP is a
connection-oriented protocol. In order to do communication over the TCP protocol, a connection must first be
established between the pair of sockets. While one of the sockets listens for a connection request (server), the
other asks for a connection (client). Once two sockets have been connected, they can be used to transmit data in
both (or either one of the) directions.

In short, TCP is useful for implementing network services such as remote login (rlogin, telnet) and file transfer
(FTP) which require data of indefinite length to be transferred. UDP is less complex and incurs fewer overheads.
It is often used in implementing client/server applications in distributed systems built over local area networks.

How Client contacts with server


Client Creates local TCP socket by specifying IP address, port number of server process. When client creates
socket then Client TCP establishes connection to server TCP. When contacted by client, server TCP creates new
socket for server process to communicate with client
 allows server to talk with multiple clients
 source port numbers used to distinguish clients

Client/Server socket interaction

46 Computer Networks – TCP Socket Programming


Sockets using TCP connection
Opening a socket: If you are programming a client, then you would open a socket like this:

Where Machine name is the machine you are trying to open a connection to, and PortNumber is the port (a
number) on which the server you are trying to connect to is running. When selecting a port number, you should
note that port numbers between 0 and 1,023 are reserved for standard protocols, such as SMTP, FTP, and HTTP.
When selecting a port number for your server, select one that is greater than 1023.

If you are programming a server, then this is how you open a socket:

When implementing a server you also need to create a socket object from the ServerSocket in order to listen for
and accept connections from clients.

Creating an input stream: On the client side you can use the BufferedReader class to create an input stream to
receive response from the server:

47 Computer Networks – TCP Socket Programming


Creating an output stream:- On the client side, you can create an outputstream to send information to the
server socket using the class PrintWriter.

Closing sockets:- You should always close the output and input stream before you close the socket.

TCP client-server application:


In this example
 client reads line from standard input (inFromUser stream) , sends to server via socket (outToServer stream)
 server reads line from socket
 server converts line to uppercase, sends back to client
 client reads, prints modified line from socket (inFromServer stream)

Activity 8.1 : TCP Client-Server Application (TCPServer.java)


import java.io.*;
import java.net.*;
class TCPServer {
public static void main(String argv[]) throws Exception
{
String clientSentence;
String capitalizedSentence;
ServerSocket welcomeSocket = new ServerSocket(6789);

while(true) {
Socket connectionSocket = welcomeSocket.accept();
BufferedReader inFromClient = new BufferedReader(new
InputStreamReader(connectionSocket.getInputStream()));
DataOutputStream outToClient =
new DataOutputStream(connectionSocket.getOutputStream());

48 Computer Networks – TCP Socket Programming


clientSentence = inFromClient.readLine();
capitalizedSentence = clientSentence.toUpperCase() + '\n';
outToClient.writeBytes(capitalizedSentence);
}
}
}
Note:- The port no can be change according to your requirements

(TCPClient.java)
import java.io.*;
import java.net.*;
class TCPClient {
public static void main(String argv[]) throws Exception
{
String sentence;
String modifiedSentence;
BufferedReader inFromUser=new BufferedReader(new InputStreamReader(System.in));
Socket clientSocket = new Socket("hostname", 6789);
DataOutputStream outToServer =
new DataOutputStream(clientSocket.getOutputStream());
BufferedReader inFromServer = new BufferedReader(new
InputStreamReader(clientSocket.getInputStream()));
sentence = inFromUser.readLine();
outToServer.writeBytes(sentence + '\n');
modifiedSentence = inFromServer.readLine();
System.out.println("FROM SERVER: " + modifiedSentence);
clientSocket.close();

}
}
Note:- Hostname and port no can be change according to your requirements

Summary
In this lab practical students understand the TCP fundamental concepts of socket programming and learn how to
setup server and establish communication between client and server using TCP protocol.

Web Resources
http://systembash.com/content/a-simple-java-tcp-server-and-tcp-client/
http://www.cise.ufl.edu/~amyles/tutorials/tcpchat/

Videos Resources
http://www.youtube.com/watch?v=jli6XTzmRnU
http://www.youtube.com/watch?v=3zg0fZeVou0
http://www.youtube.com/watch?v=jGCUhjIHZ6k

49 Computer Networks – TCP Socket Programming


EXERCISES
Exercise 8.1: [5]
Write a client Server Application in which, clients sends four digit numbers i.e., “3145” to server. Server sends back the
sum of all digits to client i.e., 13. Use Socket and port of your choice.

Exercise 8.2: [5]


Write a program that will count the number of lines in file that is specified on the command line. Assume that the files are
text files and placed in c:\ driver of server. Write file name, along with the number of lines in that file, to standard output
at the client end. If an error occurs while trying to read from the files, you should print an error message.

Bonus Exercise: Multi Threaded Application

Write a client/server system in which each any number of client programs can send a message to a server program which
rebroadcasts the message to all the clients who are connected to server.

50 Computer Networks – TCP Socket Programming


EXPERIMENT 9 – A COMPLETE CLIENT-SERVER APPLICATION
EXPERIMENT 9– OPEN ENDED LAB (Computer Networks)

OBJECTIVE

The DNS server contains a database of IP addresses and their corresponding domain names. The domain name
system (i.e., “DNS”) is responsible for translating domain names into a specific IP address and also translating
IP address to name. Therefore, Students are required to create a network application to demonstrate the Domain
Name System (DNS) Server using any suitable development tool and a database management system to store IP and
name information.

TASK

Your experiment should be

 To create a table according to DNS application requirements in the database


 To Design a suitable interface to register (add the entry in the database), resolve (verify or validate an
entry using a name or IP) and delete (remove an entry from the database).

LAB REPORT

Your lab report should include the following sections:

Purpose

This is a statement of the problem to be carried out. It provides the overall direction for laboratory
experiments and must be addressed in the conclusion.

Sofware / Equipment

 A list of all laboratory equipment (Hardware) used to set up the system


 A list of all tools (software) used during the development of the online web application system.

Procedure

 Step-by-step procedure carefully explained in a numbered sequence.

51 Computer Networks – A Complete Client-Server Application


EXPERIMENT 10 – DHCP CONFIGURATION / IP SUBNETTING
Objective
 Configure a DHCP Server
 Capture and analyze DHCP traffic generated
Time Required : 3 hrs
Programming Language : NIL
Software Required : Ethereal & WinPCap software
Hardware Required : Router and USB Wifi Cards

DHCP (Dynamic Host Configuration Protocol)


DHCP is a client/server protocol that automatically provides an IP host with its IP address and other related
configuration information such as the subnet mask and default gateway. DHCP allows hosts to obtain all
necessary TCP/IP configuration information from a DHCP server.

Configure your computer

For this lab we will make all the lab computers as hosts on their respective
network. Thus at every computer modify the network configurations as
follows:
Setup the first computer in every network as a DHCP server and have the
other computers in the group point to it as DHCP clients. Thus computer
192.168.1.1 –which will be configured as DHCP server has static IP but
all the clients get IP address from the server.

Configure Windows 2003 as a DHCP Client

Right-click on “My Network Places” on desktop and select properties.


Select any one of the local area connections and click. Click Properties.
Local Area connection properties window appears. Select Internet
Protocol (TCP/IP) and click Properties. Internet Protocol (TCP/IP)
Properties window appears. Select the radio button ‘obtain an IP address
automatically’.

Overview of Configured Router


Step1: Connection setup with router
1. Connect the Router with computer system via UTP cable.
2. Assign and IP address to system from the same network as mentioned on router backside.
3. Open command prompt and test connectivity with router using ping command.

Step2: Connecting router using web interface.


1. Open the web browser and enter http://192.168.0.1 (The IP which is written on router back side).
2. Web logon screen is shown and asking to enter username and password
Router default log in information:
Username : admin
Password : admin

After successful login the Router Status, showing the current setting will be shown.
52 Computer Networks – DHCP Configuration / IP Subnetting
Step2: LAN Setting.
You can change the default IP address (192.168.0.1) of router according to local network. Click on Network in
the left panel and select LAN then assign a new IP address. Click to save the setting.

53 Computer Networks – DHCP Configuration / IP Subnetting


Step3: WAN Setting.
Click on Network in the left panel and select WAN then assign a new network setting from where you are
getting the internet.

Step4: Wireless Setting.


Click on Wireless in the left panel and select Wireless setting then assign a SSID and PSK to connect the
wireless network.

54 Computer Networks – DHCP Configuration / IP Subnetting


Step5: DHCP Setting.
Click on DHCP in the left panel and select DHCP setting then provide a range (Starting and Ending IP address)
from which the client gets it IP address including other network setting like gateway, DNS etc.

Step6: DHCP Client List.


Click on DHCP in the left panel and select DHCP Clients List, which shows the client that has the ip address
from the given range. This list also shows the MAC address of client.

55 Computer Networks – DHCP Configuration / IP Subnetting


Step7: DHCP Address Reservation.
Click on DHCP in the left panel and select Address Reservation, which shows the clients that has the
reservation of IP address. IP address is bind with MAC address.

Summary
In this lab practical students understand the how to configure and use DHCP service in networking environment.
Further they will analyse the network traffic.

Web Resources
http://www.ucs.cam.ac.uk/support/windows-support/winsuptech/activedir/dnsconfig
http://support.microsoft.com/kb/323416

Videos Resources
http://www.youtube.com/watch?v=fwdr761s5U8
http://www.youtube.com/watch?v=kwnKoQqI2Cs

56 Computer Networks – DHCP Configuration / IP Subnetting


EXERCISES

Capture DHCP traffic


We will use Ethereal software to capture DHCP traffic. In order to install this software, we need to install
WinPCap software first. Then, we should install the Ethereal software. After installation, follow these steps.

 Run the Ethereal software. From the Capture Menu click Start. In the window that pops up choose the
appropriate network interface and Click Ok.
 Generate DHCP traffic by using the commands ipconfig /release and ipconfig /renew at the DHCP client.
Stop the DHCP capture.

Exercise 10.1: [1]


What is the use of port numbers 68 and 67?

Exercise 10.2: [2]


Why is that the Source IP address of the DHCP Discover all 0s?

Exercise 10.3: [2]


Why is that the Destination IP address of the DHCP Discover all 1s?

Exercise 10.4: [2]


What is the use of physical address in DHCP?

Exercise 10.5: [2]


Why is the Destination IP address of DHCP Offer all 1s?

57 Computer Networks – DHCP Configuration / IP Subnetting


EXPERIMENT 11 – ROUTER CONFIGURATION AND ROUTING (STATIC &
DYNAMIC USING RIP)
Objective
 Learn how to configure routers interfaces.
 Students will Setup IP addressing scheme using Class B networks
 Configure static route in routers.
Time Required : 3 hrs
Programming Language : NIL
Software Required : Packet Tracer
Hardware Required : NIL

Routing
Routing is a term for the set of protocols that determine the path that data follows in order to travel across
multiple networks from its source to its destination. Data is routed from its source to its destination through a
series of routers, and across multiple networks. There are two type of routing Static & Dynamic.

Static routing:
It is a form of routing that occurs when a router uses a manually-configured routing entryto forward traffic.

Dynamic routing: Dynamic routing is a networking technique that provides optimal data routing. Unlike static
routing, dynamic routing enables routers to select paths according to real-time logical network layout changes.
In dynamic routing, the routing protocol operating on the router is responsible for the creation, maintenance and
updating of the dynamic routing table.There are two major classes of dynamic routing protocols Distance
Vector & Link State.

Distance Vector:Distance vector protocols (a vector contains both distance and direction), such as RIP,
determine the path to remote networks using hop count as the metric. A hop count is defined as the number of
times a packet needs to pass through a router to reach a remote destination. For IP RIP, the maximum hop is 15.
A hop count of 16 indicates an unreachable network. Two versions of RIP exist: version 1 and version 2.

RIPv1 uses local broadcasts to share routing information. These updates are periodic in nature, occurring, by
default, every 30 seconds. To prevent packets from circling around a loop forever, both versions of RIP solve
counting to infinity by placing a hop count limit of 15 hops on packets. Any packet that reaches the sixteenth
hop will be dropped.
 Supports only classful routing (Does not support VLSM).
 No authentication.
 RIPv1 uses Broadcast.

RIPv2 uses multicasts instead of broadcasts. RIPv2 supports triggered updates. when a change occurs, a RIPv2
router will immediately propagate its routing information to its connected neighbours. RIPv2 is a classless
protocol and it supports variable-length subnet masking (VLSM).

58 Computer Networks – Router Configuration and use of RIP


 Supports classless routing (Supports VLSM). RIPv2 incorporates the addition of the network mask in the
update to allow classless routing advertisements.
 Authentication is available.
 RIPv2 uses multi-cast instead of broadcast. multicast communication reduces the burden on the network
devices that do not need to listen to RIP updates.

Topology Diagram

Background / Preparation
By using Packet Tracer, draw a network similar to the one shown in the diagram. Any router that meets the
interface requirements displayed on the above diagram may be used. For example, router series 800, 1600, 1700,
2500, and 2600 or any such combination can be used. Perform the following steps on each router unless
specifically instructed otherwise.
Double click on the first router and a configuration window will pop up. On Physical tab, choose WIC-2T as the
interface of the router. You only need to drag and drop the interface to the available slot. Hint: you have to
make sure the router is “Off” before you slot in the interface and switch it on back right after you slot in the
interface.

Then, go to CLI tab of the window. This is actually the IOS Command Line Interface of this router where you
type all necessary commands to configure a router.

General Configuration Tips


59 Computer Networks – Router Configuration and use of RIP
 Use the question mark (?) and arrow keys to help enter commands.
 Each command mode restricts the set of available commands. If there is difficulty entering a command,
check the prompt and then enter the question mark (?) for a list of available commands. The problem might
be a wrong command mode or using the wrong syntax.
 To disable a feature, enter the keyword no before the command.
 There is some important information you need to know pertaining to configuring a router especially on the
Router Command Mode. Please refer the table attached.

Step 1 : Configure the hostname and passwords on the router GAD


 Press Enter button of your keyboard
 Enter enable at the user mode prompt. Hint: User mode prompt is where you see Router>
 Follow the command listed below
Router>enable
Router#configure terminal
Router(config)#hostname GAD
GAD(config)#enable secret class
GAD(config)#line console 0
GAD(config-line)#password cisco
GAD(config-line)#login
GAD(config-line)#line vty 0 4
GAD(config-line)#password cisco
GAD(config-line)#login
GAD(config-line)#exit
GAD(config)#

Step 2:Configure serial interface Serial 0 on router GAD


 From the global configuration mode, configure interface Serial 0 on router GAD.
GAD(config)#interface serial 0
GAD(config-if)#ip address 172.17.0.1 255.255.0.0
GAD(config-if)#clock rate 64000
GAD(config-if)#no shutdown
GAD(config-if)#exit

60 Computer Networks – Router Configuration and use of RIP


Step 3:Configure the fastethernet 0 interface on router GAD
GAD(config)#interface fastethernet 0
GAD(config-if)#ip address 172.16.0.1 255.255.0.0
GAD(config-if)#no shutdown
GAD(config-if)#exit

Step 4:Configure the IP host statements on router GAD


GAD(config)#ip host BHM 172.18.0.1 172.17.0.2

Step 5:Configure RIP routing on router GAD


GAD(config)#router rip
GAD(config-router)#network 172.16.0.0
GAD(config-router)#network 172.17.0.0
GAD(config-router)#exit
GAD(config)#exit

Step 6:Save the GAD router configuration


GAD#copy running-config startup-config
Destination filename [startup-config]?[Enter]

Step 7:Configure hostname and passwords on the router BHM


 Go to the second router and repeat the whole process starting with choosing the WIC-2T interface, slotting
in the interface to the router and so on.
 Type the following commands on CLI of second router.
 Enter enable at the user mode prompt.
Router>enable
Router#configure terminal
Router(config)#hostname BHM
BHM(config)#enable secret class
BHM(config)#line console 0
BHM(config-line)#password cisco
BHM(config-line)#login
BHM(config-line)#line vty 0 4
BHM(config-line)#password cisco
BHM(config-line)#login
BHM(config-line)#exit
BHM(config)#

Step 8:Configure serial interface Serial 0 on router BHM


 From the global configuration mode, configure interface Serial 0 on router BHM.
BHM(config)#interface serial 0
BHM(config-if)#ip address 172.17.0.2 255.255.0.0
BHM(config-if)#no shutdown
BHM(config-if)#exit

Step 9:Configure the fastethernet 0 interface on router BHM


BHM(config)#interface fastethernet 0
BHM(config-if)#ip address 172.18.0.1 255.255.0.0
BHM(config-if)#no shutdown
BHM(config-if)#exit

Step 10: Configure the IP host statements on router BHM


BHM(config)#ip host GAD 172.16.0.1 172.17.0.1

61 Computer Networks – Router Configuration and use of RIP


Step 11: Configure RIP routing on router BHM
BHM(config)#router rip
BHM(config-router)#network 172.18.0.0
BHM(config-router)#network 172.17.0.0
BHM(config-router)#exit
BHM(config)#exit

Step 12: Save the BHM router configuration

Step 13: Configure the hosts with the proper IP address, subnet mask, and default gateway
 Host connected to router GAD
IP Address: 172.16.0.2
Subnet mask: 255.255.0.0
Default gateway: 172.16.0.1

 Host connected to router BHM


IP Address: 172.18.0.2
Subnet mask: 255.255.0.0
Default gateway: 172.18.0.1

Summary
In this lab practical students understand the basic configuration of router. Further they will configure the static
and dynamic routing.

Web Resources
http://www.informit.com/library/content.aspx?b=CCNP_Studies_Routing&seqNum=22
http://computernetworkingnotes.com/routing-static-dynamics-rip-ospf-igrp-eigrp/basic-router-
configurations.html
http://computernetworkingnotes.com/routing-static-dynamics-rip-ospf-igrp-eigrp/basic-static-route.html

Videos Resources
http://www.youtube.com/watch?v=ZqT8F6IW9uI
http://www.youtube.com/watch?v=yeKgeiuZZoE

62 Computer Networks – Router Configuration and use of RIP


EXERCISES
Exercise 11.1: [2]
Verify that the internetwork is functioning by ping the Fast Ethernet interface of the other router
 From the host attached to GAD, ping the BHM router Fast Ethernet interface. Was the ping successful?
_____________
 From the host attached to BHM, ping the GAD router Fast Ethernet interface. Was the ping successful?
_____________
 If the answer is no for either question, troubleshoot the router configurations to find the error.
 Then do the pings again until the answer to both questions is yes. Then ping all interfaces in the network.

Exercise 11.2: [3]


Show the routing tables for each router
 From the enable privileged EXEC mode: Examine and write the routing table entries, using the show ip
route command on each router.
 What are the entries in the GAD routing table?____________________________________________
 What are the entries in the BHM routing table?____________________________________________

63 Computer Networks – Router Configuration and use of RIP


Exercise 11.3: [5]
Show the routing tables for each router

64 Computer Networks – Router Configuration and use of RIP


EXPERIMENT 12 – DYNAMIC ROUTING USING OSPF
Objective
 Learn how to configure routers interfaces.
 Students will understand the basics of OSPF
 Configure Dynamic Routing using OSPF.
Time Required : 3 hrs
Programming Language : NIL
Software Required : Packet Tracer
Hardware Required : NIL

Link state routing protocols


This class of protocols maintain complete road map of the network in each router running a link state routing
protocol. Each router running a link state routing protocol originates information about the router, its directly
connected links, and the state of those links. This information is sent to all the routers in the network
as multicast messages. Link-state routing always try to maintain full networks topology by updating itself
incrementally whenever a change happen in network.

Each router in the network keeps a copy of it, without changing it. After obtaining the complete picture of
network topology, each router will independently calculate its own best paths to reach the destination networks.
An example of Link State protocol is OSPF (Open Shortest Path First).

The OSPF database is populated with link-state advertisements (LSAs) from neighboring routers. The LSA
packets contain information, such as cost and the advertising router or the router ID, which is the highest IP
address configured on the local router. Typically, OSPF administrators configure loopback interfaces to ensure
that the OSPF process is not prone to failures.

Creating Wildcard Masks


WILDCARD MASK used for configuration of OSPF.Just like a subnet mask the wildcard mask tells the router
what part of the address to check or ignore. Zero (0) must match exactly; one (1) will be ignored.
• The source address can be a single address, a range of addresses, or an entire subnet.
• As a rule of thumb the wildcard mask is the reverse of the subnet mask.

Example #1:
IP Address and subnet mask: 204.100.100.0 255.255.255.0
IP Address and wildcard mask: 204.100.100.0 0.0.0.255

• All zero’s (or 0.0.0.0) means the address must match exactly.
Example #2:
10.10.150.95 0.0.0.0 (This address must match exactly.)

• One’s will be ignored.


Example #3:
10.10.150.95 0.0.0.255 (Any 10.10.150.0 subnet address will match.10.10.150.0 to
10.10.150.255)

• This also works with subnets.


Example #4:
IP Address and subnet mask: 192.170.25.30 255.255.255.224
65 Computer Networks – Router Configuration and use of RIP
IP Address and wildcard mask: 192.170.25.30 0.0.0.31
(Subtract the subnet mask from
255.255.255.255 to create the wildcard)

Do the math... 255 - 255 = 0 (This is the inverse of the subnet mask.)
255 - 224 = 31

Topology Diagram

Addressing Table

Step 1: Configure the routers

66 Computer Networks – Router Configuration and use of RIP


On the routers, enter global configuration mode and configure the hostname as shown onthe chart.
Thenconfigure the console, virtual terminal lines password (both “cisco”) andprivileged EXEC password
(“class”):

Step 2: Disable DNS lookup


Router(config)#no ip domain-lookup

Step 3: Configure the interfaces on R1, R2, and R3


Configure the interfaces on the R1, R2, and R3 routers with the IP addresses from the tableunder the Topology
Diagram.

Step 4: Verify IP addressing and interfaces


Use the show ip interface brief command to verify that the IP addressing is correct and that the interfaces
are active.

Step 5: Configure Ethernet interfaces of PC1, PC2, and PC3


Configure the Ethernet interfaces of PC1, PC2, and PC3 with the IP addresses and default gateways from the
table under the Topology Diagram.

Task: Configure OSPF on the R1 Router

Step 1: Use the router ospf command in global configuration mode to enable OSPF on the R1 router.

Enter a process ID of 1 for the process-ID parameter.

R1(config)#router ospf 1
R1(config-router)#

Step 2: Configure the network statement for the LAN network.

Once you are in the Router OSPF configuration sub-mode, configure the LAN network 172.16.1.16/28 to be
included in the OSPF updates that are sent out of R1.

The OSPF network command uses a combination of network-address and wildcard-mask similar to that which
can be used by EIGRP. Unlike EIGRP, the wildcard mask in OSPF is required.

Use an area ID of 0 for the OSPF area-id parameter. 0 will be used for the OSPF area ID in all of the network
statements in this topology.

R1(config-router)#network 172.16.1.16 0.0.0.15 area 0


R1(config-router)#

Step 3: Configure the router to advertise the 192.168.10.0/30 network attached to the Serial0/0/0 interface.

R1(config-router)# network 192.168.10.0 0.0.0.3 area 0


R1(config-router)#

Step 4: Configure the router to advertise the 192.168.10.4/30 network attached to theSerial0/0/1 interface.

67 Computer Networks – Router Configuration and use of RIP


R1(config-router)# network 192.168.10.4 0.0.0.3 area 0
R1(config-router)#

Step 5: When you are finished with the OSPF configuration for R1, return to privileged EXEC mode.

R1(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
R1#

Task: Configure OSPF on the R2 and R3 Routers

Step 1: Enable OSPF routing on the R2 router using the router ospf command.

Use a process ID of 1.

R2(config)#router ospf 1
R2(config-router)#

Step 2: Configure the router to advertise the LAN network 10.10.10.0/24 in the OSPFupdates.

R2(config-router)#network 10.10.10.0 0.0.0.255 area 0


R2(config-router)#

Step 3: Configure the router to advertise the 192.168.10.0/30 network attached to theSerial0/0/0 interface.

R2(config-router)#network 192.168.10.0 0.0.0.3 area 0


R2(config-router)#
00:07:27: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.10.5 on Serial0/0/0from EXCHANGE to FULL,
Exchange Done

Notice that when the network for the serial link from R1 to R2 is added to the OSPF configuration,the router
sends a notification message to the console stating that a neighbor relationship withanother OSPF router has
been established.

Step 4: Configure the router to advertise the 192.168.10.8/30 network attached to theSerial0/0/1 interface.

R2(config-router)#network 192.168.10.8 0.0.0.3 area 0


R2(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
R2#

Step 5: Configure OSPF on the R3 router using the router ospf and network commands.

Use a process ID of 1. Configure the router to advertise the three directly connected networks. When you are
finished, return to privileged EXEC mode.

R3(config)#router ospf 1
R3(config-router)#network 172.16.1.32 0.0.0.7 area 0
R3(config-router)#network 192.168.10.4 0.0.0.3 area 0
R3(config-router)#
00:17:46: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.10.5 on Serial0/0/0 from LOADING to FULL,
Loading Done
R3(config-router)#network 192.168.10.8 0.0.0.3 area 0
R3(config-router)#
68 Computer Networks – Router Configuration and use of RIP
00:18:01: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.10.9 on Serial0/0/1 from EXCHANGE to
FULL, Exchange Done
R3(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
R3#

Notice that when the networks for the serial links from R3 to R1 and R3 to R2 are added to the OSPF
configuration, the router sends a notification message to the console stating that a neighbor relationship with
another OSPF router has been established.

Task: Verify OSPF Operation

Step 1: On the R1 router, Use the show ip ospf neighbor command to view the information about
the OSPF neighbor routers R2 and R3.
You should be able to see the neighbor ID and IP address of each adjacent router, and the interface that R1 uses
to reach that OSPF neighbor.

R1#show ip ospf neighbor


Neighbor ID Pri State Dead Time Address Interface
10.2.2.2 0 FULL/- 00:00:32 192.168.10.2 Serial0/0/0
10.3.3.3 0 FULL/- 00:00:32 192.168.10.6 Serial0/0/1
R1#

Step 2: On the R1 router, use the show ip protocols command to view informationabout the
routing protocol operation.

Notice that the information that was configured in the previous Tasks, such as protocol, process ID, neighbor ID,
and networks, is shown in the output. The IP addresses of the adjacent neighbors are also shown.

R1#show ip protocols

Routing Protocol is "ospf 1"


Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 10.1.1.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
172.16.1.16 0.0.0.15 area 0
192.168.10.0 0.0.0.3 area 0
192.168.10.4 0.0.0.3 area 0
Routing Information Sources:
Gateway Distance Last Update
10.2.2.2 110 00:11:43
10.3.3.3 110 00:11:43
Distance: (default is 110)
R1#

Notice that the output specifies the process ID used by OSPF. Remember, the process ID must be the same on
all routers for OSPF to establish neighbor adjacencies and share routing information.

Task: Examine OSPF Routes in the Routing Tables

View the routing table on the R1 router. OSPF routes are denoted in the routing table with an “O”.

69 Computer Networks – Router Configuration and use of RIP


R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B -BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS
inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.1.1.1/32 is directly connected, Loopback0
O 10.10.10.0/24 [110/65] via 192.168.10.2, 00:01:02, Serial0/0/0

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks


C 172.16.1.16/28 is directly connected, FastEthernet0/0
O 172.16.1.32/29 [110/65] via 192.168.10.6, 00:01:12, Serial0/0/1

192.168.10.0/30 is subnetted, 3 subnets


C 192.168.10.0 is directly connected, Serial0/0/0
C 192.168.10.4 is directly connected, Serial0/0/1
O 192.168.10.8 [110/128] via 192.168.10.6, 00:01:12, Serial0/0/1
[110/128] via 192.168.10.2, 00:01:02, Serial0/0/0
R1#

Notice that unlike RIPv2 and EIGRP, OSPF does not automatically summarize at major network boundaries.

Task: Configure OSPF Cost

Step 1: Use the show ip route command on the R1 router to view the OSPF cost to reach the
10.10.10.0/24 network.

R1#show ip route

<output omitted, Not to be discuss>

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks


C 10.1.1.1/32 is directly connected, Loopback0
O 10.10.10.0/24 [110/65] via 192.168.10.2, 00:16:56, Serial0/0/0

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks


C 172.16.1.16/28 is directly connected, FastEthernet0/0
O 172.16.1.32/29 [110/65] via 192.168.10.6, 00:17:06, Serial0/0/1

192.168.10.0/30 is subnetted, 3 subnets


C 192.168.10.0 is directly connected, Serial0/0/0
C 192.168.10.4 is directly connected, Serial0/0/1
O 192.168.10.8 [110/128] via 192.168.10.6, 00:17:06, Serial0/0/1
[110/128] via 192.168.10.2, 00:16:56, Serial0/0/0
R1#
Step 2: Use the show interfaces serial0/0/0 command on the R1 router to view thebandwidth
of the Serial 0/0/0 interface.

R1#show interfaces serial0/0/0

Serial0/0/0 is up, line protocol is up (connected)

70 Computer Networks – Router Configuration and use of RIP


Hardware is HD64570
Internet address is 192.168.10.1/30
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, rely 255/255, load1/255
Encapsulation HDLC, loopback not set, keepalive set (10 sec)
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0 (size/max/drops); Total output drops: 0
<output omitted, Not to be discuss>

On most serial links, the bandwidth metric will default to 1544 Kbits. If this is not the actual bandwidth of the
serial link, the bandwidth will need to be changed so that the OSPF cost can be calculated correctly.

Step 3: Use the bandwidth command to change the bandwidth of the serial interfaces of the R1 and R2
routers to the actual bandwidth, 64 kbps.

R1 router:
R1(config)#interface serial0/0/0
R1(config-if)#bandwidth 64
R1(config-if)#interface serial0/0/1
R1(config-if)#bandwidth 64

R2 router:
R2(config)#interface serial0/0/0
R2(config-if)#bandwidth 64
R2(config)#interface serial0/0/1
R2(config-if)#bandwidth 64

Step 4: Use the show ip ospf interface command on the R1 router to verify the cost of the serial
links.

The cost of each of the Serial links is now 1562, the result of the calculation: 108/64,000 bps.

R1#show ip ospf interface

<output omitted, Not to be discuss>


Serial0/0/0 is up, line protocol is up
Internet address is 192.168.10.1/30, Area 0
Process ID 1, Router ID 10.1.1.1, Network Type POINT-TO-POINT, Cost:1562
Transmit Delay is 1 sec, State POINT-TO-POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:05
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1 , Adjacent neighbor count is 1
Adjacent with neighbor 10.2.2.2
Suppress hello for 0 neighbor(s)

Serial0/0/1 is up, line protocol is up


Internet address is 192.168.10.5/30, Area 0
Process ID 1, Router ID 10.1.1.1, Network Type POINT-TO-POINT, Cost:1562
Transmit Delay is 1 sec, State POINT-TO-POINT,
<output omitted, Not to be discuss>

Step 5: Use the ip ospf cost command to configure the OSPF cost on the R3 router.
71 Computer Networks – Router Configuration and use of RIP
An alternative method to using the bandwidth command is to use the ip ospf cost command, which allows you
to directly configure the cost. Use the ip ospf cost command to change the bandwidth of the serial interfaces of
the R3 router to 1562.

R3(config)#interface serial0/0/0
R3(config-if)#ip ospf cost 1562
R3(config-if)#interface serial0/0/1
R3(config-if)#ip ospf cost 1562

Step 6: Use the show ip ospf interface command on the R3 router to verify that thecost of the link
the cost of each of the Serial links is now 1562.

R3#show ip ospf interface


<output omitted, Not to be discuss>
Serial0/0/1 is up, line protocol is up
Internet address is 192.168.10.10/30, Area 0
Process ID 1, Router ID 10.3.3.3, Network Type POINT-TO-POINT, Cost:1562
Transmit Delay is 1 sec, State POINT-TO-POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:06
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1 , Adjacent neighbor count is 1
Adjacent with neighbor 10.2.2.2
Suppress hello for 0 neighbor(s)

Serial0/0/0 is up, line protocol is up


Internet address is 192.168.10.6/30, Area 0
Process ID 1, Router ID 10.3.3.3, Network Type POINT-TO-POINT, Cost:1562
Transmit Delay is 1 sec, State POINT-TO-POINT,
<output omitted, Not to be discuss>

Summary
In this lab practical students understand the dynamic routing using OSPF.

Web Resources
http://routersimulator.certexams.com/router-labs/ospf-routing-configuration-scenario.html
https://perso.ens-lyon.fr/christophe.crespelle/enseignements/ASR/ospf-config.pdf
http://www.chabotcollege.edu/faculty/netacad/prot/sem3/labs/lab_2_3_2.pdf

Videos Resources
http://www.youtube.com/watch?v=iIRXlEG-6S0
http://www.youtube.com/watch?v=PjpdjU5WwR8

72 Computer Networks – Router Configuration and use of RIP


EXERCISES
Exercise 12.1: [2]
Configure OSPF on the R1 Router

Exercise 12.2: [2]


Show the configure OSPF on the R2 and R3 Routers

Exercise 12.3: [4]


Verify OSPF Operation on router R1, R2 and R3

Exercise 12.4: [2]


Configure OSPF Coston Router R1

73 Computer Networks – Router Configuration and use of RIP


EXPERIMENT 13 – ESTABLISHMENT OF ROUTED WAN
Objective
Upon completion of this lab, Students will be able to:
 Create a simple routed wide-area network (WAN) with two PCs, two switches or hubs, and two routers
 Identify the proper cables to connect a PC and router to each switch
 Identify the proper cables to connect the routers to form a WAN link
Time Required : 3 hrs
Programming Language : NIL
Software Required : Packet Tracer
Hardware Required : NIL

Building a Basic Routed WAN


Draw a network as shown below by using any router from 2600 family with appropriate configuration details in
the table and follow all the steps given below:

Step 1:Cable the router LAN links

 Router configuration: The routers should be configured so that the Ethernet 0 interface on each router has
the proper IP address and subnet mask as indicated in the table below. This will allow the routers to route
packets between local-area networks 192.168.1.0 and 192.168.2.0.

 Connection the cables: The connection between the router and the hub or switch will be accomplished
using a Category 5 straight- through patch cable.
74 Computer Networks – Establishment of Routed WAN
Step 2:Verify the physical Ethernet connections [2]
To verify the connections, ensure that the link lights on the both PC NICs, both switch/hub interfaces and router
Ethernet interfaces are lit. Are all link lights lit? _____________________If not, check connections and cable
types.

Step 3:Identify the serial interfaces on the router


 Examine the routers. [4]
 Identify the serial ports on each router that could be used for connecting the routers to simulate a WAN link.
Record the information below. If there is more than one serial interface, use Interface 0 on each router.

Step 4:Cable the router WAN link


Router configuration Router A should be to provide the DCE clock signal on the Serial 0 interface. The Serial
0 interface on each router should have the proper IP address and subnet mast as indicated in the table below.
The network interconnecting the router serial interfaces is 192.168.3.0.

Step 5: Configure Workstation IP settings

Step 6:Verify that PCs can communicate across the WAN [3]
Test connectivity: Ping the IP address of the computer on the other LAN. Enter the following command at the
command prompt on PC-B.
C:>ping 192.168.1.2

Enter the following command at the command prompt on PC-A.

C:>ping 192.168.2.2 [1]

75 Computer Networks – Establishment of Routed WAN


This will test IP connectivity from one workstation through its switch and router across the WAN link and
through the other router and switch to the other PC.

Look for results similar to those shown below. If not, check the PC connections and TCP/IP settings for both
PCs.

What was the ping result?

Summary
In this lab practical students understand the how to establish routed WAN. Further they will learn how to
establish communication between two remote sites.

Web Resources
https://learningnetwork.cisco.com/thread/30322

Videos Resources
http://www.youtube.com/watch?v=W7s5vqCkqtE

76 Computer Networks – Establishment of Routed WAN


EXPERIMENT 14 – ACCESS CONTROL LIST
Objective
 Configure, and apply a standard ACL to permit or deny specific traffic
 Test the ACL to determine if the desired results were achieved.
Time Required : 3 hrs
Programming Language : NIL
Software Required : Packet Tracer
Hardware Required : NIL

Access Control Lists (ACLs)


Access Control Lists (ACLs) allow a router to permit or deny packets based on a variety of criteria. The ACL is
configured in global mode, but is applied at the interface level. An ACL does not take effect until it is expressly
applied to an interface with the ip access-group command. Packets can be filtered as they enter or exit an
interface.

If a packet enters or exits an interface with an ACL applied, the packet is compared against the criteria of the
ACL. If the packet matches the first line of the ACL, the appropriate “permit” or “deny” action is taken. If there
is no match, the second line’s criterion is examined. Again, if there is a match, the appropriate action is taken; if
there is no match, the third line of the ACL is compared to the packet.

This process continues until a match is found, at which time the ACL stops running. If no match is found, a
default “deny” takes place, and the packet will not be processed. When an ACL is configured, if a packet is not
expressly permitted, it will be subject to the implicit deny at the end of every ACL. This is the default behaviour
of an ACL and cannot be changed.

A standard ACL is concerned with only one factor, the source IP address of the packet. The destination is not
considered.

There is an implicit deny at the end of every ACL. If packets are not expressly permitted, they are implicitly
denied.

If Router 3’s Ethernet interface should only accept packets with a source network of 172.12.12.0, the ACL will
be configured like this:

R3#conf t
R3(config)#access-list 5 permit 172.12.12.0 0.0.0.255

The ACL consists of only one explicit line, one that permits packets from source IP address 172.12.12.0 /24.
The implicit deny, which is not configured or seen in the running configuration, will deny all packets not
matching the first line.
The ACL is then applied to the Ethernet0 interface:

R3#conf t
R3(config)#interface e0
R3(config-if)#ip access-group 5 in

In reality, one will probably wish to permit or deny access to a range of hosts rather than just one. Perhaps
you’ll want to control access for all of the hosts on a subnet, or maybe just a subset of hosts. Either way, the
ability to control access for a group of hosts is accomplished using what is known as a wildcard mask.

77 Computer Networks – Access Control List


A wildcard mask is different than a subnet mask but it can be quite confusing. The purpose of the wildcard
mask is to specify which group of addresses an access list entry should apply to. For example, imagine that we
wanted to create a standard IP access list that would deny inbound access on interface E0 to all hosts on
network 192.168.20.0/24. The access list entry would be:

RouterA(config)#access-list 40 deny 192.168.20.0 0.0.0.255

In this case, the wildcard mask is 0.0.0.255. The binary 0s in the mask tell the router that the associated bits in
the source address much match exactly. Since the first 3 octets in the wildcard mask are set to binary 0, the
router knows that the first three octets must match 192.168.20. The binary 1s in the mask tell the router to
match any possible value. Since the last octet in the wildcard mask is all binary 1s, the router knows that any
value in the last octet is a match. So, any source address beginning with 192.168.20 would match the access list,
and in this case, be denied.

Please consider the example below. It tells the router to permit traffic from hosts with any address that starts
with 10.10. Since the last two octets are masked, any source address starting with 10.10 will be a match. In this
case, all hosts from 10.10.0.1 to 10.10.255.254 would be permitted access.

RouterA(config)#access-list 40 deny 10.10.0.0 0.0.255.255

A single host can be specified in an access list using either the host command, or a wildcard mask of all 0s. The
wildcard mask of all 0s means “match all octets exactly”. In the example below, only host 192.168.1.100 would
be denied access.

RouterA(config)#access-list 40 deny 192.168.1.100 0.0.0.0

Another example: imagine if we wanted to deny access to a group of 4 addresses starting with 192.168.1.4. In
effect, that means that we want to deny access for addresses between 192.168.1.4 and 192.168.1.7, or 4
addresses total. In this case, the wildcard mask would be 0.0.0.3. At this point, the number looks confusing.

Remember that we want to start at 192.168.1.4 and include 4 addresses. The wildcard mask specifies the bits
that the router should consider when attempting to determine which hosts to permit or deny. In this case, the
mask is 0.0.0.3, which is the equivalent to the following in binary:
00000000 00000000 00000000 00000011

Configure router with ACL


Draw a network as shown below by using any router from 2600 family with appropriate configuration details in
the table and follow all the steps given below:

78 Computer Networks – Access Control List


Step 1:Configure the hostname and passwords on the Router1
On the Router1, enter the global configuration mode and configure the hostname as shown in the table. Then
configure the console, virtual terminal and enable passwords. Configure the FastEthernet interface on the router
according to the table.

Step 2: Configure the hosts on the Ethernet segment [2]


 Host 1
IP address 192.168.14.2
Subnet mask 255.255.255.0
Default gateway 192.168.14.1

 Host 2
IP address 192.168.14.2
Subnet mask 255.255.255.0
Default gateway 192.168.14.1

Step 3:Save the configuration information from the privileged EXEC command mode
GAD#copy running-config startup-config

Step 4:Confirm connectivity by pinging the default gateway from both hosts

If the pings are not successful, correct the configuration and repeat until they are successful.

Step 5:Prevent access to the Ethernet interface from the hosts [2]
 Create an access list that will prevent access to FastEthernet 0 from the 192.168.14.0 network.
 At the router configuration prompt type the following command:
GAD(config)#access-list 1 deny 192.168.14.0 0.0.0.255
GAD(config)#access-list 1 permit any
 Why is the second statement needed?
79 Computer Networks – Access Control List
Step 6:Ping the router from the hosts [1]
 Were these pings successful?
 Why or why not?

Step 7:Apply the Access list to the interface [1]


At the FastEthernet 0 interface mode prompt type the following:
GAD(config-if)#ip access-group 1 in

Step 8:Ping the router from the hosts [1]


 Were these pings successful?
 Why or why not?

Step 9:Create a new access list [2]


 Now create an access list that will not allow the even numbered hosts to ping but permit the odd numbered
hosts to ping.

 What will that access list look like? Finish this command with an appropriate comparison IP address
(aaa.aaa.aaa.aaa) and wildcard mask (www.www.www.www):

access-list 2 permit aaa.aaa.aaa.aaa www.www.www.www

 Why was it not necessary to have the permit any statement at the end this time?

Step 10: Apply access list to the proper router interface [1]
 First remove the old access list application by typing no ip access-group 1 in at the interface configuration
mode.
 Apply the new access list by typing ip access-group 2 in

Step 11: Ping the router from each hosts


 Was the ping from host 1 successful?
 Why or why not?
 Was the ping from host 2 successful?
 Why or why not?

Summary
In this lab practical students understand the purpose of Access list. Further student will learn how to restrict and
allow communication in network.

Web Resources
http://computernetworkingnotes.com/network-security-access-lists-standards-and-extended/extended-access-
list.html

Videos Resources
http://www.youtube.com/watch?v=ruamdadEm08
http://www.youtube.com/watch?v=9IqOeheNK8E

80 Computer Networks – Access Control List


“I hear and I forget,
I see and I remember,
I do and I understand”

Confucius

You might also like