0% found this document useful (0 votes)
149 views16 pages

CNS Lab 4

This lab report discusses subnet masks, default gateways, and routing. The objectives are to familiarize with networks, subnet masks, default gateways, and introduce routing concepts. Various exercises are performed in Packet Tracer to test connectivity between devices with different subnet masks and configurations. When the subnet mask divides devices into different logical networks, a default gateway is required to route traffic between networks. Introducing a router between networks and configuring default gateways allows all devices to communicate by routing traffic through the router.

Uploaded by

PRANAV POUDEL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
149 views16 pages

CNS Lab 4

This lab report discusses subnet masks, default gateways, and routing. The objectives are to familiarize with networks, subnet masks, default gateways, and introduce routing concepts. Various exercises are performed in Packet Tracer to test connectivity between devices with different subnet masks and configurations. When the subnet mask divides devices into different logical networks, a default gateway is required to route traffic between networks. Introducing a router between networks and configuring default gateways allows all devices to communicate by routing traffic through the router.

Uploaded by

PRANAV POUDEL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

TRIBHUVAN UNIVERSITY

INSTITUTE OF ENGINEERING
PULCHOWK CAMPUS

A
LAB REPORT
ON

SUBNET MASK, DEFAULT GATEWAY


AND ROUTING

SUBMITTED BY:
PRANAV POUDEL (074BCT026)

SUBMITTED TO:
DEPARTMENT OF ELECTRONICS AND COMPUTER
ENGINEERING

DATE: June 27, 2021


Objectives
● To be familiar with network and subnet mask
● To be familiar with the default gateway and its configuration
● To introduce the concept of Routing

Requirements
● Network simulation tool: Packet Tracer

Exercise

1. What is a subnet mask? Why is it used? Explain with examples.

It is a mask (32 bit in case of IPv4) which is created by setting host bits to all 0s and setting
network bits to all 1s which is used to divide the IP address into two-part ⇒ host address (to
identify host computer) and network address (to identify the network to which a host belongs).
The primary reason why a subnet mask is used by a host is to identify whether the destination is
within the same network or different. Other than this subnet is also used due to the following
advantages:
● Improve network security by allowing quarantining of a comprised section of networks.
● Helps in reallocation of IP address in the classful scheme
● Helps in relieving network congestion by placing high traffic devices on the same subnet,
etc

For E.g.
Let us consider an IP address of 192.168.123.140 and a Subnet Mask of 255.255.255.0.
Here, 24 bits are allocated to network prefix whereas the remaining 8 bits to host addressing as
given below.
11000000.10101000.01111011.00000000 - Network address (192.168.123.0)
00000000.00000000.00000000.10001100 - Host address (000.000.000.140)
Hence, in this case, 192.168.123.0 to 192.168.123.255 belongs to the same network.

2 How does a sending host know whether the destination computer is on the
same network or on a different network? How is the data packet forwarded in
each case from the sending host? Explain.

When sending a packet to any destination, the host performed following sequences of action.
1. AND Operation of Host IP address with Subnet Mask
2. AND Operation of Destination IP address with Subnet Mask
3. Comparison of Results of step 1 and 2 to determine whether the destination is at the
same network (Identical Result) or not
From the above steps two cases arrive:
Case I: (Destination and Host are at same Network)
In this case, Packets are delivered on a MAC address basis. Here, the Packet is delivered to the
destination by determining the MAC address of the destination and sending it to that address.
Case II: (Destination and Host are at different Network)
In this case, Packets are delivered to the default gateway first which in turns deliver to the
destination computer.

- What is routing? Explain static routing and configuration of static routing in a


router with its syntax and functions. Also mention how the routing table of a
router can be observed.
In simpler term, routing is the process of selecting a path across one or more networks. Hence,
it is a process that a router uses to forward packets toward the destination network using a set
of directions which are also known as routes.

When a router uses manually configured routes by the network administration, then such routing
is known as static routing.

Network administrators can configure static routes in global configuration mode using following
command
ip route destination_network_# [subnet_mask]
IP_address_of_next_hop_neighbor [administrative_distance] [permanent]

destination_network_# [subnet_mask]: It specifies the destination network address. We


need to provide a subnet mask if we are using a sub-network.
IP_address_of_next_hop_neighbor: It provides a way to reach the destination network
[administrative_distance]: It determines the trustworthiness of route.
[permanent]: It determines whether to remote entry when route goes down

Routing table of router can be observed by following ways:


