Download - IP Adresses
IP Addresses
An IP address is a unique 32 bits long identifier and gives us maximum 2^32 addresses.
IP address is a logical address in the network layer.
Every host and router on the internet has an IP address.
What Is An IP Address?
IP address does not actually refer to a host. It really refers to a network interface.
Each IP address has two fundamental parts
* NETWORK PORTION, which describes the physical wire the device is attached to.
* HOST PORTION, which identifies the host on that wire.
There are two prevalent notations to show an IP
address
Binary Notation 01110101 10010101 00011101 00000010
Dotted Decimal Notation 117 . 149 . 29 . 2
1st Byte 2nd Byte 3rd Byte 4th Byte =128 =143 =137 =144
128.143.137.144
Example
10000000 10001111 10001001 10010000
* 111.56.045.78 There must be no leading zero (045). 221.34.7.8.20 There can be no more than four numbers in an IP address. 75.45.301.14 Each number needs to be less than or equal to 255 (301). 11100010.23.14.67 A mixture of binary notation and dotted decimal notation is not allowed.
We can’t write IP address in the following forms
Classful Addressing
The address space is divided into five categories:
1. Class A2. Class B3. Class C4. Class D5. Class E
Class C network id host11 0
Network Prefix24 bits
Host Number8 bits
bit # 0 1 23 242 313
Class B 1 network id hostbit # 0 1 15 162
Network Prefix16 bits
Host Number16 bits
031
Class A 0Network Prefix
8 bits
bit # 0 1 7 8
Host Number24 bits
31
Class D multicast group id11 1bit # 0 1 2 313
04
Class E (reserved for future use)11 1bit # 0 1 2 313
14
05
Class A 1.0.0.0 to 127.255.255.255 Class B 128.0.0.0 to 191.255.255.255 Class C 192.0.0.0 to 223.255.255.255 Class D 224.0.0.0 to 239.255.255.255 Class E 240.0.0.0 to 255.255.255.255
Range Of Host Addresses
Finding the Classes in Binary & Dotted Decimal Notation
Find the class of each addressa. 00000001 00001011 00001011 11101111b. 11000001 10000011 00011011 11111111c. 14.23.120.8d. 252.5.15.111Solutiona. The first bit is 0 - Class Ab. The first 2 bits are 1 & the third bit is 0 - Class Cc. The first byte is 14 - Class Ad. The first byte is 252 - Class E
To create subnets, some host bits are reassigned as network bits.
Always start borrowing with the leftmost host bit.
Subnets
Network Prefix Host Number
Network Prefix Host NumberSubnet Number
1) Class A Borrowing 12 bits for subnets 28.0.0.0
=Network =Subnet =Host
Examples
00011100 00000000 00000000 00000000
00011100 00000000 00000000 00000000
2) Class B Borrowing 5 bits for subnets 147.10.0.0
=Network =Subnet =Host
10010011 00001010 00000000 00000000
10010011 00001010 00000000 00000000
3) Class C Borrowing 3 bits for subnets 192.168.10.0
=Network =Subnet =Host
11000000 10101000 00001010 00000000
11000000 10101000 00001010 00000000
The subnet mask is created, using binary ones in network and subnet bits, and binary zeroes in host bits.
Subnet Mask
If 3 bits were borrowed, the mask for a Class C address would be
= 255.255.255.224 or 255.255.255.224/27
The /27 = the total network and subnet bits. For a Class C this means 3 bits are borrowed
8+8+8+3 For a Class B this means 11 bits are borrowed
8+8+8+3 For a Class A this means 19 bits are borrowed
8+8+8+3
11111111 11111111 11111111 11100000
Number of usable subnets Number of borrowed bits = 2 - 2
Borrow 3 bits : 2³ - 2 = 6 usable subnets Borrow 4 bits : 2⁴ - 2 = 14 usable subnets Borrow 5 bits : 2⁵ - 2 = 30 usable subnets
Number of usable hosts Number of remaining host bits = 2 - 2
3 bits borrowed, leaves 2⁵ - 2 = 30 hosts 4 bits borrowed, leaves 2⁴ - 2 = 14 hosts 5 bits borrowed, leaves 2³ - 2 = 6 hosts
1 Bit is for Subnet Id & Another is for Broadcast
CIDR (Classless Inter-Domain Routing) was introduced in 1993 replacing the previous generation of IP address syntax - classful networks.CIDR introduction allowed for:* More efficient use of IPv4 address space* Prefix aggregation, which reduced the size of
routing tablesCIDR allows routers to group routes together to reduce the bulk of routing information carried by the core routers.
Classless Inter Domain Routing (CIDR)
/10: 4 Million hostsNetwork = 10 bits Host = 22 bits
Network = 19 bits Host = 13 bits
Network = 20 bits Host = 12 bits
Host = 6 bitsNetwork = 24 bits
Network = 28 bits Host = 4bits
/19: 8190 hosts
/20: 4094 hosts
/24: 256 hosts
/28: 14 hosts
Examples
* Efficient Address Space Allocation * Elimination of Class Imbalances * Efficient Routing Entries * No Separate Subnetting Method
Advantages
Without CIDR A router must maintain individual routing table entries for each network.
Routing Table Entries
With CIDR A router can summarize these routes using a single network address by using a 13-bit prefix: 172.24.0.0/13
STEPS:1. Count the number of left-most matching bits, /13 (255.248.0.0)2. Add all zeros after the last matching bit: 172.24.0.0 = 10101100 00011000 00000000 00000000
* IPv6 uses a 128 bit address space, yielding 340,282,366,920,938,463,463,374,607,431,768,211,456
possible addresses.
* IPv6 has been slow to arrive.
* IPv6 requires new software; IT staffs must be retrained.
* IPv6 will most likely coexist with IPv4 for years to come.
* Some experts believe IPv4 will remain for more than 10 years.
Long term Solution : IPV6 (Coming)
EXERCISEQUESTION
S
1. Suppose that instead of using 16 bits for the network part of a class B address originally, 20 bits had been used. How many class B networks would there have been?Solution * With 16 bits we have 2^(16-2) class B networks (16384) * With 20 bits we have 2^(20-2) class B networks (262144)
2 Bits are for the classful addressing
2. Convert the IP address whose hexadecimal representation is C22F1582 to dotted decimal notation.
SolutionC22F1582 = 11000010 00101111 00010101 10000010 = 194.47.21.130
3. A network on the internet has a subnet mask of 255.255.240.0. What is the maximum number of host it can handle? Solution 255.255.240.0
11111111 11111111 11110000 00000000
The mask is 20 bit long, so, the network & subnet part is 20 bit long. The remaining 12 bits are for the host part, so [(2^12)-2]=4094 host addresses exit.
4. A router has just received the following new IP addresses : 57.6.96.0/21, 57.6.104.0/21, 57.6.112.0/21 & 57.6.120.0/21 If all of them use the same outgoing line, can they be aggregated? If so, to what ? If not, why not?
Solution
57.6.96.0/22 : 00111001 00000110 01100000 0000000057.6.104.0/21 : 00111001 00000110 01101000 0000000057.6.112.0/21 : 00111001 00000110 01110000 0000000057.6.120.0/21 : 00111001 00000110 01111000 00000000
The first 19 bits are the same for all the addresses. So, these can be
aggregated to 57.6.96.0/19
5. A route has the following (CIDR) entries in its routing table:
Address/mask Next hop 135.46.56.0/22 Interface 0 135.46.60.0/22 Interface 1 192.53.40.0/23 Router 1 Default Router 2 For each of the following IP address,
a) 135.46.63.10b) 135.46.57.14c) 135.46.52.2d) 192.53.40.7e) 192.53.56.7
(a) 135.46.63.10 135.46.63.10 10000111 00101110 00111111 00001010
255.255.252.0 11111111 11111111 11111100 00000000
AND 135.46.60.0 10000111 00101110 00111100 00000000
It matches entry with 135.46.60.0/22, and no other
matches found, so its forwarded to Interface 1.
Similarly, (b) Interface 0 (c) Router 2 (d) Router 1 (e) Router 2
ThankYou