Mod6 IP Addressing
Mod6 IP Addressing
Mod6 IP Addressing
Computer Networks
Module 6: IP Addressing
1. Logical addressing
2. Routing
Internet Protocol (IP) address
It is a unique id used for communication over the Internet designed by IANA
(Internet Assigned numbers authority).
Depending on whether your prefix length is fixed or variable we have two types of
addressing:
● Classful addressing
● Classless addressing or CIDR (Classless interdomain routing)
Classful addressing
IP addresses are defined in five classes from A-E.
Classful addressing
IP addresses are defined in five classes from A-E. Based on the first octet:
Classful addressing
IP addresses are defined in five classes from A-E. Based on the first octet:
Subnet mask
Prefix tells you no. of network or on bits and suffix represent the number of host or
off bits. Together on/off bits form a subnet mask.
Subnet mask defines the network and host portion for any IP address.
Example: 255.0.0.0
Subnet mask
Prefix tells you no. of network or on bits and suffix represent the number of host or
off bits. Together on/off bits form a subnet mask.
Subnet mask defines the network and host portion for any IP address.
Example: 255.0.0.0
Subnet mask defines the network and host portion for any IP address.
Example: 255.0.0.0
No. of hosts per network = 2^h-2 where -2 is done as one address each is
reserved for network id and broadcast address.
Classful addresses
Classful addresses
Classless addressing or CIDR notation
Prefix length is variable.
Classless addressing or CIDR notation
Prefix length is variable.
CIDR uses slash notation: x.y.z.w/n where x.y.z.w is the IP address and n denotes
the network bits which will represent the subnet mask.
Example: 12.13.128.10/10
Classless addressing or CIDR notation
Prefix length is variable.
CIDR uses slash notation: x.y.z.w/n where x.y.z.w is the IP address and n denotes
the network bits which will represent the subnet mask.
CIDR uses slash notation: x.y.z.w/n where x.y.z.w is the IP address and n denotes
the network bits which will represent the subnet mask.
To create subnets:
To create subnets:
255.255.255.11100000 = 255.255.255.224
255.255.255.11100000 = 255.255.255.224
0-32-64-96-128-...
5. IP address implementation
Example: 194.168.100.0 for 5 subnets
1. Identify class and get the default subnet mask: C - 255.255.255.0
2. Identify the no. of network bits required: 2^n>= No. of required subnets ⇒ n=3
3. Create new subnet mask - change the effective octet value
255.255.255.11100000 = 255.255.255.224
0-32-64-96-128-...
5. IP address implementation
194.168.100.0 - NID 1
194.168.100.32 - NID 2
Example: 194.168.100.0 for 5 subnets
1. Identify class and get the default subnet mask: C - 255.255.255.0
2. Identify the no. of network bits required: 2^n>= No. of required subnets ⇒ n=3
3. Create new subnet mask - change the effective octet value
255.255.255.11100000 = 255.255.255.224
0-32-64-96-128-...
5. IP address implementation
194.168.100.32 - NID 2
Example: 194.168.100.0 for 5 subnets
255.255.255.11100000 = 255.255.255.224
0-32-64-96-128-...
5. IP address implementation
No. of hosts per subnet = 2^total off bits -2= 2^5-2=30 hosts /subnet
Classless addressing or CIDR
Class privilege was removed to compensate for address depletion. Prefix length is
variable.
CIDR uses slash notation: x.y.z.w/n where x.y.z.w is the IP address and n denotes
the network bits which will represent the subnet mask.
CIDR uses slash notation: x.y.z.w/n where x.y.z.w is the IP address and n denotes
the network bits which will represent the subnet mask.
For 120:
192.168.1.0 - NID 1
192.168.1.128 - NID 2
Example: 192.168.1.0/25 with host requirements of
20,62,120
For 62:
192.168.1.128 NID 2
192.168.1.192 NID 3
Example: 192.168.1.0/25 with host requirements of
20,62,120
For 20:
192.168.1.192 NID 3
192.168.1.224 NID 4
Hierarchical addressing in IPV4
Hierarchical addressing in IPV4
Hierarchical addressing in IPV4 with subnetting
Hierarchical addressing in IPV4 with subnetting
Example: 167.199.170.82/27. What is the NID, BID?
Example: 167.199.170.82/27. What is the NID, BID?
Soln: Subnet mask=255.255.255.224
Block size=256-224=32
0-32-64-96-128
Example: 167.199.170.82/27. What is the NID, BID?
Soln: Subnet mask=255.255.255.224
Block size=256-224=32
0-32-64-96-128
NID: 167.199.170.64
BID: 167.199.170.95
Alternate methods
First address in block: Any address in block AND Subnet Mask
Given address x.y.z.w/n: This is like keep n leftmost bits same and set 32-n
rightmost bits to 0.
Given address x.y.z.w/n: This is like keep n leftmost bits same and set 32-n
rightmost bits to 1.
No. of addresses in block: (Not (Subnet Mask))_10 +1
Alternate methods
First address in block: Any address in block AND Subnet Mask
Block size=256-224=32
0-32-64-96-128
NID: 167.199.170.64
BID: 167.199.170.95
BID:
No. of networks:
Example: 194.172.168.171/28
NID: 194.172.168.160
BID: 194.172.168.175
No. of networks: 16
Example: An ISP has following chunk of IP addresses
available 245.248.128.0/20. ISP wants to give half of
this to Organization A and quarter to Organization B
and retain rest with itself. Find a valid allocation.
Example: An ISP has following chunk of IP addresses
available 245.248.128.0/20. ISP wants to give half of
this to Organization A and quarter to Organization B
and retain rest with itself. Find a valid allocation.
Soln: 245.248.128.0/21 - Org A
245.248.136.0/22 - Org B
Network Address Translation (NAT)
Distribution of addresses through ISPs results in problems. Suppose ISP assigns
addresses to a small business and later that business grows. ISP can't allocate
same range IP addresses.
Moreover, in private networks all PCs don't need Internet connectivity. Idea is to
use IP address for both internal and universal communication but without wasting
routable addresses.
Network Address Translation (NAT)
Distribution of addresses through ISPs results in problems. Suppose ISP assigns
addresses to a small business and later that business grows. ISP can't allocate
same range IP addresses.
Moreover, in private networks all PCs don't need Internet connectivity. Idea is to
use IP address for both internal and universal communication but without wasting
routable addresses.
Main idea: Use unique private IP addresses (in ranges with starting address
10.0.0.0, 172.16.0.0.0, 192.168.0.0) for internal communication and a single (or
small set) of global routable addresses for communication over Internet. So, we
need a mapping to map private addresses to universal addresses.
Network Address Translation (NAT)
Single-level translation or using one IP address
Network Address Translation (NAT)
Single-level translation or using one IP address
Network Address Translation (NAT)
Single-level translation or using
one IP address
Network Address Translation (NAT)
Single-level translation or using
one IP address
Procedure: Search table row by row for the NID of the packet. If there is a match
in first column use other two columns to forward data packets.
Normally, last row is a default value which indicates destination addresses that did
not match previous rows.
Forwarding Example
Forwarding Example
Route summarization
Also known as prefix or route or address aggregation.
In this we combine multiple routes into a single subnet called supernet or common
subnet.
172.110.100.0/24
172.110.101.0/24
172.110.102.0/24
172.110.103.0/24
Common subnet:
Route summarization
Also known as prefix or route aggregation.
In this we combine multiple routes into a single subnet called supernet or common
subnet.
172.110.100.0/24
172.110.101.0/24
172.110.102.0/24
172.110.103.0/24
Common subnet: 172.110.100.0/22. Now, if you give router this address it will
allow traffic of all four paths. This also decreases entries in routing table.
Route summarization
Route summarization
Longest mask matching
Suppose in the contiguous supernet one of the organization is not geographically
close to others, so can’t be connect to same router. Can we still use address
aggregation?
Longest mask matching
Suppose in the contiguous supernet one of the organization is not geographically
close to others, so can’t be connect to same router. Can we still use address
aggregation?
If there was no
longest mask
matching packet
would be incorrectly
delivered.
Forwarding of IP Packets
● Within local network
● Across the network boundary
Forwarding of IP Packets
● Within local network - MAC address
● Across the network boundary - IP address
How do you check it? Using NID of both source and destination
Forwarding of IP Packets
● Within local network
○ Use ARP to get the MAC address if not already available in ARP cache.
○ Send the message.
Forwarding of IP Packets
● Across network boundary
○ Use ARP to get the MAC address of default gateway if not already
available in ARP cache.
○ After that, each router forwards it based on their forwarding tables. At
each hop, layer 2 header is stripped and updated.
○ Once the destination network is directly connected network of a router it
again uses ARP to send message directly to that node.
References
● Chapter 19, 22 [BAF], 18 [BAF 5th edition]
● CCNA Routing guide
● Packet flow across Networks.
https://www.geeksforgeeks.org/packet-flow-in-different-network/ [Accessed
date: May 2021]
● Packet Tracking. https://www.youtube.com/watch?v=rYodcvhh7b8 [Accessed
date: May 2021]
● Note: Source of all images unless specified is [BAF] book (4th Edition).