❖ The show running-config command can be used in privileged EXEC mode to view
the active configurations in a router to verify that the route was entered correctly
❖ The show ip route command is used to make sure that the static route is present in
the routing table
- Note down the observation of each step with necessary commands specified in
activities A, B and C mentioned above and comment on it.
A. Create the following network topology using Packet Tracer and perform the
followings:

1. Assign the IP Address and subnet mask of given computers as:


▪ PC0: 200.200.20.2 255.255.255.0
▪ PC1: 200.200.20.3 255.255.255.0
▪ PC2: 200.200.20.4 255.255.255.0
▪ PC3: 200.200.20.34 255.255.255.0
▪ PC4: 200.200.20.35 255.255.255.0
▪ PC5: 200.200.20.36 255.255.255.0

2. Test the connectivity from PC0 to each of the following computers one by one using
ping command and note down the result.

▪ PC1:- Connectivity Verified


▪ PC2:- Connectivity Verified
▪ PC3:- Connectivity Verified
▪ PC4:- Connectivity Verified
▪ PC5:- Connectivity Verified

3. Now again, test the connectivity from PC3 to each of the following computers one by
one using the ping command and note down the result and comment on it.

▪ PC0:- Connectivity Verified


▪ PC1:- Connectivity Verified
▪ PC2:- Connectivity Verified
▪ PC4:- Connectivity Verified
▪ PC5:- Connectivity Verified
Comments
Since the connection between these PCs was established through switch and subnet mask was
assigned to 255.255.255.0, on both logical and physical level they are in the same network
hence connectivity was verified among all the PCs in a given network.

4. Change the subnet mask of each of the computers as: 255.255.255.224. Now again test
the connectivity from PC0 to each of the following computers one by one using the ping
command and note down the result.

▪ PC1:- Connectivity Verified


▪ PC2:- Connectivity Verified
▪ PC3:- Connectivity not Verified
▪ PC4:- Connectivity not Verified
▪ PC5:- Connectivity not Verified

5. Again, test the connectivity from PC3 to each of the following computers one by one
using the ping command and note down the result.

▪ PC0:- Connectivity not Verified


▪ PC1:- Connectivity not Verified
▪ PC2:- Connectivity not Verified
▪ PC4:- Connectivity Verified
▪ PC5:- Connectivity Verified

Comments
By comparing 4 and 5 with 2 and 3 respectively, we can see that output is not the same for the
ping command. When we change the subnet mask to 255.255.255.224, then PCs connected to
switch0 (PC0, PC1 and PC2) are considered to be in one separate network and the same goes
for switch1 connected PCs (PC3, PC4 and PC5). Hence, when we ping from PC0 to PC3, PC4
or PC5 (or from PC3 to PC0, PC1 or PC2), due to subnet masking, it considers them to be in a
different network and since no default gateway is assigned, they don’t know where to forward
the packet; therefore, they are unable to establish a connection between them. This is a case
where PCs are physically in the same network (connected by switch) but logically in a different
network (divided by subnet mask).
B. Modify the above network as following i.e. use a router in between switches (i.e.
between Switch1 and Switch2), and perform the followings:

1.Assign the IP address of GigabitEthernet 0/0 interface of Router0 as 200.200.20.1


255.255.255.224 and turn on the interface. Similarly, assign the IP address of
GigabitEthernet 0/1 interface of Router as 200.200.20.33 255.255.255.224 and turn on the
interface.

2. Now test the connectivity from PC0 to each of the following computers one by one
using the ping command and note down the result and comment on it.

▪ PC1:- Connectivity Verified.


▪ PC2:- Connectivity Verified.
▪ PC3:- Connectivity not Verified.
▪ PC4:- Connectivity not Verified.
▪ PC5:- Connectivity not Verified.

3. Now again, test the connectivity from PC3 to each of the following computers one by
one using the ping command and note down the result and comment on it.

▪ PC0:- Connectivity not Verified.


▪ PC1:- Connectivity not Verified.
▪ PC2:- Connectivity not Verified.
▪ PC4:- Connectivity Verified.
▪ PC5:- Connectivity Verified.
Comments
Here, we introduce a router between switches as due to the subnet mask, two different networks
were formed and the router is used to connect these two networks. Even after the introduction
of the router, it is seen that there is no connection between PCs at the different network. It is
because no default gateway is assigned and hence, they don’t know that they are physically
connected to the router and have to pass the packet to the connected router even if they can
identify destination is at a different network by subnet mask.

4. Assign the default gateway of 200.200.20.1 on PC0, PC1 and PC2. Similarly assign a
default gateway of 200.200.20.33 on PC3, PC4 and PC5. Again test the connectivity from
PC0 to each of the following computers one by one using the ping command and note
down the result.

