IP Addressing
What is an IP Address?
• The address space in a protocol That uses N-bits
• An IP address is a unique global address for a network
interface
1
• An IP v4 address:
- is a 32 bit long identifier
address space =2^32= 4,294,967,296.
IP addresses are written in a so-called
• Binary Notation
• Dotted Decimal Notation
• Hexadecimal Notation
• Example:
10000000 10001111 10001001 10010000
1st Byte 2nd Byte 3rd Byte 4th Byte
= 128 = 143 = 137 = 144
[Link]
2
CLASSFUL ADDRESSING
• In classful addressing the address space is divided into 5
classes:
A, B, C, D, and E.
• Occupation of the address space
Finding the class in binary notation
3
Finding the class in decimal notation
Network prefix and Host number
• The network prefix identifies a network and the host number
identifies a specific host (actually, interface on the network).
network prefix(Netid) host number(hostid)
4
Default Sebnet Mask
• Class A default mask is [Link]
• 11111111 00000000 00000000 00000000
• Number of N= 128 (27) why (27) not (28)
• Number of H= (224)
• Class B default mask is [Link]
• 11111111 11111111 00000000 00000000
• Number of N= 16,384 (214)
• Number of H= 65,536 (216)
•
• Class C Default mask [Link]
• 11111111 11111111 11111111 00000000
• Number of N= (221)
• Number of H= 256 (28)
Size
of networ Size Total
Leading Number Addresses Start End
Class k of rest addresses
bits of networks per network address address
number bi bit field in class
t field
2,147,483, 127.255.255.
Class A 0 8 24 128 (27) 16,777,216 (224) [Link]
648 (231) 255
1,073,741, 191.255.255.
Class B 10 16 16 16,384 (214) 65,536 (216) [Link]
824 (230) 255
2,097,152 536,870,9 223.255.255.
Class C 110 24 8 256 (28) [Link]
(221) 12 (229) 255
Class D not not 268,435,4 239.255.255.
1110 not defined not defined [Link]
(multicast) defined defined 56 (228) 255
Class E not not 268,435,4 255.255.255.
1111 not defined not defined [Link]
(reserved) defined defined 56 (228) 255
5
IP validator
IP
10.168.0001.100 Invalid
[Link] Invalid ,number exceeds 255
[Link] Invalid
192.168. 224 Invalid
[Link] 1 Invalid
[Link] valid class B-broadcast address
[Link] valid, class-C network address
[Link] valid, class D (multicast)
[Link] valid, class B
Appendix: Reserved IP Addresses
• Another set of IP addresses that are restricted even further
are called reserved IP addresses.
• In the Internet addressing architecture, the Internet Engineering Task Force (IETF)
and the Internet Assigned Numbers Authority (IANA) have reserved various
Internet Protocol (IP) addresses for special purposes.
12
6
13
Classful vs Classless
7
Classful subnetting
• Network ID = [Link] and divided it 4 blocks
I. 1subnet with 12 hosts.
II. 2subnet with 44 hosts.
III. 3subnet with 2 hosts
IV. 4subnet with 24 hosts.
15
Classless Variable-Length Subnet Masking
(VLSM)
• The first step must be to arrange subnet networks and then
convert the number to multiples number 2.
I. 12 hosts, the smallest subnet would be a block of 16.
II. 44 hosts, the smallest subnet would be a block of 64.
III. 2 hosts, the smallest subnet would be a block of 4.
IV. 24 hosts, the smallest subnet would be a block of 32
16
8
Example1:
Company have three departments connected with wan links.
• Development department have 74 computers.
• Production department have 52 computers.
• Administrative department have 28 computers.
• All departments are connected with each other via wan link.
• Each wan link requires two IP addresses.
[Link]/24
Subnet Segment Hosts
1 Development 74
2 Production 52
3 Administrative 28
4 Wan link 1 2
5 Wan link 2 2
6 Wan link 3 2
17
Three departments and 3 WANs
wan
wan
wan
74 hosts 52 hosts 28 hosts
18
9
IP Address=[Link]/24
Subnet Mask = [Link] = 11111111.11111111.11111111.00000000
Solution:
Network1:
largest segment needs 74 host addresses
74 27 = 128
Subnet Mask = [Link] = 11111111.11111111.11111111.10000000
Or 256 – subnet size = subnet mask 256-128=128
Segment Development
Requirement 74
CIDR /25
Subnet mask [Link]
Network ID [Link]
First hosts [Link]
Last hosts [Link]
Broadcast ID [Link] 19
Network2:
second largest segment needs 52 host addresses
52 26 = 64
Subnet Mask = [Link] = 11111111.11111111.11111111.11000000
Segment Production
Requirement 52
CIDR /26
Subnet mask [Link]
Network ID [Link]
First hosts [Link]
Last hosts [Link]
Broadcast ID [Link]
20
10
Network3:
second largest segment needs 28 host addresses
28 25 = 32
Subnet Mask = [Link] = 11111111.11111111.11111111.11100000
Segment Administrative
Requirement 28
CIDR /27
Subnet mask [Link]
Network ID [Link]
First hosts [Link]
Last hosts [Link]
Broadcast ID [Link]
21
Segments Wan Link 1 Segments Wan Link 2
Requirement 2 Requirement 2
CIDR /30 CIDR /30
Subnet mask [Link] Subnet mask [Link]
Network ID [Link] Network ID [Link]
First hosts [Link] First hosts [Link]
Last hosts [Link] Last hosts [Link]
Broadcast ID [Link] Broadcast ID [Link]
Segments Wan Link 3
Requirement 2
CIDR /30
Subnet mask [Link]
Network ID [Link]
First hosts [Link]
Last hosts [Link]
Broadcast ID [Link]
22
11
Example2:
Company have three departments connected with wan links.
• HQ = 50 host
• RO1 = 30 hosts
• RO2 = 10 hosts
• 2 WAN links
[Link]/24. Class C
23
IP Address=[Link]/24
Subnet Mask = [Link] = 11111111.11111111.11111111.00000000
Solution:
Network1:
largest segment needs 50 host addresses
50 26 = 64
Subnet Mask = [Link] = 11111111.11111111.11111111.11000000
Segment HQ
Requirement 50
CIDR /26
Subnet mask [Link]
Network ID [Link]
First hosts [Link]
Last hosts [Link]
Broadcast ID [Link] 24
12
Network2:
second largest segment needs 30 host addresses
30 25 = 32
Subnet Mask = [Link] = 11111111.11111111.11111111.11100000
Segment RO1
Requirement 30
CIDR /27
Subnet mask [Link]
Network ID [Link]
First hosts [Link]
Last hosts [Link]
Broadcast ID [Link]
25
Network3:
second largest segment needs 28 host addresses
10 24 = 16
Subnet Mask = [Link] = 11111111.11111111.11111111.11110000
Segment RO2
Requirement 16
CIDR /28
Subnet mask [Link]
Network ID [Link]
First hosts [Link]
Last hosts [Link]
Broadcast ID [Link]
26
13
Segments Wan Link 1 Segments Wan Link 2
Requirement 2 Requirement 2
CIDR /30 CIDR /30
Subnet mask [Link] Subnet mask [Link]
Network ID [Link] Network ID [Link]
First hosts [Link] First hosts [Link]
Last hosts [Link] Last hosts [Link]
Broadcast ID [Link] Broadcast ID [Link]
27
Example4:
• Network: [Link]/22
Subnet Needed Size Addres Broadca Ma
Assignable Range
st
Dec Mask
NO Size 2^ s sk
1 400 512 [Link] [Link] - [Link] [Link] [Link] /23
2 180 256 [Link] [Link] - [Link] [Link] [Link] /24
3 40 64 [Link] [Link] - [Link] [Link] [Link] /26
4 18 32 [Link] [Link] - [Link] [Link] [Link] /27
5 4 8 [Link] [Link] - [Link] [Link] [Link] /29
6 4 8 [Link] [Link] - [Link] [Link] [Link] /29
28
14
VLSM
• [Link]/20
• 3000 hosts
• 2000 hosts
• 1000 hosts
• 2 hosts
29
Number of hosts= 212 Mask =1111111.11111111.11110000.00000000/20
a) 256< 212 = 4096 / 256 = 16 => + 15.255
b) From MASK 256-240 = 16 0r by bit -> 16
host mask Net ID FA LA BC
3000 212 [Link] [Link] [Link] [Link] [Link]
Number of hosts= 211 Mask =1111111.11111111.11111000.00000000/21
a) 256< 211 = 2048 / 256 = 8 => + 7.255
b) From MASK 256-248 = 8
host mask Net ID FA LA BC
2000 211 [Link] [Link] [Link] [Link] [Link]
Number of hosts= 210 Mask =1111111.11111111.11111100.00000000/22
a) 256< 210 = 1024 / 256 = 4 => + 3.255
b) From MASK 256-252 = 4
host mask Net ID FA LA BC
1000 210 [Link] [Link] [Link] [Link] [Link]
30
15
host mask Net ID FA LA BC
1000 210 [Link] [Link] [Link] [Link] [Link]
Number of hosts= 22 Mask =1111111.11111111.11111111.11111100/30
host mask Net ID FA LA BC
2 22 [Link] [Link] [Link] [Link] [Link]
31
VLSM
• [Link]/10
• 500 hosts
• 100 hosts
• 100 hosts
• 2 hosts
• 2 hosts
32
16
Number of hosts= 29 Mask =1111111.11111111.11111110.00000000/23
a) 256< 29 = 512 / 256 = 2=> + 1.255
b) From MASK 256-254 = 2
host mask Net ID FA LA BC
512 29 [Link] [Link] [Link] [Link] [Link]
Number of hosts= 27 Mask =1111111.11111111.11111111.10000000/25
a) From MASK 256-128 = => 128
host mask Net ID FA LA BC
100 28 [Link] [Link] [Link] [Link] [Link]
Number of hosts= 27 Mask =1111111.11111111.11111111.10000000/25
a) From MASK 256-128 = => 128
host mask Net ID FA LA BC
100 28 [Link] [Link] [Link] [Link] [Link]
33
host mask Net ID FA LA BC
100 28 [Link] [Link] [Link] [Link] [Link]
Number of hosts= 22 Mask =1111111.11111111.11111111.11111100/30
host mask Net ID FA LA BC
2 22 [Link] [Link] [Link] [Link] [Link]
Number of hosts= 22 Mask =1111111.11111111.11111111.11111100/30
host mask Net ID FA LA BC
2 22 [Link] [Link] [Link] [Link] [Link]
34
17
Subnetting
35
Example
• IP=[Link] /16 Subnet=6
Class B
Num of Subnets 2^3=8 Convert 3 bit from 0 to 1 in Mask
CIDR 16+3=19 (Number of 1 in Subnet Mask)
Default Mask [Link]
[Link]
1111111.11111111.00000000.00000000
Subnet Mask 1111111.11111111.11100000.00000000
[Link] (128+64+32=224)
[Link]
Num of Hosts 2^13 - 2 (Number of 0 in Subnet Mask)
36
18
Example 1
• IP=[Link] /16 Subnet=6
Class B
Num of Subnets 2^3=8 Convert 3 bit from 0 to 1 in Mask
CIDR 16+3=19 (Number of 1 in Subnet Mask)
Default Mask [Link]
[Link]
1111111.11111111.00000000.00000000
Subnet Mask 1111111.11111111.11100000.00000000
[Link] (128+64+32=224)
[Link]
Num of Hosts 2^13 - 2 (Number of 0 in Subnet Mask)
37
Range (IP=[Link])
The amount of jump per network from SMask =32
1111111.11111111.11100000.00000000
128 64 32 16 8 4 2 1 128 64 32 16 8 4 2 1
Range of Range of Host Broadcast
Subnet First Address to Last Address
[Link] [Link]
+32
[Link] [Link]
+32
[Link] [Link]
[Link] [Link]
38
19
Range (IP=[Link])
The amount of jump per network from SMask =32
From mask
1111111.11111111.11100000.00000000 256-224=32
128 64 32 16 8 4 2 1 128 64 32 16 8 4 2 1
Range of Range of Host Broadcast
Subnet First Address to Last Address
[Link] [Link] to [Link] [Link]
+32
[Link] [Link] to [Link] [Link]
+32
[Link] [Link] to [Link] [Link]
[Link] [Link] to [Link] [Link]
39
Example 2
• IP=[Link] /16 Subnet=2000
Class
Num of Subnets
CIDR/
Default Mask
Subnet Mask
Num of Hosts
40
20
Example3
• IP=[Link] /16 Subnet=2000
Class B
Num of Subnets 2^11=2048
CIDR/ 16+11=27 (Number of 1 in Subnet Mask)
Default Mask [Link]
[Link]
1111111.11111111.00000000.00000000
Subnet Mask 1111111.11111111.11111111.11100000
255.255..255.224
[Link]
Num of Hosts 2^5 - 2 (Number of 0 in Subnet Mask)
41
Range (IP=[Link])
The amount of jump per network from SMask =1 in 3Byte 32 in 4Byte
1111111.11111111.11111111.11100000
128 64 32 16 8 4 2 1 128 64 32 16 8 4 2 1
42
21
Range of host
# Subnet From To Broadcast
0 [Link] [Link] [Link] [Link]
1 [Link] [Link] [Link] [Link]
2 [Link] [Link] [Link] [Link]
3 [Link] [Link] [Link] [Link]
4 [Link] [Link] [Link] [Link]
5 [Link] [Link] [Link] [Link]
6 [Link] [Link] [Link] [Link]
7 [Link] [Link] [Link] [Link]
8 [Link] [Link] [Link] [Link]
9 [Link] [Link] [Link] [Link]
2048 [Link] [Link] [Link] [Link]
43
IP=[Link] /8 Subnets=500
or IP=[Link]/17
Class
Num of Subnets
CIDR
Default Mask
Subnet Mask
Num of Hosts
44
22
IP=[Link] /8 Subnets=500
Class A
Num of Subnets 2^9=512 Convert 9 bit from 0 to 1 in Mask
CIDR 8+9=17 (Number of 1 in Mask)
Default Mask [Link]
[Link]
1111111.11111111.00000000.00000000
Subnet Mask 1111111.11111111.11111111.10000000
[Link]
[Link]
Num of Hosts 2^7 - 2 (Number of 0 in Subnet Mask)
45
Range (IP=[Link])
The amount of jump per network from SMask =1 in 3Byte 128 in 4Byte
1111111.11111111.11111111.10000000
128 64 32 16 8 4 2 1 128 64 32 16 8 4 2 1
Range of Range of Host Broadcast
Subnet First Address to Last Address
[Link] [Link] to [Link] [Link]
+32
[Link] [Link] to [Link] [Link]
[Link] [Link] to [Link] [Link]
[Link] [Link] to [Link] [Link]
[Link] [Link] [Link] [Link]
46
23
47
Method1
• Ex1:we have network: [Link] /19 and I want to know the
network range of 202 subnet.
• [Link]/19= 8+11 ---->
[Link]
• 1st subnet is zero so 202 th is subnet 201 so convert 201 in
binary and prefix with leading zeroes to get 11 bits value.
• the result is 00011001001 --->
[Link]
• in subnet the host bits are zeroes so --> NNNNNNNN.25.32.0
• ---> [Link]
48
24
Convert 201 to binary by -
128 64 32 16 8 4 2 1
• 201==> 11001001 1 1 0 0 1 0 0 1
201
-
128
73
-
64
9
-
8
1
-
1 49
Another method :
• Nth subnet = (N - 1) / (2^s) = X.Y
•
• where:
N is the subnet you wish to find
S is the number of subnet bits in the "interesting" octet
X = the new number for the 2nd octet
Y * 256 = the number in the interesting octet
•
• Let’s take you first example, [Link]/19, find the 202th
subnet.
•
• [Link]
50
25
• The "interesting" octet is the third octet.
• From the formula, the new subnet is 10.X.(Y*256).0
•
• (202-1)/2^3 = 25.125 ==> 25 is the number for the second octet
• ==> 10.25.(Y*256).0
•
• take .125 * 256 = 32000 ==> 32 is the number for the third octet
• ==> [Link]
• The 202th subnet is [Link]/19
• lets try anothyer one. Try the 15th subnet.
• (15-1)/2^8 = 1.75 ==> 1 is the number for the second octet
• ==> 10.1.(Y*256).0
• take .75 * 256 = 192 ==> 192 is the number for the third octet
• ==> [Link]
51
Number of subnet from mask
• If ip from class B and Mask =[Link]
• 11111111.11111111.11100000/16+3=19
• Number of subnet=23 =8
• Given the following network mask, how many bits are being
used to represent the network?
• Netmask: [Link]
• b)/10
52
26
Convert 400 to binary by -
512 256 128 64 32 16 8 4 2 1
1 1 0 0 1 0 0 0 0
• 400==> 110010000
400
-
256
144
-
128
16
-
16
0
53
27