Professional Documents
Culture Documents
Computer Networks
(EE – 353)
Fall -2022
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.
Course Outcomes:
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
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
Instructor
Max. Marks Obtained
Date Experiment Sign
Marks
R1 R2 R3 R4 R5
Grand Total
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.
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.
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.
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
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.
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.
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.
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.
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.
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:
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).
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.
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.
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
OUTPUTS: Draw the graph showing the performance of both topologies between no packet and total time taken in each
session.
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
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
a. What is the time value observed for all four replies? _____________________
b. What is the TTL observed? _____________________
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?
Activity 5.3
Do you think FTP uses safe authentication procedures? If not, why not?
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
Open Wireshark and go to CaptureInterfaces.Select an appropriate Network Interface Card and press
Start to begin capturing packets.
Now apply a filter to capture ICMP packets only.
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.
/* 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 = "\\.";
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
port listen
port
port Connection Client
[b]: session established with temporary ports used for two way communication.
In following activity student will be able to find out open port on Loacal machine.
(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
(Class B : 128-191)
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.
Sending/Receiving Packets
while(true) {
DatagramPacket receivePacket = new DatagramPacket(receiveData,
receiveData.length);
serverSocket.receive(receivePacket);
String sentence = new String(receivePacket.getData());
InetAddress IPAddress = receivePacket.getAddress();
(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
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
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.
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:
Closing sockets:- You should always close the output and input stream before you close the socket.
while(true) {
Socket connectionSocket = welcomeSocket.accept();
BufferedReader inFromClient = new BufferedReader(new
InputStreamReader(connectionSocket.getInputStream()));
DataOutputStream outToClient =
new DataOutputStream(connectionSocket.getOutputStream());
(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
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.
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
LAB REPORT
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
Procedure
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.
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.
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
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.
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).
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.
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
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
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.
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.)
Do the math... 255 - 255 = 0 (This is the inverse of the subnet mask.)
255 - 224 = 31
Topology Diagram
Addressing Table
Step 1: Use the router ospf command in global configuration mode to enable OSPF on the R1 router.
R1(config)#router ospf 1
R1(config-router)#
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.
Step 3: Configure the router to advertise the 192.168.10.0/30 network attached to the Serial0/0/0 interface.
Step 4: Configure the router to advertise the 192.168.10.4/30 network attached to theSerial0/0/1 interface.
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#
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.
Step 3: Configure the router to advertise the 192.168.10.0/30 network attached to theSerial0/0/0 interface.
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.
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.
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.
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
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.
View the routing table on the R1 router. OSPF routes are denoted in the routing table with an “O”.
Notice that unlike RIPv2 and EIGRP, OSPF does not automatically summarize at major network boundaries.
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
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.
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.
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
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 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
Look for results similar to those shown below. If not, check the PC connections and TCP/IP settings for both
PCs.
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
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.
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.
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.
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
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?
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):
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
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
Confucius