CPE 3713: Computer Communications
and Networks
Network Layer: IP Addressesing
1
What is an IPV4 Address?
2
Address Space
…………..
addr1 …………..
addr15
addr2 ………….. …………..
…………..
addr41 addr226
addr31
………….. …………..
3
Address space rule
…………..
…………..
The address space in a protocol
That uses N-bits to define an
Address is:
2N
4
IPv4 address space
The address space of IPv4 is
232
or
4,294,967,296.
5
Binary Notation
01110101 10010101 00011101 11101010
6
Dotted-decimal notation
7
Example 3
Find the error in the following IP Address
[Link]
Solution
There are no leading zeroes in
Dotted-decimal notation
(045)
8
Example 3 (continued)
Find the error in the following IP Address
[Link]
Solution
In decimal notation each number <= 255
301 is out of the range
9
CLASSFUL
ADDRESSING
10
In classful addressing the address space is
divided into 5 classes:
A, B, C, D, and E.
11
Finding the class in binary notation
12
Finding the address class
13
Example 5
Show that Class A has
231 = 2,147,483,648 addresses:
In class A, only 1 bit defines the class. The remaining 31
bits are available for the address. With 31
bits, we can have 2^31 or 2,147,483,648 addresses.
14
Example 6
Find the class of the following IP addresses
00000001 00001011 00001011 11101111
11000001 00001011 00001011 11101111
Solution
• 00000001 00001011 00001011 11101111
1st is 0, hence it is Class A
• 11000001 00001011 00001011 11101111
1st and 2nd bits are 1, and 3rd bit is 0 hence, Class C
15
Finding the class in decimal notation
16
Example 7
Find the class of the following addresses
[Link]
[Link]
Solution
• [Link]
1st byte = 158 (128<158<191) class B
• [Link]
1st byte = 227 (224<227<239) class D
17
IP address with appending port
number
[Link]:25
thefour octet before colon is the IP address
The number after colon (25) is the port
number
18
Netid and hostid
19
Blocks in class
A
20
Blocks in class B
21
Blocks in class C
22
23
24
25
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
26
27
Example 8
Given the network address [Link], find the
class, the block, and the range of the addresses
Solution
The 1st byte is between 128 and 191.
Hence, Class B
The block has a netid of 132.21.
The addresses range from
[Link] to [Link].
Mask
• A mask is a 32-bit binary number.
• The mask is ANDeD with IP address to
get
• The block address (Network address)
• Mask And IP address = Block Address
29
Default Mask
Class A defaultmask is [Link]
Class B default mask is [Link]
Class C Default mask [Link]
30
Subnet Mask
An IP address has 2 parts:
– The Network identification.
– The Host identification.
Frequently, the Network & Host portions of
the address need to be separately extracted.
In most cases, if you know the address class,
it’s easy to separate the 2 portions.
31
Subnet Mask
(Cont.)
With the rapid growth of the internet & the ever-
increasing demand for new addresses, the standard
address class structure has been expanded by
borrowing bits from the Host portion to allow for more
Networks.
Under this addressing scheme, called Subnetting,
separating the Network & Host requires a special
process called Subnet Masking.
32
Subnet Mask (Cont.)
The subnet masking process was developed
to identify & extract the Network part of the
address.
A subnet mask, which contains a binary bit pattern
of ones & zeros, is applied to an address to
determine whether the address is on the local
Network.
If it is not, the process of routing it to an outside
network begins.
33
Subnet Mask (Cont.)
The function of a subnet mask is to determine whether
an IP address exists on the local network or whether it
must be routed outside the local network.
It is applied to a message’s destination address to
extract the network address.
If the extracted network address matches the local
network ID, the destination is located on the local
network.
34
Subnet Mask (Cont.)
However, if they don’t match, the message
must be routed outside the local network.
The process used to apply the subnet mask
involves Boolean Algebra to filter out non-
matching bits to identify the network address.
35
A network with two levels of
hierarchy (not subnetted)
36
Note
Subnetting is done by borrowing bits from the
host part and add them the network part
37
Example 9
What is the subnetwork address if the
destination address is [Link] and the
subnet mask is [Link]?
38
Solution
AND OPERATION
11001000 00101101 00100010 00111000
11111111 11111111 11110000 00000000
11001000 00101101 00100000 00000000
The subnetwork address is [Link].
39
Example 10
What is the subnetwork address if the destination
address is [Link] and the mask is
[Link]?
Solution
See next slide
40
Solution
41
Comparison of a default mask and
a subnet mask
42
43
Example 11
A company is granted the site address
[Link] (class C). The company needs
six subnets. Design the subnets.
Solution
The number of 1s in the default
mask is 24 (class C).
44
Solution (Continued)
The company needs six subnets. This number 6 is not a
power of 2. The next number that is a power of 2 is 8
(23). We need 3 more 1s in the subnet mask. The total
number of 1s in the subnet mask is 27 (24 3).
The total number of 0s is 5 (32 27). The mask is
45
Solution (Continued)
11111111 11111111 11111111 11100000
or
[Link]
The number of subnets is 8.
The number of addresses in each subnet is 25 (5 is the
number of 0s) or 32.
46
Example 3
47
Example 12
A company is granted the site address
[Link] (class B). The company needs
1000 subnets. Design the subnets.
Solution
The number of 1s in the default mask is
16 (class B).
48
Solution (Continued)
The company needs 1000 subnets. The number is not a
power of 2. The next number that is a power of 2 is
1024 (210). We need 10 more 1s in the subnet mask.
The total number of 1s in the subnet mask is 26 (16
10).
The total number of 0s is 6 (32 26).
49
Solution (Continued)
The mask is
11111111 11111111 11111111 11000000
or
[Link].
The number of subnets is 1024.
The number of addresses in each subnet is 26 (6 is
the number of 0s) or 64.
50
Example 4
51
Exercise
Let us consider an example of Class B network [Link]. What
will be the first and last IP address, if we want to create 2 subnets
52
Exercise
Let us consider an example of Class B network [Link].
What is will be the first and last IP address, if we want to create
6 subnets
53
SUPERNETTING
54
What is supernetting?
Supernetting is the opposite of subnetting
In subnetting you borrow bits from the host
part
Supernetting is done by borrowing bits from
the network side.
And combine a group of networks into one
large supernetwork.
55
A
supernetwork
56
Rules:
The number of blocks must be a power of 2 (1,
2, 4, 8, 16, . . .).
The blocks must be contiguous in the address
space (no gaps between the blocks).
The third byte of the first address in the
superblock must be evenly divisible by the number
of blocks. In other words, if the number of blocks is
N, the third byte must be divisible by N.
Example 5
Which of the following set of class C blocks
can be used to form a supernet for a
company?
[Link] [Link] [Link]
[Link] [Link] [Link] [Link]
[Link] [Link] [Link] [Link]
[Link] [Link] [Link] [Link]
58
Solution
1: No, there are only three blocks.
2: No, the blocks are not contiguous.
3: No, 31 in the first block is not divisible by 4.
4: Yes, all three requirements are fulfilled.
59
60
In supernetting,
we need the first address of
the supernet
and the supernet mask to
define the range of addresses.
61
Comparison of subnet, default,
and supernet masks
62
We need to make a supernetwork out of 16
class C blocks. What is the supernet mask?
Solution
We need 16 blocks. For 16 blocks we need to change four 1s to 0s in
the default mask. So the mask is
11111111 11111111 11110000 00000000
or
[Link]
63
Example 14
A supernet has a first address of [Link] and a
supernet mask of [Link]. A router receives three
packets with the following destination addresses:
[Link]
[Link]
[Link]
Which packet belongs to the supernet?
64
Solution
We apply the supernet mask to see if we can find
the beginning address.
[Link] AND
[Link] [Link]
[Link] AND
[Link] [Link]
Only the first address belongs to this supernet.
[Link] AND
[Link] [Link]
65
Example 15
A supernet has a first address of [Link] and a
supernet mask of [Link]. 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 23 or 8 blocks in this supernet.
The blocks are [Link] to [Link]. The first
address is [Link]. The last address is [Link]. 66