Lecture W4 CN IP Addressing P1
Lecture W4 CN IP Addressing P1
Classless Addressing
Special Addresses
NAT
INTRODUCTION
Solution
We replace each decimal number with its binary equivalent:
a. 01101111 00111000 00101101 01001110
b. 11011101 00100010 00000111 01010010
c. 11110001 00001000 00111000 00001100
d. 01001011 00101101 00100010 01001110
Example 3
Solution
We replace each group of 4 bits with its hexadecimal equivalent.
Note that hexadecimal notation normally has no added spaces or
dots; however, 0X (or 0x) is added at the beginning or the
subscript 16 at the end to show that the number is in
hexadecimal.
a. 0X810B0BEF or 810B0BEF16
b. 0XC1831BFF or C1831BFF16
CLASSFUL ADDRESSING
1 1 1 1
Start
0 0 0 0
Solution
Solution
a. The first byte is 227 (between 224 and 239); the class is D.
b. The first byte is 193 (between 192 and 223); the class is C.
c. The first byte is 14 (between 0 and 127); the class is A.
d. The first byte is 252 (between 240 and 255); the class is E.
e. The first byte is 134 (between 128 and 191); the class is B.
Netid and Hostid
an IP address in classes A, B, and C is divided
into netid and hostid.
These parts are of varying lengths, depending
on the class of the address.
Figure Netid and hostid
Classes and Blocks
One problem with classful addressing
- each class is divided into a fixed number of
blocks with each block having a fixed size.
Class A
Solution
1. The number of addresses in this block is N =
232−n = 16,777,216.
2. To find the first address, we keep the leftmost
8 bits and set the rightmost 24 bits all to 0s.
The first address is 73.0.0.0/8, in which 8 is the
value of n.
3. To find the last address, we keep the leftmost
8 bits and set the rightmost 24 bits all to 1s.
The last address is 73.255.255.255.
Figure Solution to Example 7
Example 8
An address in a block is given as 180.8.17.9. Find
the number of addresses in the block, the first
address, and the last address.
Solution
1. The number of addresses in this block is N =
232−n = 65,536.
2. To find the first address, we keep the leftmost
16 bits and set the rightmost 16 bits all to
0s. The first address is 18.8.0.0/16, in which
16 is the value of n.
3. To find the last address, we keep the leftmost
16 bits and set the rightmost 16 bits all to
1s. The last address is
18.8.255.255.
Figure Solution to Example 8
Example 9
An address in a block is given as 200.11.8.45.
Find the number of addresses in the block, the
first address, and the last address.
Solution
1. The number of addresses in this block is N =
232−n = 256.
2. To find the first address, we keep the leftmost
24 bits and set the rightmost 8 bits all to
0s. The first address is
200.11.8.0/24, in which 24 is the value of n.
3. To find the last address, we keep the leftmost
24 bits and set the rightmost 8 bits all to
1s. The last address is
200.11.8.255/24.
Figure Solution to Example 9
Example 10
Given the network address 17.0.0.0, find the class, the block, and
the range of the addresses.
Example 10
Given the network address 17.0.0.0, find the class, the block, and
the range of the addresses.
•Solution
The class is A because the first byte is between 0 and 127. The
block has a netid of 17. The addresses range from 17.0.0.0 to
17.255.255.255.
Example 11
Solution
Solution
The class is C, the block is 220.34.76, and the range of
addresses is 220.34.76.0 to 220.34.76.255
Network Address
- the first address of a block
- used in routing a packet to its destination network.
Note
Solution
The default mask is 255.0.0.0, which means that only the first
byte is preserved and the other 3 bytes are set to 0s. The network
address is 23.0.0.0.
Example 14
Solution
The default mask is 255.255.0.0, which means that the first 2
bytes are preserved and the other 2 bytes are set to 0s. The
network address is 132.6.0.0.
Example 15
Solution
The default mask is 255.255.255.0, which means that the first 3
bytes are preserved and the last byte is set to 0. The network
address is 201.180.56.0.