▪ PC1:- Connectivity Verified


▪ PC2:- Connectivity Verified
▪ PC3:- Connectivity Verified
▪ PC4:- Connectivity Verified
▪ PC5:- Connectivity Verified

5. Now again, test the connectivity from PC3 to each of the following computers one by
one using the ping command and note down the result and comment on it.

▪ PC1:- Connectivity Verified


▪ PC2:- Connectivity Verified
▪ PC3:- Connectivity Verified
▪ PC4:- Connectivity Verified
▪ PC5:- Connectivity Verified

Comments

By comparing observation from 4 and 5 with 2 and 3 respectively, we can see that the default
gateway helps PC to identify the physically connected router and hence when delivering the
packet to devices outside of the network as identified by the subnet mask, first, they send a
packet to default gateway i.e. router which then router transfer the packet to destination with the
help of its routing table. This is why a connection was established between all the PCs.
6. Use the command show ip route in the router and note down the result, and comment
on it.
C. Modify the above network to connect additional networks by using another router as
following and perform the followings:

1. Assign the IP Address and subnet mask of added computers as:


▪ PC6: 200.200.20.100 255.255.255.224
▪ PC7: 200.200.20.101 255.255.255.224
▪ PC8: 200.200.20.102 255.255.255.224
Assign default gateway of each of the computer as 200.200.20.99

2. Also configure the GigabitEthernet interfaces of routers with following IP Addresses


and turn on the corresponding interfaces.
▪ Router0: GigabitEthernet 0/2 200.200.20.65 255.255.255.224
▪ Router1: GigabitEthernet 0/0 200.200.20.66 255.255.255.224
▪ Router1: GigabitEthernet 0/1 200.200.20.99 255.255.255.224
4. Observe and note down the output of the command show ip route in each router.

Fig: Output of Router0

Fig: out of Router1


5. Observe the output while using the ping command from PC0 to PC0, PC1, PC2, PC3,
PC4, PC5, PC6, PC7, PC8, Router0 and Router1 (use each IP address of router).

▪ PC0:- Connectivity Verified


▪ PC1:- Connectivity Verified
▪ PC2:- Connectivity Verified
▪ PC3:- Connectivity Verified
▪ PC4:- Connectivity Verified
▪ PC5:- Connectivity Verified
▪ PC6:- Connectivity not Verified
▪ PC7:- Connectivity not Verified
▪ PC8:- Connectivity not Verified
▪ Router0: GigabitEthernet 0/0:- Connectivity Verified
▪ Router0: GigabitEthernet 0/1:- Connectivity Verified
▪ Router0: GigabitEthernet 0/2:- Connectivity Verified
▪ Router1: GigabitEthernet 0/0:- Connectivity not Verified
▪ Router1: GigabitEthernet 0/1:- Connectivity not Verified

6. Observe the output while using the ping command from PC3 to PC0, PC1, PC2, PC3,
PC4, PC5, PC6, PC7, PC8, Router0 and Router1 (use each IP address of router).

▪ PC0:- Connectivity Verified


▪ PC1:- Connectivity Verified
▪ PC2:- Connectivity Verified
▪ PC3:- Connectivity Verified
▪ PC4:- Connectivity Verified
▪ PC5:- Connectivity Verified
▪ PC6:- Connectivity not Verified
▪ PC7:- Connectivity not Verified
▪ PC8:- Connectivity not Verified
▪ Router0: GigabitEthernet 0/0:- Connectivity Verified
▪ Router0: GigabitEthernet 0/1:- Connectivity Verified
▪ Router0: GigabitEthernet 0/2:- Connectivity Verified
▪ Router1: GigabitEthernet 0/0:- Connectivity not Verified
▪ Router1: GigabitEthernet 0/1:- Connectivity not Verified

7. Observe the output while using the ping command from PC6 to PC0, PC1, PC2, PC3,
PC4, PC5, PC6, PC7, PC8, Router0 and Router1 (use each IP address of router).

▪ PC0:- Connectivity not Verified


▪ PC1:- Connectivity notVerified
▪ PC2:- Connectivity not Verified
▪ PC3:- Connectivity not Verified
▪ PC4:- Connectivity not Verified
▪ PC5:- Connectivity not Verified
▪ PC6:- Connectivity Verified
▪ PC7:- Connectivity Verified
▪ PC8:- Connectivity Verified
▪ Router0: GigabitEthernet 0/0:- Connectivity not Verified
▪ Router0: GigabitEthernet 0/1:- Connectivity not Verified
▪ Router0: GigabitEthernet 0/2:- Connectivity not Verified
▪ Router1: GigabitEthernet 0/0:- Connectivity Verified
▪ Router1: GigabitEthernet 0/1:- Connectivity Verified

