Computer Networks Practical: S.Y.B.Sc. I.T. - SEM III
Computer Networks Practical: S.Y.B.Sc. I.T. - SEM III
Computer Networks Practical: S.Y.B.Sc. I.T. - SEM III
Networking: Networking is a connection that has been established between devices through a transmission media, so that
they can communicate to each other to share information and resources.
Host: All devices to which IP address can be assign in networking.
Subnetting: Dividing a large network into a smaller network is known as subnetting i.e. taking bits from host portion to
the network portion. It is use to reduce the wastage of IP address. When we subnetted the given IP, it is called Classless IP
Address.
Copyright © PROF. GUFRAN QURESHI
Subnet Mask: To separate 32 bits IP address into the network prefix & the host number. It defines which portion is of
Network and which is of Host.
Subnet: A subnet (subnetwork) is an identifiably separate part of an organization’s network. Typically, a subnet may
represent all the machines at one geographic location, in one building, or on the same LAN.
Classes in IP Address:
Class IP Address Subnet
Class A 1 – 126* N-H-H-H
Class B 128 – 191 N-N-H-H
Class C 192 – 223 N-N-N-H
Class D 224 – 239 N-N-N-N (Multicasting)
Class E 240 – 255 H-H-H-H (R & D)
Note: 127.0.0.1 to 127.255.255.255 is used for self-pinging or loop-back testing. It used for testing purposes like client-
server architecture.
Copyright © PROF. GUFRAN QURESHI
Network Address: If all bits in the host portion is 0’s than it is known as Network Address.
For e.g. 172.45.84.15 (Belong to class B: 255.255.0.0); therefore Network Address is 172.45.0.0
Broadcast Address: If all bits in the host portion is 1’s than it is known as Broadcast Address
For e.g. 172.45.84.15 (Belong to class B: 255.255.0.0); therefore Broadcast Address is 172.45.255.255
Calculation:
1. Class A (8 bit):
No. of Network = 27 – 2 = 128 – 2 = 126
No. of Host = 224 – 2 = (210 x 210 x 24) – 2 = 1024x1024x16 – 2 = 16777216 – 2 = 16777214
2. Class B (16 bit):
No. of Network = 214 – 2 = 16384 – 2 = 16382
No. of Host = 216 – 2 = 65536 – 2 = 65534
3. Class C (24 bit):
No. of Network = 221 – 2 = 2097152 – 2 = 2097150
No. of Host = 28 – 2 = 256 – 2 = 254
Practical 1 Copyright © PROF. GUFRAN QURESHI
Number of Host per subnet =221 = (210 x 210 x 21) – 2 Block Size = 256 – Subnet mask = 256 – 224 = 32
= (1024 x 1024 x 2) – 2 OR 25 = 32
= 2097152 – 2
= 2097150
Copyright © PROF. GUFRAN QURESHI
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 128
1 1 0 0 0 0 0 0 192
1 1 1 0 0 0 0 0 224
1 1 1 1 0 0 0 0 240
1 1 1 1 1 0 0 0 248
1 1 1 1 1 1 0 0 252
1 1 1 1 1 1 1 0 254
1 1 1 1 1 1 1 1 255
Copyright © PROF. GUFRAN QURESHI
AIM: Use of ping & tracert/traceroute, ipconfig/ifconfig, route & arp utilities
1. Ping
The ping command sends ICMP echo request packets to
a destination. For example, you could run ping
google.com or ping 172.217.26.206 to ping a domain
name or IP address.
These packets ask the remote destination to reply. If the
remote destination is configured to reply, it will respond
with packets of its own. You’ll be able to see how long
the round-trip time is between your computer and the
destination. You’ll see a “request timed out” message if
packet loss is occurring, and you’ll see an error message
if your computer can’t communicate with the remote
host at all.
2. traceroute / tracert / tracepath Copyright © PROF. GUFRAN QURESHI
The traceroute, tracert, or tracepath command is similar to
ping, but provides information about the path a packet takes.
traceroute sends packets to a destination, asking each
Internet router along the way to reply when it passes on the
packet. This will show you the path packets take when you
send them between your location and a destination.
3. ipconfig / ifconfig
• The ipconfig command is used on Windows, while the
ifconfig command is used on Linux, Mac OS X, and other
Unix-like operating systems. These commands allow you
to configure your network interfaces and view
information about them.
• For example, you can use the ipconfig /all command on
Windows to view all your configured network interfaces,
their IP addresses, DNS servers, and other information.
Or, you can use the ipconfig /flushdns command to flush
your DNS cache, forcing Windows to get new addresses
from its DNS servers every time you contact a new
hostname. Other commands can force your computer to
release its IP address and get a new one from its DHCP
server. This utility can quickly display your computer’s IP
address or help you troubleshoot problems.
4. route: This diagnostic command manipulates network Copyright © PROF. GUFRAN QURESHI
routing tables.
Syntax:
• route [-f] [command [destination] [MASK netmask]
[gateway] [METRIC metric]]
Parameters:
• -f – Clears the routing tables of all gateway entries. If this
parameter is used in conjunction with one of the commands,
the tables are cleared prior to running the command.
command – Specifies one of four commands below:
• 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 – Specifies, if present, that the next parameter be
interpreted as the netmask parameter.
netmask – Specifies, if present, the subnet mask value to be
associated with this route entry. If not present, this parameter
defaults to 255.255.255.255.
gateway – Specifies the gateway.
METRIC – Specifies the route metric (cost) for the destination.
5. arp: This diagnostic command displays and modifies the IP-to- Copyright © PROF. GUFRAN QURESHI
Ethernet or Token Ring physical address translation tables used by
the Address Resolution Protocol (ARP).
Syntax:
• arp -a [inet_addr] [-N [if_addr]] arp -dinet_addr [if_addr]
• arp -sinet_addrether_addr [if_addr]
Parameters:
• -a – Displays current ARP entries by querying TCP/IP. If inet_addr
is specified, only the IP and physical addresses for the specified host
are displayed.
• -d – Deletes the entry specified by inet_addr
• -s – Adds an entry in the ARP cache to associate the IP address
inet_addrwith the physical address ether_addr. The physical address
is given as 6 hexadecimal bytes separated by hyphens. The IP
address is specified using dotted decimal notation. The entry is
static. It will not be automatically removed from the cache after the
timeout expires and will not exist after a reboot of your computer.
• -N [if_addr] – Displays the ARP entries for the network interface
specified by if_addr. ether_addr Specifies a physical address.
if_addr Specifies, if present, the IP address of the interface whose
address translation table should be modified. If not present, the first
applicable interface will be used. inet_addr Specifies an IP address
in dotted decimal notation.