CNS Lab 4
CNS Lab 4
INSTITUTE OF ENGINEERING
PULCHOWK CAMPUS
A
LAB REPORT
ON
SUBMITTED BY:
PRANAV POUDEL (074BCT026)
SUBMITTED TO:
DEPARTMENT OF ELECTRONICS AND COMPUTER
ENGINEERING
Requirements
● Network simulation tool: Packet Tracer
Exercise
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.
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]
2. Test the connectivity from PC0 to each of the following computers one by one using
ping command and note down the result.
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.
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.
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.
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:
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.
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.
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.
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.
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:
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).
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).
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).
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).
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
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:
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.
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.