8. Observe the output while using the ping command from Router0 to PC0, PC1, PC2,
PC3, PC4, PC5, PC6, PC7, PC8 and Router1 (use each IP address of router).

▪ PC0:- Connectivity Verified


▪ PC1:- Connectivity Verified
▪ PC2:- Connectivity Verified
▪ PC3:- Connectivity Verified
▪ PC4:- Connectivity Verified
▪ PC5:- Connectivity Verified
▪ PC6:- Connectivity not Verified
▪ PC7:- Connectivity not Verified
▪ PC8:- Connectivity not Verified
▪ Router1: GigabitEthernet 0/0:- Connectivity Verified
▪ Router1: GigabitEthernet 0/1:- Connectivity not Verified

8. Observe the output while using the ping command from Router1 to PC0, PC1, PC2,
PC3, PC4, PC5, PC6, PC7, PC8 and Router0 (use each IP address of router).

▪ PC0:- Connectivity not Verified


▪ PC1:- Connectivity not Verified
▪ PC2:- Connectivity not Verified
▪ PC3:- Connectivity not Verified
▪ PC4:- Connectivity not Verified
▪ PC5:- Connectivity not Verified
▪ PC6:- Connectivity Verified
▪ PC7:- Connectivity Verified
▪ PC8:- Connectivity Verified
▪ Router0: GigabitEthernet 0/0:- Connectivity not Verified
▪ Router0: GigabitEthernet 0/1:- Connectivity not Verified
▪ Router0: GigabitEthernet 0/2:- Connectivity Verified
10. From PC0 enter into Router0 using telnet and configure the static route for
destination network of Network 3 as:

11. From there enter into Router1 using telnet and configure the static route for the
destination network of Network 1 and Network 2.
12. Repeat the step from 4 to 9 and observe the output. Compare the result with the
previous and comment on it.

Router 0

Router 1
Ping command from PC0, PC3, PC5, ROUTER0 AND ROUTER 1

▪ PC0:- Connectivity Verified


▪ PC1:- Connectivity Verified
▪ PC2:- Connectivity Verified
▪ PC3:- Connectivity Verified
▪ PC4:- Connectivity Verified
▪ PC5:- Connectivity Verified
▪ PC6:- Connectivity Verified
▪ PC7:- Connectivity Verified
▪ PC8:- Connectivity Verified
▪ Router0: GigabitEthernet 0/0:- Connectivity Verified
▪ Router0: GigabitEthernet 0/1:- Connectivity Verified
▪ Router0: GigabitEthernet 0/2:- Connectivity Verified
▪ Router1: GigabitEthernet 0/0:- Connectivity Verified
▪ Router1: GigabitEthernet 0/1:- Connectivity Verified

Comments

Initially, a third network was connected with help of router1 and connectivity between devices
among the networks were tested. It was seen that the connection among all the devices was not
established. The reason behind this was because of lack of routing information in the routing
table in respective routers. I.e. router0 doesn’t have routing information to deliver the packet to
devices connected to router 1 and vice versa. After the introduction of routing information in the
respective routers’ routing table., it is seen that connectivity between devices across the
network was verified. Here we use static routing as routing information was assigned manually
by using ip route commands in routes. Hence, routers can make a decision and find routes
between Network1, Network2 and Network3 respectively.

13. Remove the both routes added (into Router1) in step 11 by using no ip route
command

14. Since the Network 1 and Network 2 are in consecutive addresses, we can aggregate
them to use a single entry for the route as:

ip route 200.200.20.0 255.255.255.192 200.200.20.65


15. Again observe the output by repeating the step from 4 to 9 and observe output.
Compare the result with the previous and comment on it.

Comments

Here connectivity results were the same as a previous observation but only routing information
of the routing table of router1 was changed which is given below.

Fig: Output of Router1

Here, instead of using two different entities, we have made proper use of subnet masking to
assign due to which entry of routing table reduces i.e. consecutive addresses of Network 1 and
Network 2 were aggregated to form a single entry for the route by using the proper subnet
mask.

Conclusion
Hence, in this lab, we became familiar with subnet mask, default gateway and routing. We
observed the effects of subnet mask on computer network and how it is used to distinguish
different networks. Also, we learned how a gateway is used for forwarding the packet when the
destination is outside the network. Finally, we learned about the importance of routing
information in the routing table when it involves multiple paths to deliver packets and how to
subnet mask is used to reduce the entry of the routing table.

You might also like