1 IP Addressing
1 IP Addressing
CONTENTS
INTRODUCTION
CLASSFUL ADDRESSING
SAMPLE INTERNET WITH
CLASSFUL ADDRESSES
INTRODUCTION
Introduction
In addition to the physical addresses (contained on
Network Interface Card) that identify individual
devices, the Internet requires an addressing
convention.
An address that identifies the connection of a host
to its network is known as Internet address or IP
address.
An IP address is a 32-bit address that uniquely and
universally defines the connection of a host to the
Internet.
Introduction
IP addresses are unique as each address defines
one and only one connection to the Internet.
Two devices on the Internet can never have the
same IP address.
If a device has two connections to the Internet, via
two networks, it has two IP addresses.
The IP addresses are universal as the addressing
system must be accepted by any host that wants to
be connected to the Internet.
Address Space
An address space is the total number of addresses
used by the protocol.
If a protocol uses N bits to define an address, the
address space is 2N because each bit can have two
different values (0 and 1)and N bits can have 2N
values.
Current IP version IPV4 uses 32bit address. So the
address space of IPv4 is 2^32 or 4,294,967,296.
Notation
There are 3 common notations to show an IP
address: binary notation, dotted-decimal
notation, and hexadecimal notation.
Binary notation: displayed as 32 bits. One or
more space is inserted between each octet (8 bits).
Example : 01110101 10010101 00011101
11101010
Dotted-decimal notation: IP addresses are written
in decimal form with decimal points separating
the bytes. As each byte having 8 bits, so each
number in this notation is between 0 to 255.
Example:
Notation
addr1
..
..
Example 1
129.11.11.239
Example 2
Example 3
Example 3 (continued)
In dotted-decimal notation,
each number is less than or
equal to 255; 301 is outside this range.
Example 4
0X810B0BEF or 810B0BEF16
CLASSFUL
ADDRESSING
Number of Addresses
Percentage
2^31=2,147,483,648
50%
2^30=1,073,741,824
25%
2^29=536,870,912
12.5%
2^28=268,435,456
6.25%
2^28=268,435,456
6.25%
Example 5
have
Solution
Example 6
Solution
Example 6 (Continued)
Solution
Class
From
To
Class A
0.0.0.0
127.255.255.255
Class B
128.255.255.255
191.255.255.255
Class C
192.255.255.255
223.255.255.255
Class D
224.255.255.255
239.255.255.255
Example 7
Solution
Example 7 (Continued)
Solution
Blocks in class A
Class A is divided into 128 blocks, each having a
different netid. The first block covers addresses
from 0.0.0.0 to 0.255.255.255 (netid 0).
First byte (netid) is same but last 3 bytes (host id)
can take any value of a given range.
First and last block are reserved for special
purposes and block for netid 10 is used for private
addresses.
Blocks in class A
Millions of
class A
addresses
are wasted.
Blocks in class B
Class B is divided into 16,384 (64*256) blocks,
each having a different netid. The first block
covers
addresses
from
128.0.0.0
to
128.255.255.255 (netid 128.0).
First 2 bytes (netid) is same but last 2 bytes (host
id) can take any value of a given range.
16 Blocks are reserved for private addresses,
leaving 16,368 blocks for assignments to
organizations.
Blocks in class B
Many class B
addresses
are wasted.
Blocks in class C
Class C is divided into 2,097,152(32*256*256)
blocks, each having a different netid. The first
block covers addresses from 192.0.0.0 to
192.255.255.255 (netid 192.0.0).
First 3 bytes (netid) is same but last 1 bytes (host
id) can take any value of a given range.
256 Blocks are reserved for private addresses,
leaving 2,096,896 blocks for assignments to
organizations.
Blocks in class C
Class D
Class D is having only one block. It is designed
for multicasting.
Each address in this class is used to define one
group of hosts on the internet.
When a group is assigned an address in this class,
every host that is a member of this group will
have a multicast address in addition to its normal
(unicast) address.
Class E
Network Addresses
The network address is the first address.
The network address defines the network to the rest
of the Internet.
Given the network address, we can find the class of
the address, the block, and the range of the
addresses in the block.
In classful addressing, the network address (the
first address in the block)is the one that is assigned
to the organization.
Example 9
Example 10
Example 11
Mask
A mask is a 32-bit binary number that gives the first
address in the block (the network address) when
bitwise ANDed with an address in the block.
AND operation
Masking uses the bitwise AND operation defined in
computer science. The operation is applied bit by bit
to the address and the mask.
AND operation does the following:
If the bit in the mask is 1, the corresponding bit in
the address is retained in the output (no change).
If the bit in the mask is 0, a 0 bit in the output is
the result.
In other words, the bits in the address corresponding
to the 1s in the mask are preserved (remain 0 or 1, as
they were) and the bits corresponding to the 0s in the
mask change to 0.
AND operation
Default Mask
Class
Mask in Binary
255.0.0.0
255.255.0.0
255.255.255.0
Default Mask
The network address is the beginning address of
each block. It can be found by applying the default
mask to any of the addresses in the block (including
itself). It retains the netid of the block and sets the
hostid to zero.
We must not apply the default mask of one class to
an address belonging to another class.
Note that the number of 1s in each class matches the
number of bits in the netid and the number of 0s
matches the number of bits in the hostid.
Example 12
Example 13
Example 14
CIDR Notation
In classful addressing each address has a default
mask, it is sometimes convenient to explicitly
indicate the default mask. Classless Interdomain
routing(CIDR) notation is used for this purpose.
In this notation, the number of 1s in the mask is
added after a slash at the end of the address.
For example, the address 18.46.74.10 is a class A
address with a default mask 255.0.0.0, is written as
18.46.74.10/8 to show that there are 8 1s in the
mask.
This is useful in classless addressing.
Subnetting/Supernetting
and
Classless Addressing
CONTENTS
SUBNETTING
SUPERNETTING
CLASSLESS ADDRSSING
SUBNETTING
141.14.2.105
141.14.2.20
141.14.7.96
To the
rest of
the
Internet
R1
Router
141.14.0.0
141.14.7.95
141.14.22.64
141.14.22.9
141.14.7.44
A Subnetted Network
141.14.2.21
141.14.2.20
141.14.2.105
141.14.2.0
141.14.7.96
To the
rest of
the
Intern
et
Router
R1
141.14.7.0
141.14.22.0
141.14.7.95
141.14.7.44
141.14.22.64
141.14.22.9
Subnet Mask
Subnet masks are used when the network is subnetted.
It is used to find the sub-network address.
A custom subnet mask is specified for all hosts in the
same subnet.
Subnet Mask
Solution (Continued)
The custom subnet mask is 11111111 11111111 11111111
11100000 or 255.255.255.224
The number of subnets is 8.
The number of addresses in each subnet is 25 (5 is the
number of 0s) or 32.
Solution (Continued)
Example 15
What is the subnetwork address if the destination address
is 200.45.34.56 and the subnet mask is 255.255.240.0?
Solution
11001000 00101101 00100010 00111000
11111111 11111111 11110000 00000000
11001000 00101101 00100000 00000000
The subnetwork address is 200.45.32.0.
Example 16
What is the subnetwork address if the destination address is
19.30.80.5 and the mask is 255.255.192.0?
Solution
SUPERNETTING
Supernetting
The size of a class C block with a maximum number
of 256 addresses may not satisfy the needs of an
organization.
In supernetting, an organization can combine several
class C blocks to create a larger range of addresses.
In other words several networks are combined to
create a supernetwork.
For example, an organization that needs 1000
addresses can be granted 4 class C blocks.
Supernetting
Supernet Mask
In subnetting, we need the first address of the subnet
and the subnet mask to define the range of addresses.
In supernetting, we need the first address of the
supernet and the supernet mask to
define the range of addresses.
A supernet mask is the reverse of a subnet mask. A
subnet mask for class C has more 1s than default
mask for this class. A supernet mask for class C has
less 1s than default mask for this class.
Example 17
Example 18
A supernet has a first address of 205.16.32.0 and a
supernet mask of 255.255.248.0. How many blocks are in
this supernet and what is the range of addresses?
Solution
The supernet has 21 1s. The default mask has 24
1s. Since the difference is 3, there are 2 3 or 8
blocks in this supernet. The blocks are 205.16.32.0
to 205.16.39.0. The first address is 205.16.32.0.
The last address is 205.16.39.255.
Example 19
A supernet has a first address of 205.16.32.0 and a
supernet mask of 255.255.248.0. A router receives three
packets with the following destination addresses:
205.16.37.44
205.16.42.56
205.17.33.76
Which packet belongs to the supernet?
Solution
We apply the supernet mask to see if we can find
the beginning address.
205.16.37.44 AND 255.255.248.0 205.16.32.0
205.16.42.56 AND 255.255.248.0
205.16.40.0
205.17.32.0
CLASSLESS
ADDRESSING
Classless Addressing
In classful addressing the minimum number of
addresses granted to an organization was 256(class C);
the maximum was 16,777,216(class A). In between
these limits an organization could have a class B block
or several class C blocks.
But , what about a small business that needed only 16
addresses? Or a house that needed only two addresses?
Classless Addressing
An ISP (Internet Service Provider) can provide these
services. An ISP is granted a large range of addresses
and then subdivides the addresses (in groups of
2,4,6,8,16 and so on), giving a range to a household or
a small business.
To facilitate this evolution and to resolve the problems
of classful addressing, in 1996, the Internet authorities
announced a new architecture called classless
addressing.
Variable-length Blocks
In classless addressing variable-length blocks are
assigned that belong to no class.
In this architecture, the entire address space (2^32
addresses) is divided into blocks of different sizes. An
organization is granted a block suitable for its
purposes.
Variable-length Blocks
There is only one condition on the number of
addresses in a block; it must be a power of 2 (2, 4,
8, . . .). A household may be given a block of 2
addresses. A small business may be given 16
addresses. A large organization may be given 1024
addresses.
The beginning address must be evenly divisible by the
number of addresses. For example, if a block contains
4 addresses, the beginning address must be divisible
by 4. If the block has less than 256 addresses, we need
to check only the rightmost byte. If it has less than
65,536 addresses, we need to check only the two
rightmost bytes, and so on.
Example 20
Which of the following can be the beginning address of a
block that contains 16 addresses?
205.16.37.32
190.16.42.44
17.17.33.80
123.45.24.52
Solution
The address 205.16.37.32 is eligible because 32 is
divisible by 16. The address 17.17.33.80 is eligible
because 80 is divisible by 16.
Example 21
Which of the following can be the beginning address of a
block that contains 256 addresses?
205.16.37.32
190.16.42.0
17.17.32.0
123.45.24.52
Solution
The rightmost byte must be 0. As the IP addresses
use base 256 arithmetic, when the rightmost byte is
0, the total address is divisible by 256. 2 nd and 3rd
addresses meets the condition.
Example 22
Which of the following can be the beginning address of a
block that contains 1024 addresses?
205.16.37.32
190.16.42.0
17.17.32.0
123.45.24.52
Solution
To be divisible by 1024(=4X256), the rightmost
byte of an address should be 0 and the second
rightmost byte must be divisible by 4. Only the
address 17.17.32.0 meets this condition.
Mask
In classless addressing, when an address is given, the
block the address belongs to cannot be found unless we
have the mask. The addresses must be accompanied by
the mask.
The mask is given in CIDR notation. X.Y.Z.T/n , where
n defines the number of bits that are the same in every
address in the block. So if n=20, it means the 20
leftmost bits are identical in each address with 12 bits
not the same. The number n is known as prefix length.
(32-n) is known as suffix length. There is a one-to-one
relationship between a mask and a prefix length.
Mask
/n
Mask
/n
Mask
/n
Mask
/n
Mask
/1
128.0.0.0
/9
255.128.0.0
/17
255.255.128.0
/25
255.255.255.12
8
/2
192.0.0.0
/10
255.192.0.0
/18
255.255.192.0
/26
255.255.255.19
2
/3
224.0.0.0
/11
255.224.0.0
/19
255.255.224.0
/27
255.255.255.22
4
/4
240.0.0.0
/12
255.240.0.0
/20
255.255.240.0
/28
255.255.255.24
0
/5
248.0.0.0
/13
255.248.0.0
/21
255.255.248.0
/29
255.255.255.24
8
/6
252.0.0.0
/14
255.252.0.0
/22
255.255.252.0
/30
255.255.255.25
2
/7
254.0.0.0
/15
255.254.0.0
/23
255.255.254.0
/31
255.255.255.25
4
/8
255.0.0.0
/16
255.255.0.0
/24
255.255.255.0
/32
255.255.255.25
5
The prefix length is 20, which means that the mask has
20 1s and 12 0s. The complement of the mask is
00000000 00000000 00001111 11111111 or 0.0.15.255.
We add the mask complement to the beginning address
to find the last address.
Address in binary:
00011000
Assignments
1. What is the procedure to find the Subnet Mask and range of
addresses in the subnet for variable length blocks? Give example
and discuss.
2. An ISP is granted a block of addresses starting with 188.88.0.0/16 .
The ISP wants to distribute these blocks to 1000 customers as
follows:
The first group has 20 medium-size businesses, each needs 64
addresses
The second group has 400 small businesses, each needs 16
addresses.
The third group has 200 households, each with 4 addresses.
Design the sub-blocks and give the slash notation for each subblock. Find out how many addresses are still available after
these allocations.