Data Communication and Computer Networks: IP Addresses, Subnetting

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

Data Communication and

Computer Networks

IP Addresses, Subnetting

Lubna Awan Hafiza


Department of Computer Science
COMSATS University Islamabad, Wah Campus
lubnamalik99116@gmail.com
Outline

◼ IP address

◼ a number identifying a computer


or another device on the Internet

◼ Classful IP addressing

◼ Subnet mask

◼ Subnetting

2
IPv4 ADDRESSES
An IPv4 address is a 32-bit address that uniquely and
universally defines the connection of a device (for example, a
computer or a router) to the Internet.

3
Example
Change the following IPv4 addresses from
dotted-decimal notation to binary notation.

Solution
We replace each decimal number with its
binary equivalent.

4
Example
Change the following IPv4 addresses from
binary notation to dotted-decimal notation.

Solution
We replace each group of 8 bits with its
equivalent decimal number and add dots for
separation.

5
Example
Find the error, if any, in the following IPv4 addresses.

Solution
a. There must be no leading zero (045).
b. There can be no more than four numbers.
c. Each number needs to be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal
notation is not allowed.
6
Hierarchy in Addressing
A 32-bit IPv4 address is hierarchical, but divided only into two parts.
The first part of the address, called the prefix, defines the network; the
second part of the address, called the suffix, defines the node
(connection of a device to the Internet). Figure shows the prefix and
suffix of a 32-bit IPv4 address. The prefix length is n bits and the suffix
length is (32 - n) bits.

7
Classful Addressing
When the Internet started, an IPv4 address was designed with a
fixed-length prefix, but to accommodate both small and large
networks, three fixed-length prefixes were designed instead of one (n
= 8, n = 16, and n = 24). The whole address space was divided into
five classes (class A, B, C, D, and E), as shown in Figure 18.18. This
scheme is referred to as classful addressing. Although classful
addressing belongs to the past, it helps us to understand classless
addressing, discussed later.

8
Classful Addressing

9
Example
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111
Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0.
This is a class C address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
10
Example

140.179.220.200
Written in binary form:
140 .179 .220 .200

10001100 . 10110011 . 11011100


. 11001000
We see the address in the decimal form
Your computer sees it in the binary form
11
Binary Octet:

◼ An octet is made up of eight “1”s and “0”s,


representing the following values:
128 64 32 16 8 4 2 1

◼ So the value of 140 (the first octet of our


example) looks like this:
1 0 0 0 1 1 0 0

12
Network vs. Host

◼ Every IP address has 2 parts:


◼ 1 identifying the network it resides on
◼ 1 identifying the host, or node,
address on the network
◼ The class of the address and the subnet mask
determine which part belongs to the network
address and which part belongs to the host
address
13
IP Address Breakdowns:
◼ The class of the address determines, by default, which part
is for the network (N) and which part belongs to the node
(n)
Class A:
NNNNNNNN.nnnnnnnn.nnnnnnnn.nnnnnnnn
Class B:
NNNNNNNN.NNNNNNNN.nnnnnnnn.nnnnnnnn
Class C:
NNNNNNNN.NNNNNNNN.NNNNNNNN.nnnnnnnn

14
140.179.220.200
◼ Our example is a Class B address
◼ By default, the Network part of the
address is defined by the first 2 octets:
140.179.x.x
◼ By default, the node part of the address is
defined by the last 2 octets: x.x.220.200

*Note that the network part of the


address is also known as the Network
Address
15
Two Reserved Addresses:

◼ In order to specify the Network Address of a given


IP address, the node portion is set to all “0”s:
◼ 140.179.0.0

◼ If all the bits in the node portion are set to “1”s,


then this specifies the broadcast address that is
sent to all nodes on the network:
◼ 140.179.255.255

16
Subnet Mask
◼ Subnet masks are applied to an IP address
to identify the Network portion and the node
portion of the address.

◼ Your computer performs a bitwise logical


AND operation between the address and the
subnet mask in order to find the Network
Address or number.
◼ Confused? Read on! 17
Default Subnet Masks

Class A - 255.0.0.0

11111111.00000000.00000000.00000000

Class B - 255.255.0.0

11111111.11111111.00000000.00000000

Class C - 255.255.255.0

11111111.11111111.11111111.00000000
18
Logical Bitwise AND Operation

◼ Remember our example?


◼ 140.179.240.200
◼ It’s a Class B, so the subnet mask is:
◼ 255.255.0.0

We need to look at this as our computer


does so we can perform the bitwise AND...

19
Logical Bitwise AND Operation

140.179.220.200 Class B address


255.255.0.0 Subnet Mask

In Binary:
10001100.10110011.11110000.11001000
11111111.11111111.00000000.00000000
10001100.10110011.00000000.00000000
By doing this, the computer has found that
our Network Address is 140.179.0.0
20
Another Example:
Suppose we have the address of:
206.15.143.89? What class is it? Class C
What is the subnet
mask? 255.255.255.0
What is the Network
Address?
206.15.143.0
What is the host portion of the
address? 0.0.0.89
21
Another Example:
Suppose we have the address of:
202.15.141.40?
What class is it? Class C
What is the subnet
mask? 255.255.255.0
What is the Network
Address?
202.15.141.0
What is the host range, broadcast
address 1-254
255 22
Drawbacks of Classful Addressing

◼ Wastage of IP addresses

◼ A network with only 4 hosts require class C


address

◼ A network with only 300 hosts require


class B address (remember 216 hosts in
class B address)
23
Why Do We Care!?

◼ You can manipulate your subnet mask in order to


create more network addresses. Why?
◼ If you have a Class C network, how many
individual node addresses can you have?
◼ 1 to 254

◼ Remember, you can’t have all “0”s and all “1”s

in the node portion of the address.


◼ So we cannot use 206.25.143.0 (all “0”s) or

206.25.143.255 (all “1”s) as a node address.

24
Why Do We Care!?

◼ So we have 1 Class C Network (206.15.143.0)


◼ And we have 254 node address (1 to 254)
◼ But what if our LAN has 5 networks in it and
each network has no more than 30 nodes on
it?
◼ Do we apply for 4 more Class C licenses, so
we have one for each network?
◼ We would be wasting 224 addresses on each
network, a total of 1120 addresses!

25
Subnetting

◼ Subnetting is a way of taking an existing class


licence and breaking it down to create more
Network Addresses.

◼ This will always reduce the number of node


addresses for a given network.

◼ Subnetting makes more efficient use of the


address or addresses assigned to you.
26

You might also like