IP Addressing and Routing Notes
Internet Layer: IP Addressing and Routing
Unit 3 Overview
Focuses on the internet layer, covering IP addressing (classful and classless), subnetting, routing algorithms, protocols (IP, ARP, RARP), Software Defined Network (SDN), and design issues.
TCP/IP Protocol Suite
Illustrates the TCP/IP protocol suite layers:
Application Layer: Includes applications like NFS, SMTP, FTP, DNS, SNMP, TFTP, and RPC.
Transport Layer: TCP and UDP protocols.
Network Layer: IP, ICMP, IGMP, ARP, and RARP protocols.
Data Link Layer: Protocols defined by underlying networks.
Physical Layer.
Encapsulation
Encapsulation: The process of adding a header or trailer to the Protocol Data Unit (PDU) at each layer of the OSI model.
Protocol Data Unit (PDU): Consists of layer n control information and layer n+1 encapsulated data for same-layer interaction.
Examples: L7PDU, L6PDU, …, L2PDU.
Encapsulation Layers:
Application: Data
Transport: TCP Data → Segment
Network: IP Data → Packet or Datagram
Data Link: LH (Link Header) Data LT (Link Trailer) → Frame
Physical: Bits (10101010101010)
LH - Link Header, LT - Link Trailer
Internet Protocol (IP)
IP: The host-to-host network layer delivery protocol for the Internet.
Connectionless Datagram Protocol: IP is a connectionless datagram protocol for packet switching networks.
Best Effort Delivery Service: IP provides no error control or flow control.
Error Detection: IP uses a checksum mechanism and discards corrupted packets.
Reliability: IP relies on the TCP layer for reliable delivery; it does its best to deliver packets without guarantees.
IP Addressing
Definition: An IP address is a 32-bit address that uniquely and universally defines the connection of a host or router to the Internet.
Uniqueness: Each IP address defines one, and only one, connection to the Internet. No two devices on the Internet can have the same address.
IP Addresses: Classful Addressing
Classful Network Addressing
Division: Divides the address space of IPv4 into five classes (A, B, C, D, E) based on the first octet's higher-order bits.
Classes:
A:
0---(Unicast)B:
10--(Unicast)C:
110-(Unicast)D:
1110(Multicast)E:
1111(Reserved)
Netid and Hostid
Structure: An IP address consists of 4 bytes (32 bits).
Netid: Defines the network.
Hostid: Identifies a host on that network.
Dotted-Decimal Notation
Representation: Converts the four bytes of an IP address into four decimal numbers separated by dots.
Example:
10000000 00001011 00000011 00011111becomes128.11.3.31.
IP Address Conversion Examples
Binary to Dotted-Decimal:
a.
10000001 00001011 00001011 11101111→129.11.11.239b.
11000001 10000011 00011011 11111111→193.131.27.255c.
11100111 11011011 10001011 01101111→231.219.139.111d.
11111001 10011011 11111011 00001111→249.155.251.15
Dotted-Decimal to Binary:
a.
111.56.45.78→01101111 00111000 00101101 01001110b.
221.34.7.82→11011101 00100010 00000111 01010010c.
241.8.56.12→11110001 00001000 00111000 00001100d.
75.45.34.78→01001011 00101101 00100010 01001110
IP Address Error Identification
Examples of Errors:
a.
111.56.045.78→ Leading zeroes in dotted-decimal notation are invalid.b.
221.34.7.8.20→ More than four numbers in an IP address is invalid.c.
75.45.301.14→ Each number must be less than or equal to 255.d.
11100010.23.14.67→ Mixing binary and dotted-decimal notation is invalid.
Hexadecimal Notation
Conversion from Binary:
a.
10000001 00001011 00001011 11101111→0X810B0BEFor810B0BEF16b.
11000001 10000011 00011011 11111111→0XC1831BFForC1831BFF16
Occupation of Address Space
Class A: 50% of address space, addresses
Class B: 25% of address space, addresses
Class C: 12.5% of address space, addresses
Class D: 6.25% of address space, addresses
Class E: 6.25% of address space, addresses
Finding the Address Class
Binary Notation:
Class A: First bit is 0.
Class B: First two bits are 10.
Class C: First three bits are 110.
Class D: First four bits are 1110 (Multicast address).
Class E: First four bits are 1111 (Reserved).
Examples:
a.
00000001 00001011 00001011 11101111→ Class A.b.
11000001 10000011 00011011 11111111→ Class C.c.
10100111 11011011 10001011 01101111→ Class B.d.
11110011 10011011 11111011 00001111→ Class E.
Finding the Class in Decimal Notation
Class Ranges:
Class A: 0 to 127
Class B: 128 to 191
Class C: 192 to 223
Class D: 224 to 239
Class E: 240 to 255
Examples:
a.
227.12.14.87→ Class D (227 is between 224 and 239).b.
193.14.56.22→ Class C (193 is between 192 and 223).c.
14.23.120.8→ Class A (14 is between 0 and 127).d.
252.5.15.111→ Class E (252 is between 240 and 255).e.
134.11.78.56→ Class B (134 is between 128 and 191).
Blocks in Class A
Structure:
Netid: First byte
Hostid: Last three bytes
Example:
73.0.0.0to73.255.255.255
Number of Addresses: addresses in each block
Wastage: Millions of class A addresses are wasted due to inefficient allocation.
Blocks in Class B
Structure:
Netid: First two bytes
Hostid: Last two bytes
Example:
180.8.0.0to180.8.255.255
Number of Addresses: 16,384 blocks, with 65,536 () addresses in each block
Wastage: Many class B addresses are wasted.
Blocks in Class C
Structure:
Netid: First three bytes
Hostid: Last byte
Example:
200.11.8.0to200.11.8.255
Number of Addresses: 2,097,152 blocks, with 256 addresses in each block.
Limitations of Classful Addressing
Class C Too Small: The number of addresses in class C is smaller than the needs of most organizations.
Class D: Used for multicasting; only one block in this class.
Class E: Reserved for future purposes; most of the block is wasted.
Assignment: The network address (the first address in the block) is assigned to the organization.
Inference: Range of addresses can be inferred from the network address.
Network Address Examples
Example 9: Given network address
17.0.0.0:Class: A (first byte between 0 and 127)
Block: Netid of 17
Range:
17.0.0.0to17.255.255.255
Example 10: Given network address
132.21.0.0:Class: B (first byte between 128 and 191)
Block: Netid of 132.21
Range:
132.21.0.0to132.21.255.255
Example 11: Given network address
220.34.76.0:Class: C (first byte between 192 and 223)
Block: Netid of 220.34.76
Range:
220.34.76.0to220.34.76.255
Default Masks
Class A:
255.0.0.0(Binary:11111111 00000000 00000000 00000000)Class B:
255.255.0.0(Binary:11111111 11111111 00000000 00000000)Class C:
255.255.255.0(Binary:11111111 11111111 11111111 00000000)
Finding Network Address
Process: Apply the default mask to any address in the block.
Result: Retains the netid and sets the hostid to zero.
Example 12: Address
23.56.7.91:Default mask:
255.0.0.0Network address:
23.0.0.0
Example 13: Address
132.6.17.85:Default mask:
255.255.0.0Network address:
132.6.0.0
Example 14: Address
201.180.56.5:Default mask:
255.255.255.0Network address:
201.180.56.0
Important Note
Rule: Do not apply the default mask of one class to an address belonging to another class.
Classful Addressing Issues
Class C Limitation: Too small for many sites.
Class B Wastage: Often much larger than required.
Class A Limitation: Too big for any organization.
IP Address Depletion: Unanticipated growth led to running out of IP addresses, especially Class B addresses.
Solution: Classful networking replaced by Classless Inter-Domain Routing (CIDR).
Special Addresses
Network Address:
Netid: Specific
Hostid: All 0s
Use: Destination
Direct Broadcast Address:
Netid: Specific
Hostid: All 1s
Use: Destination
Limited Broadcast Address:
Netid: All 1s
Hostid: All 1s
Use: Destination
Broadcasting
Limited Broadcasting
Data reaches all hosts in the same network.
Directed Broadcast
A host in one network sends a message to all hosts in another network.
Network Address with examples
Special All 0s
Example 123.0.0.0 Class A
Direct Broadcast address with example
Hostid All 1s
Example Destination IP address: 221.45.71.255
Limited broadcast address
Netid and hostid All 1s
Destination IP address: 255.255.255.255 Router
Subnetting and Supernetting Overview
Context: Problems with classful addressing (address depletion, increasing demand).
Solutions: Subnetting and Supernetting.
Subnetting
Definition: Dividing a bigger network into smaller networks for security and easier maintenance.
Process: Choose bits from the host ID part to create subnets.
Example: Dividing network
193.1.2.0into two subnets:Subnet-1:
193.1.2.0to193.1.2.127Subnet-2:
193.1.2.128to193.1.2.255
Subnet ID
Definition: Each subnet has a unique network address called its Subnet ID.
Creation: Borrow bits from the Host ID part of the IP Address.
Number of Bits: Number of borrowed bits depends on the number of subnets created.
Formula To divide a network into four (22) parts you need to choose two bits from host id part for each subnet i.e, (00, 01, 10, 11). 1.To divide a network into eight (23) parts you need to choose three bits from host id part for each subnet i.e, (000, 001, 010, 011, 100, 101, 110, 111) and so on.
Types of Subnetting
Fixed Length Subnetting (Classful): All subnets are of the same size, have an equal number of hosts, and the same subnet mask.
Variable Length Subnetting (Classless).
Fixed Length Subnetting Example
Example 1: Start with network with IP Address 200.1.2.0.
Divide into 2 subnets.
Total number of IP Addresses
Total number of hosts that can be configured
IP Address of the subnets
Range of IP Addresses
Direct Broadcast Address
Limited Broadcast Address
200 120/10
Division into 2 subnets
Division into 2 subnets
IP Address of the subnets*
200.1.2.0
200.1.2.128
For 1st Subnet-
Total number of IP Addresses
27 = 128
Total no. of hosts that can be configured
128 – 2 = 126
Range of IP Addresses
[200.1.2. 00000000,
200.1.2. 01111111 ]
[200.1.2.0, 200.1.2.127]
Direct Broadcast Address
200.1.2.01111111
For 2nd Subnet-
27 = 128
128 – 2 = 126
[200.1.2.10000000,
200.1.2. 11111111]
[200.1.2.128, 200.1.2.255]
200.1.2.11111111
Limited Broadcast Address 255.255.255.255 255.255.255.255Here, the subnetting will be performed in two steps-*
1. Dividing the given network into 2 subnets
2. Dividing one of the subnets further into 2 subnets
Solution:
*IP Address of the subnets 200.1.2.0.
Total number of IP Addresses 27 = 128..
Total no. of hosts that can be configured 128 – 2 = 126.
*Range of IP Addresses: ***[200.1.2. 00000000, 200.1.2. 01111111 ] **[200.1.2.0, 200.1.2.127]] ***
Note- 255.255.255.255 255.255.255.255
Subnetting example02*
Want to subnet and divide this network into 4 subnet:
200.1.2.128
200.1.2.0
200.1.2.0
200.1.2.64
200.1.2.192 Division into 4 subnets
For 3rd Subnet-
IP Address of the subnet = 200.1.2.128
Total number of IP Addresses = 26 = 64
Total number of hosts that can be configured = 64 – 2 = 62
Range of IP Addresses = [200.1.2.10000000, 200.1.2.10111111] =
[200.1.2.128, 200.1.2.191]
Direct Broadcast Address = 200.1.2.10111111 = 200.1.2.191
Limited Broadcast Address = 255.255.255.255
For 4th Subnet-*
IP Address of the subnet = 200.1.2.192
Total number of IP Addresses = 26 = 64
Total number of hosts that can be configured = 64 – 2 = 62
EXAMPLE -
Want to do subnetting and divide this network into 3 subnet
Here, the subnetting will be performed in two steps-
Dividing one of the subnets further into 2 subnets - 1.
Disadvantages of Subnetting-
Subnetting leads to loss of IP Addresses
leads to complicated communication process.
Supernetting
Definition: Combining multiple contiguous networks into a bigger network (Supernetwork or Supernet).
Supernetting Points to Note
All the Networks should be contiguous.
The block size of every network should be equal..
* First Network id should be exactly divisible by whole size of supernet.
Formula2n.
You can easily see that all networks are contiguous all having size 256 hosts.
First IP address exactly divisible by total size: When a binary number is divided by 2n then last n bits are the remainder. Hence in order to prove that first IP address is exactly divisible by the size of. In the given example first IP is 200.1.0.0 and whole size of supernet is 4*28 = 210. If last 10 bits of first IP address are zero then IP will be divisible.
*Limitations*:
All the networks should be in same class *
It cannot cover different area of network when combined*
*
Supernet*
Reduce the wastage of IP addresses in a block, we use sub-netting
Subnet mask* is found by putting the given number of bits out of 32 as 1, like, in the given address, we need to put 28 out of 32 bits as 1 and the rest as 0, and so, the subnet mask would be ** 255.255.255.240.*
Number of subnets: Given bits for mask
A supernetwork
What is the subnetwork address if the destination address is 200.45.34.56 and the subnet mask is 255.255.240.0?
Classless Addressing
Is an improved IP Addressing system.*
CIDR Notation*
a.b.c.d / n / IP network prefix tells the number of bits used for the identification of network.
. Remaining bits are used for the identification of hosts in the network.
To have 24 total number of IP Addresses,Total 4 bits are required in the Host ID part.
Given the CIDR representation 20.10.30.35 / 27., find the
Range of IP Addresses in the CIDR block
Remaining 5 bits :host idfirst IP Address must be divisible by size of the block..*
The idea of subnetting and supernetting of classful addresses is almost obsolete
ROUTING ALGORITHM
*
Routing Algorithms
Router
Manages network traffic and finds the best route for sending packets.
*
Router needs to have some information about network status
in order to make decisions regarding how and where to send packets*
Popular routing protocols
Distance
vector
*Protocols used
RIV
*Link** stateOSPF
INTRA- AND INTERDOMAIN ROUTING*
Routing inside an autonomous system is referred to as intradomain routing.*
Routing between autonomous systems is referred to as interdomain routing.
FINDING THE BEST ROUTE TO A DESTINATIONLike the number of hops
parameters
Thes algorthims are either global routing algothirm OR decentralized Routing Algorthims
*
Distance Vector Routing
The least cost route between any two nodes is identified as the route with minimum distance.*
In this protocol each node maintains a vector (table) of minimum distances to every node
The Routing Information Protocol (RIP) is an intradomain routing protocol for the algorithm
Note*
In distance vector routing, each node shares its routing table with its immediate neighbors periodically and when there is a change.*
I send information
about my neighbors
to every router.
**##### Link State Routing
Each router shares the knowledge of its neighborhood with every other router in the internetwork**
LS algorithms flow charts*
Dijkstra algorithm flow charts*
The idea of subnetting and supernetting of classful addresses is almost obsolete!!!!.!!!!