Computer Networks Lab Guide
Computer Networks Lab Guide
Series
Lab Manual
Computer
Networks
A simplified practical workbook of Computer Netoworks course for
Computer Science, Information Technology and Software Engineering
students.
Shahid Abid
PREFACE
This lab manual has been prepared to facilitate the students of computer science in studying and analysing
various functions of a computer network. The students will have plan the IP address scheme, configure and
test the several network devices. 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, the students will be familiar with the practical aspects of the various
concepts explained in the course, as well as with the real equipment used nowadays in computer networks.
PREPARED BY
Lab manual is prepared by Mr. Shahid Abid under the supervision of the Director BIIT, Dr. Jamil Sawar.
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 shots to the report by using the ‘Print
Screen’ command on your keyboard to get a snapshot of the output.
c. It is the responsibility of the student to have the lab manual graded as soon as he/she has completed a task.
d. Loss of manual will result in resubmission of the complete manual.
e. Students are required to go through the experiment before attending a lab session.
f. Students must bring the manual during lab session.
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 resubmission
will be entertained.
i. Marks will be deducted for late submission.
j. You need to submit the report even if you have demonstrated the exercises to the lab instructor or shown
them the lab report during the lab session.
VERSION HISTORY
Date Updated by Details
January 2019 Mr. Shahid Abid Version 1.0. Initial draft prepared and experiments outlined.
MARKS
2 TRANSMISSION MEDIA 10
3 CLASSIFICATION OF IP 10
4 IP ADDRESS CONFIGURATION 10
BASIC NETWORKING
5
COMMANDS AT CLI
10
DHCP AND DNS
6
CONFIGURATIONS
10
7 SUBNETTING 10
11 STATIC ROUTING 10
12 DYNAMIC ROUTING 10
FIREWALL ROUTER AND
13
ACCESS CONTROL LIST
10
UNDERSTANDING VIRTUAL
14
LANs
10
WIRELESS ROUTER
CONFIGURATION & NETWORK
15
MONITORING ON FIREWALL
10
ROUTER
Grand Total
LIST OF EXPERIMENTS
EXPERIMENT 1 – INTRODUCTION TO NETWORKING DEVICES ......................................................... 5
EXPERIMENT 2 – TRANSMISSION MEDIA................................................................................................ 7
EXPERIMENT 3 – CLASSIFICATION OF IP .............................................................................................. 10
EXPERIMENT 4 – CONFIGURING IP ......................................................................................................... 12
EXPERIMENT 5 – BASIC NETWORKING COMMANDS AT CLI ........................................................... 15
EXPERIMENT 6 – DHCP AND DNS CONFIGURINGURATIONS ........................................................... 19
EXPERIMENT 7 – SUBNETTING ................................................................................................................ 22
EXPERIMENT 8 – SUBNETTING CLASS A, B AND C ............................................................................. 26
EXPERIMENT 9 – PACKET TRACER SESSIONAND DESIGNING NETWORK TOPOLOGY ............. 29
EXPERIMENT 10 – ROUTER CONFIGURATION ..................................................................................... 35
EXPERIMENT 11 – STATIC ROUTING ...................................................................................................... 37
EXPERIMENT 12 – DYNAMIC ROUTING ................................................................................................. 40
EXPERIMENT 13 – FIREWALL ROUTER AND ACCESS CONTROL LIST ........................................... 42
EXPERIMENT 14 – UNDERSTANDING VIRTUAL LANs ........................................................................ 51
EXPERIMENT 15 – WIRELESS ROUTER CONFIGURATION & NETWORK MONITORING ON
FIREWALL ROUTER .................................................................................................. 53
Shahid Abid CN Lab Manual
EXPERIMENT 1 – INTRODUCTION TO NETWORKING DEVICES
Objective
Lab structure orientation
Study Network Devices
Time Required : 3 hrs
Programming Language : NIL
Software Required : NIL
Hardware Required : Computers with administrative rights
Network Devices
Repeater: Functioning at Physical Layer. A repeater
is an electronic device that receives a signal and
retransmits it with 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 used 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.
EXERCISES
Exercise 1.1 [2]
What is the difference between switch and router?
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.
Objective
Study and implement concepts of IP in windows.
Time Required : 3 hrs
Programming Language : NIL
Software Required : NIL
Hardware Required :
Computer with administrative rights
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.
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
10 Experiment 3 – Classification of IP
Shahid Abid CN Lab Manual
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.
11 Experiment 3 – Classification of IP
Shahid Abid CN Lab Manual
EXPERIMENT 4 – CONFIGURING IP
Objective
Implement concepts of IP in computer network.
Time Required : 3 hrs
Programming Language : NIL
Software Required : NIL
Hardware Required :
Computer with administrative rights
A simple topology is shown below 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.
12 Experiment 4 – Configuring IP
Shahid Abid CN Lab Manual
Exercise 4.3: [5]
Check to make sure that the NICs are installed correctly in each workstation. Plug in the workstations and turn
them on. Plug the straight through cable from workstation 1 into port 1 of the hub and the cable from
workstation 2 into port 2 of the hub. After the workstations have booted, check the green link light on the
back of each NIC and the green lights on ports 1 and 2 of the hub to verify that the are communicating. This
also verifies a good physical connection between the Hub and the NICs in the workstations (OSI Layers 1 and
2). If the link light is not on it usually indicates a bad cable connection, an incorrectly wired cable or the NIC
or hub may not be functioning correctly.
13 Experiment 4 – Configuring IP
Shahid Abid CN Lab Manual
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.
14 Experiment 4 – Configuring IP
Shahid Abid CN Lab Manual
EXPERIMENT 5 – BASIC NETWORKING COMMANDS AT CLI
Objective
Study the IP configuration and packet tracing using MSDOS.
Time Required : 3 hrs
Programming Language : NIL
Software Required : NIL
Hardware Required :
Computer with administrative rights
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 count record route for count hops [3rd layer device]
Activity 5.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
Activity 5.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
(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 5.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.
16 Experiment 5 – Basic Networking Commands at CLI
Shahid Abid CN Lab Manual
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 5.4
To display the routing table.
route PRINT
To add a route a destination
route add <destination> mask <subnetmask> <gateway> metric <number>
ARP Command
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 5.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 5.6
> ipconfig ... Show information.
> ipconfig /all ... Show detailed information
> ipconfig /renew ... renew all adapters
Objective
Configure Windows 2003 as a DHCP Server
Capture and analyze DHCP traffic generated
Learn structure of the Domain Name Server and the role played by Name Servers.
Configure Windows 2003 to use DNS server with various options.
Time Required : 3 hrs
Programming Language : NIL
Software Required : NIL
Hardware Required :
Ethereal software
WinPCap software
Click Next. If needed, add exclusion range and click Add. Click Next. On the lease duration, click Next
unless specified by the instructor.
Select Yes for DHCP configure options and Click Next. If needed specify the router [default gateway]
address and click Add. Click Next.
Understand IP Addresses
An IP address is an address used in order to uniquely identify a device on an IP network. The address is
made up of 32 binary bits, which can be divisible into a network portion and host portion with the help of a
subnet mask. The 32 binary bits are broken into four octets (1 octet = 8 bits). Each octet is converted to
decimal and separated by a period (dot). For this reason, an IP address is said to be expressed in dotted
decimal format (for example, 172.16.81.100). The value in each octet ranges from 0 to 255 decimal, or
00000000 - 11111111 binary.
Here is how binary octets convert to decimal: The right most bit, or least significant bit, of an octet holds a
value of 20. The bit just to the left of that holds a value of 21. This continues until the left-most bit, or most
significant bit, which holds a value of 27. So if all binary bits are a one, the decimal equivalent would be 255
as shown here:
1 1 1 11111
128 64 32 16 8 4 2 1 (128+64+32+16+8+4+2+1=255)
Here is a sample octet conversion when not all of the bits are set to 1.
0 1 000001
0 64 0 0 0 0 0 1 (0+64+0+0+0+0+0+1=65)
And this sample shows an IP address represented in both binary and decimal.
Given an IP address, its class can be determined from the three high-order bits (the three left-most bits in the
first octet). Figure 1 shows the significance in the three high order bits and the range of addresses that fall
into each class. For informational purposes, Class D and Class E addresses are also shown.
22 EXPERIMENT 7 – SUBNETTING
Shahid Abid CN Lab Manual
In a Class A address, the first octet is the network portion, so the Class A example in Figure 1 has a major
network address of 1.0.0.0 - 127.255.255.255. Octets 2, 3, and 4 (the next 24 bits) are for the network
manager to divide into subnets and hosts as he/she sees fit. Class A addresses are used for networks that
have more than 65,536 hosts (actually, up to 16777214 hosts!).
In a Class B address, the first two octets are the network portion, so the Class B example in Figure 1 has a
major network address of 128.0.0.0 - 191.255.255.255. Octets 3 and 4 (16 bits) are for local subnets and
hosts. Class B addresses are used for networks that have between 256 and 65534 hosts.
In a Class C address, the first three octets are the network portion. The Class C example in Figure 1 has a
major network address of 192.0.0.0 - 223.255.255.255. Octet 4 (8 bits) is for local subnets and hosts -
perfect for networks with less than 254 hosts.
Network Masks
A network mask helps you know which portion of the address identifies the network and which portion of
the address identifies the node. Class A, B, and C networks have default masks, also known as natural
masks, as shown here:
Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
23 EXPERIMENT 7 – SUBNETTING
Shahid Abid CN Lab Manual
An IP address on a Class A network that has not been subnetted would have an address/mask pair similar to:
8.20.15.1 255.0.0.0. In order to see how the mask helps you identify the network and node parts of the
address, convert the address and mask to binary numbers.
8.20.15.1 = 00001000.00010100.00001111.00000001
255.0.0.0 = 11111111.00000000.00000000.00000000
Once you have the address and the mask represented in binary, then identification of the network and host
ID is easier. Any address bits which have corresponding mask bits set to 1 represent the network ID. Any
address bits that have corresponding mask bits set to 0 represent the node ID.
8.20.15.1 = 00001000.00010100.00001111.00000001
255.0.0.0 = 11111111.00000000.00000000.00000000
-----------------------------------
net id | host id
netid = 00001000 = 8
hostid = 00010100.00001111.00000001 = 20.15.1
Understand Subnetting
Subnetting allows you to create multiple logical networks that exist within a single Class A, B, or C
network. If you do not subnet, you are only able to use one network from your Class A, B, or C network,
which is unrealistic.
Each data link on a network must have a unique network ID, with every node on that link being a member of
the same network. If you break a major network (Class A, B, or C) into smaller subnetworks, it allows you
to create a network of interconnecting subnetworks. Each data link on this network would then have a
unique network/subnetwork ID. Any device, or gateway, that connects n networks/subnetworks has n
distinct IP addresses, one for each network / subnetwork that it interconnects.
In order to subnet a network, extend the natural mask with some of the bits from the host ID portion of the
address in order to create a subnetwork ID. For example, given a Class C network of 204.17.5.0 which has a
natural mask of 255.255.255.0, you can create subnets in this manner:
204.17.5.0 - 11001100.00010001.00000101.00000000
255.255.255.224 - 11111111.11111111.11111111.11100000
--------------------------|sub|----
By extending the mask to be 255.255.255.224, you have taken three bits (indicated by "sub") from the
original host portion of the address and used them to make subnets. With these three bits, it is possible to
create eight subnets. With the remaining five host ID bits, each subnet can have up to 32 host addresses, 30
of which can actually be assigned to a device since host ids of all zeros or all ones are not allowed (it is very
important to remember this). So, with this in mind, these subnets have been created.
How many bit should be borrowed if maximum of hosts in each subnet is 50?
Perform the complete subnetting exercise showing Network IDs, Broadcast IDs and IP address range in each
subnet.
25 EXPERIMENT 7 – SUBNETTING
Shahid Abid CN Lab Manual
EXPERIMENT 8 – SUBNETTING CLASS A, B AND C
Objective
Subnetting concepts using Class b and Class A and its implementation in LAB.
Time Required : 3 hrs
Programming Language : NIL
Software Required : NIL
Hardware Required : PC with administrative access
Class B Subnetting
The first two octets of a Class B network is used to represent the network and the last two octets are used to
represent the host. The default format for a Class B IPv4 address is Network.Network.Host.Host.
Let us consider an example of Class B network 172.16.0.0 - 255.255.0.0. The binary representation of the
above network and subnet mask is
If all the bits in the host part are "0", that represents the network id.
If all the bits in the host part are "0" except the last bit, it is the first usable IPv4 address.
If all the bits in the host part are "1" except the last bit, it is the last usable IPv4 address.
If all the bits in the host part are "1", that represents the directed broadcast address.
All the IPv4 addresses between the first and last IPv4 addresses (including the first and last) can be used to
configure the devices.
10101100.00010000.0 | 0000000.00000000
11111111.11111111.1 | 0000000.00000000
The network 172.16.0.0 is divided into two networks, each network has 32768 total IPv4 addresses and
32766 usable IPv4 addresses (two IPv4 addresses are used in each subnet to represent the network address
and the directed broadcast address). The subnet mask for one bit subnetting is 255.255.128.0.
10101100.00010000.00 | 000000.00000000
11111111.11111111.11 | 000000.00000000
The network 172.16.0.0 is divided into four networks, each network has 16384 total IPv4 addresses and
16382 usable IPv4 addresses (two IPv4 addresses are used in each subnet to represent the network address
and the directed broadcast address). The subnet mask for one bit subnetting is 255.255.192.0.
8.1.3. What is the broadcast ID for the Network ID you found earlier?
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:
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.
Real-time mode performs the operation with all of the sequence of events happening at “real time”.
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).
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.
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.
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.
OUTPUTS: Draw the graph showing the performance of both topologies between no packet and total time taken in
each session.
Steps:
Switch ON the router (if new router that is not configured it will ask -----
Would u like to enter initial configuration dialog[yes/no]: no
Press return to get started (enter)
Router>
Router#show running-config(enter)
Router#debug xxx
Router#copy xxx
Router#configure terminal(enter)
Router(config)#
Global Configuration Mode - Any configuration change in this mode affects the whole router.
Specific Configuration Mode – configuration changes to specific part of the router like lines and
interfaces.
Router(config)#hostname HOR(enter)
HOR(config)#
Router(config)#service password-encryption
Exercise 10.2. What are the commands to encrypt our passwords? [2.5]
Exercise 10.3. Write commands to set password to the privilege mode? [2.5]
Exercise 10.4. Write commands to set username and password to the user mode? [2.5]
STATIC ROUTING
Static routing is a form of routing that occurs when a router uses a manually-configured routing entry, rather
than information from a dynamic routing traffic. In many cases, static routes are manually configured by a
network administrator by adding in entries into a routing table, though this may not always be the case.
* All interfaces are administratively down when the router is switched on. We change their status to
up by using the command ‘no shutdown’.
** In static routing, we are manually adding the destination network to our Routing table.
Router(config-if)# ip route <dest. N/W> <DSNM> <next hop addr>
Next hop address refers to the address of the next router that receives the packet and then forwards it to the
remote location.
Commands
1 . Router#show running-config
This will display the current configuration of the router.
2 . Router#show controllers serial 0
To identify the DCE & DTE ends of the Serial cable.
3 . Router#show interface ethernet 0
This will displays the details of ethernet interface.
4 . Router#show interface serial 0
This will display the details of serial interface.
5. Router#show ip interface brief
This will display the interface & line protocol status in a tabular format.
Outputs
Router#sh running-config
37 EXPERIMENT 11 – STATIC ROUTING
Shahid Abid CN Lab Manual
interface Ethernet0
ip address 10.0.0.1 255.0.0.0
!
interface Ethernet1
no ip address
shutdown
!
interface Serial0
ip address 20.0.0.2 255.0.0.0
clockrate 64000
!
interface Serial1
no ip address
shutdown
!
IP route 30.0.0.0 255.0.0.0 20.0.0.1
!
line con 0
line aux 0
line vty 0 4
login
!
End
Router#sh int e0
Ethernet0 is up, line protocol is up
Hardware is Lance, address is 0010.7b80.c3c6 (bia 0010.7b80.c3c6)
Internet address is 10.0.0.1/8
MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set, keepalive set (10 sec)
Router#sh int s0
Serial0 is up, line protocol is up
Hardware is HD64570
Internet address is 20.0.0.2/8
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set, keep alive set (10 sec)
Router#show ip int brief
State 1 - When both no shutdown and clock rate is applied to corresponding interfaces
Interface IP-Address OK? Method Status Protocol
Ethernet0 30.0.0.1 YES manual up up
Serial0 20.0.0.2 YES manual up up
Router#show ip int brief
State 2 - When clock rate is not given on DCE end & layer 1 problem
Interface IP-Address OK? Method Status Protocol
Ethernet0 30.0.0.1 YES manual up up
Serial0 20.0.0.2 YES manual up down
Router#show ip int brief
State 3 - When the other end serial interface is shut down
Interface IP-Address OK? Method Status Protocol
Ethernet0 30.0.0.1 YES manual up up
38 EXPERIMENT 11 – STATIC ROUTING
Shahid Abid CN Lab Manual
Serial0 20.0.0.2 YES manual down down
Router#show controllers s 0
HD unit 0, idb = 0xB883C, driver structure at 0xBDB98
buffer size 1524 HD unit 0, V.35 DCE cable, clockrate 64000
Router#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
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
Gateway of last resort is not set
C 20.0.0.0/8 is directly connected, Serial0
C 10.0.0.0/8 is directly connected, Ethernet0
S 30.0.0.0/8 [1/0] via 20.0.0.1
Router#sh protocols
Global values:
Internet Protocol routing is enabled
Ethernet0 is up, line protocol is up
Internet address is 10.0.0.1/8
Ethernet1 is administratively down, line protocol is down
Serial0 is up, line protocol is up
Internet address is 20.0.0.2/8
Serial1 is administratively down, line protocol is down
Difference between
Request timed out
Destination host unreachable
Reply from <ip add> : <byte= > time<xms TTL=xxx
Request timed out
When the packet is lost in transition, we will get “request timed out” message.
Destination host unreachable
If the host doesn’t know the route to the destination - “Destination unreachable” message is displayed i.e.,
the specified address is not present in the routing table
Reply from <ip add> : <byte= > time<xms TTL=xxx
Exercise 11.1. Implement the concept of static routing for the given diagram in LAB 11. [10]
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. In static routing, all these jobs are manually done by the system
administrator.
Dynamic routing uses multiple algorithms and protocols. The most popular are Routing Information
Protocol (RIP), Interior Gateway Routing Protocol (IGRP) () and Open Shortest Path First (OSPF).
The cost of routing is a critical factor for all organizations. The least-expensive routing technology is
provided by dynamic routing, which automates table changes and provides the best paths for data
transmission.
1. The router delivers and receives the routing messages on the router interfaces.
2. The routing messages and information are shared with other routers, which use exactly the same
routing protocol.
3. Routers swap the routing information to discover data about remote networks.
4. Whenever a router finds a change in topology, the routing protocol advertises this topology change to
other routers.
In RIP, we specify only those networks that belong to us. RIP sends routing table updates to its neighbors
for every 30secs. RIP uses hop count as a unit of metric. The administrative distance of RIP is 120
IGRP uses autonomous number system. Here, only the networks that come under the same autonomous
system number will communicate with each other. Autonomous number is provided by ISP. (By default,
networks in different Autonomous system will not communicate, for different Autonomous systems to
communicate redistribution should be done - CCNP concept).
IGRP sends updates for every 90secs and uses bandwidth and delay as unit of metric. IGRP has an
administrative distance of 100
1 . Router#debug ip rip
It shows the updates sent to the neighbor routers for every 30 sec.
2. Router#Clear ip route *
This allows the routing table to switch to the new updates by clearing the old entries.
3 . Router#debug ip igrp transactions
Displays the routing table updates that is sent for every 90sec
4 . Router#Undebug all (u all)
To stop all debug commands those are active.
5 . Router#debug ip routing
Displays the dynamic changes made in the routing table
Exercise 12.1. Implement the concept of static routing for the given diagram in LAB 11. [10]
Firewall (pfsense – Open source Free BSD Unix based firewall) - Features
Filtering by source and destination IP, IP protocol, source and destination port for TCP and UDP traffic
Limit simultaneous connections on a per-rule basis
pfSense software utilizes p0f, an advanced passive OS/network fingerprinting utility to allow you to
filter by the Operating System initiating the connection. Want to allow FreeBSD and Linux machines
to the Internet, but block Windows machines? pfSense software allows for that (amongst many other
possibilities) by passively detecting the Operating System in use.
Option to log or not log traffic matching each rule.
Highly flexible policy routing possible by selecting gateway on a per-rule basis (for load balancing,
failover, multiple WAN, etc.)
Aliases allow grouping and naming of IPs, networks and ports. This helps keep your firewall ruleset
clean and easy to understand, especially in environments with multiple public IPs and numerous
servers.
Transparent layer 2 firewalling capable - can bridge interfaces and filter traffic between them, even
allowing for an IP-less firewall (though you probably want an IP for management purposes).
Packet normalization - Description from the pf scrub documentation - "'Scrubbing' is the normalization
of packets so there are no ambiguities in interpretation by the ultimate destination of the packet. The
scrub directive also reassembles fragmented packets, protecting some operating systems from some
forms of attack, and drops TCP packets that have invalid flag combinations."
o Enabled in the pfSense software by default
o Can disable if necessary. This option causes problems for some NFS implementations, but is
safe and should be left enabled on most installations.
Disable filter - you can turn off the firewall filter entirely if you wish to turn your pfSense software
into a pure router.
State Table
The firewall's state table maintains information on your open network connections.
Port forwards including ranges and the use of multiple public IPs
1:1 NAT for individual IPs or entire subnets.
Outbound NAT
o Default settings NAT all outbound traffic to the WAN IP. In multiple WAN scenarios, the
default settings NAT outbound traffic to the IP of the WAN interface being used.
o Advanced Outbound NAT allows this default behavior to be disabled, and enables the creation
of very flexible NAT (or no NAT) rules.
NAT Reflection - NAT reflection is possible so services can be accessed by public IP from internal
networks.
Multi-WAN functionality enables the use of multiple Internet connections, with load balancing and/or
failover, for improved Internet availability and bandwidth usage distribution.
The pfSense software offers three options for VPN connectivity, IPsec and OpenVPN.
IPsec
IPsec allows connectivity with any device supporting standard IPsec. This is most commonly used for site to
site connectivity to other pfSense installations and most all other firewall solutions (Cisco, Juniper, etc.). It
can also be used for mobile client connectivity.
OpenVPN
OpenVPN is a flexible, powerful SSL VPN solution supporting a wide range of client operating systems.
PPPoE Server
The pfSense software offers a PPPoE server. A local user database can be used for authentication, and
RADIUS authentication with optional accounting is also supported.
RRD Graphs
The RRD graphs in the pfSense software maintain historical information on the following.
CPU utilization
Total throughput
Firewall states
Individual throughput for all interfaces
Packets per second rates for all interfaces
WAN interface gateway(s) ping response times
Traffic shaper queues on systems with traffic shaping enabled
SVG graphs are available that show real time throughput for each interface.
For traffic shaper users, the Status -> Queues screen provides a real time display of queue usage using
AJAX updated gauges.
The front page includes AJAX gauges for display of real time CPU, memory, swap and disk usage,
and state table size.
Dynamic DNS
A Dynamic DNS client is included to allow you to register your public IP with a number of dynamic DNS
service providers.
A client is also available for RFC 2136 dynamic DNS updates, for use with DNS servers like BIND which
support this means of updating.
Captive Portal
Captive portal allows you to force authentication, or redirection to a click through page for network access.
This is commonly used on hot spot networks, but is also widely used in corporate networks for an additional
layer of security on wireless or Internet access. For more information on captive portal technology in general.
The following is a list of features in the pfSense Captive Portal:
Maximum concurrent connections - Limit the number of connections to the portal itself per client IP.
This feature prevents a denial of service from client PCs sending network traffic repeatedly without
authenticating or clicking through the splash page.
Idle timeout - Disconnect clients who are idle for more than the defined number of minutes.
Hard timeout - Force a disconnect of all clients after the defined number of minutes.
Logon pop up window - Option to pop up a window with a log off button.
URL Redirection - after authenticating or clicking through the captive portal, users can be forcefully
redirected to the defined URL.
MAC filtering - by default, pfSense filters using MAC addresses. If you have a subnet behind a router
on a captive portal enabled interface, every machine behind the router will be authorized after one user
is authorized. MAC filtering can be disabled for these scenarios.
Authentication options - There are three authentication options available.
o No authentication - This means the user just clicks through your portal page without entering
credentials.
o Local user manager - A local user database can be configured and used for authentication.
o RADIUS authentication - This is the preferred authentication method for corporate
environments and ISPs. It can be used to authenticate from Microsoft Active Directory and
numerous other RADIUS servers.
RADIUS capabilities
o Forced re-authentication
o Able to send Accounting updates
o RADIUS MAC authentication allows captive portal to authenticate to a RADIUS server using
the client's MAC address as the user name and password.
o Allows configuration of redundant RADIUS servers.
HTTP or HTTPS - The portal page can be configured to use either HTTP or HTTPS.
Pass-through MAC and IP addresses - MAC and IP addresses can be white listed to bypass the portal.
Any machines with NAT port forwards will need to be bypassed so the reply traffic does not hit the
portal. You may wish to exclude some machines for other reasons.
File Manager - This allows you to upload images for use in your portal pages.
The pfSense software includes both DHCP Server and Relay functionality
Iptables is the software firewall that is included with most Linux distributions by default. This cheat sheet-
style guide provides a quick reference to iptables commands that will create firewall rules are useful in
44 Experiment 13 – Firewall Router and ACLs
Shahid Abid CN Lab Manual
common, everyday scenarios. This includes iptables examples of allowing and blocking various services by
port, network interface, and source IP address.
iptables -F
(or)
iptables –flush
In all our examples below, we have two rules for each scenario, as we’ve set DROP as default policy for both
INPUT and OUTPUT chain.
If you trust your internal users, you can omit the last line above. i.e Do not DROP all outgoing packets by
default. In that case, for every firewall rule requirement you have, you just have to define only one rule. i.e
define rule only for incoming, as the outgoing is ACCEPT for all packets.
BLOCK_THIS_IP="x.x.x.x"
iptables -A INPUT -s "$BLOCK_THIS_IP" -j DROP
This is helpful when you find some strange activities from a specific ip-address in your log files, and you want
to temporarily block that ip-address while you do further research.
You can also use one of the following variations, which blocks only TCP traffic on eth0 connection for this
ip-address.
iptables -A INPUT -i eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
The following example allows all incoming SSH, HTTP and HTTPS traffic.
This uses the iptables nth extension. The following example load balances the HTTPS traffic to three different
ip-address. For every 3th packet, it is load balanced to the appropriate server (using the counter 0).
iptables -A PREROUTING -i eth0 -p tcp --dport 443 -m state --state NEW -m nth --counter 0 --
every 3 --packet 0 -j DNAT --to-destination 192.168.1.101:443
iptables -A PREROUTING -i eth0 -p tcp --dport 443 -m state --state NEW -m nth --counter 0 --
every 3 --packet 1 -j DNAT --to-destination 192.168.1.102:443
iptables -A PREROUTING -i eth0 -p tcp --dport 443 -m state --state NEW -m nth --counter 0 --
every 3 --packet 2 -j DNAT --to-destination 192.168.1.103:443
In this example, eth1 is connected to external network (internet), and eth0 is connected to internal network
(For example: 192.168.1.x).
The NIS ports are dynamic. i.e When the ypbind starts it allocates the ports.
First do a rpcinfo -p as shown below and get the port numbers. In this example, it was using port 853 and 850.
There are two solutions to this: 1) Use static ip-address for your NIS, or 2) Use some clever shell scripting
techniques to automatically grab the dynamic port number from the “rpcinfo -p” command output, and use
those in the above iptables rules.
However DBA and developers might need to login directly to the MySQL from their laptop and desktop using
MySQL client. In those case, you might want to allow your internal network to talk to the MySQL directly as
shown below.
iptables -A INPUT -i eth0 -p tcp --dport 143 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 143 -m state --state ESTABLISHED -j ACCEPT
The following rules allow IMAPS traffic.
iptables -A INPUT -i eth0 -p tcp --dport 993 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 993 -m state --state ESTABLISHED -j ACCEPT
22. Allow POP3 and POP3S
The following rules allow POP3 access.
iptables -A INPUT -i eth0 -p tcp --dport 110 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 110 -m state --state ESTABLISHED -j ACCEPT
The following rules allow POP3S access.
iptables -A INPUT -i eth0 -p tcp --dport 995 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 995 -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -m limit --limit 25/minute --limit-burst 100 -j ACCEPT
In the above example:
iptables -A INPUT -i eth0 -p tcp --dport 422 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 422 -m state --state ESTABLISHED -j ACCEPT
iptables -N LOGGING
iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables Packet Dropped: "
--log-level 7
Finally, drop these packets.
A demonstration of firewall router working using pfsense firewall in virtual environment OR online
resource like Dell Sonicwall NSa 3650 Running SonicOS 6.5.3 available at the following link:
https://nsa3650.demo.sonicwall.com/main.html
Exercise 13.1. Implement all the concepts of ACL covered in Lab on Simulator or pfsense firewall. [10]
Virtual LANs
What is VLAN
VLAN is a logical grouping of networking devices. When we create VLAN, we actually break large
broadcast domain in smaller broadcast domains. Consider VLAN as a subnet. Same as two different subnets
cannot communicate with each other without router, different VLANs also requires router to communicate.
Advantage of VLAN
VLAN provides following advantages:-
1. Static (Statically assign IP address to vlan. The network of IP is allowed IPs from vlan)
2. Dynamic (port will detect the network to which it is connected)
VLAN Connections
During the configuration of VLAN on port, we need to know what type of connection it has.
Access link
Trunk link
Access link
Access link connection is the connection where switch port is connected with a device that has a standardized
Ethernet NIC. Standard NIC only understand IEEE 802.3 or Ethernet II frames. Access link connection can
only be assigned with single VLAN. That means all devices connected to this port will be in same broadcast
domain.
Trunk link
Trunk link connection is the connection where switch port is connected with a device that is capable to
understand multiple VLANs. Usually trunk link connection is used to connect two switches or switch to router.
Remember earlier in this article I said that VLAN can span anywhere in network, that is happen due to trunk
link connection. Trunking allows us to send or receive VLAN information across the network.
Trunk Tagging
In trunking a separate logical connection is created for each VLAN instead of a single physical connection. In
tagging switch adds the source port’s VLAN identifier to the frame so that other end device can understands
what VLAN originated this frame. Based on this information destination switch can make intelligent
forwarding decisions on not just the destination MAC address, but also the source VLAN identifier.
Objective
Students will able to understand Network Monitoring. Tools used can be e.g. NTop, Darkstat etc.
Time Required : 3 hrs
Programming Language :
Software Required : PFsense Firewall in VM
Hardware Required : Wireless Router
Introduction
Wireless router interfacing, discuss its WAN and LAN aliases, Wireless settings / configurations, Firewall
part, routing etc.
Introduce any network monitoring tool and train students to monitor network.
NTOP
Deep Packet Inspection provide information about L7 Applications, Client/Server Operating System, Ports connected
to, Download/Upload rates etc.
Darkstat