IP Addressing

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

CAP256: Computer Networks

Unit-4: IP Addressing and Subnetting


Dr. Manmohan Sharma
School of Computer Applications
Lovely Professional University
What is an IP Address
 An IP address is an address used to uniquely identify a
device on an IP network.
 An IP address is a unique global address for a network
interface
 An IPv4 address:
◦ is a 32 bit long identifier
◦ Address Space of IPv4 is 232 or 4,294,967,296.
◦ encodes a network number
◦ and a host number
Dotted Decimal Notation
 IPv4 addresses are written in a so-called dotted decimal
notation
 Each byte is identified by a decimal number in the range
[0 to 255]:
 Example:
10000000 10001111 10001001 10010000
1st Byte 2nd Byte 3rd Byte 4th Byte
= 128 = 143 = 137 = 144

128.143.137.144
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 host number

 How do we know how long the network prefix is?


 The network prefix used to be implicitly defined (class-based
addressing, A,B,C,D…)
 The network prefix now is flexible and is indicated by a
prefix/netmask (classless).
Example: argon.cs.virginia.edu
 IP address is 128.143.137.144
 Is that enough info to route datagram??? -> No, need netmask or prefix
at every IP device (host and router)
 Using Prefix notation IP address is: 128.143.137.144/16
 Network prefix is 16 bits long

 Network mask is: 255.255.0.0 or hex format: ffff0000


--> Network id (IP address AND Netmask) is: 128.143.0.0
--> Host number (IP address AND inverse of Netmask) is: 137.144
128.143 137.144
Classful IP Adressing
 When Internet addresses were standardized (early 1980s), the Internet address
space was divided up into classes:
 Class A: Network prefix is 8 bits long
 Class B: Network prefix is 16 bits long
 Class C: Network prefix is 24 bits long
 Class D: Used for Multicasting
 Class E: Reserved for Scientific Research and Future.

 Each IP address contained a key which identifies the class:


 Class A: IP address starts with “0”
 Class B: IP address starts with “10”
 Class C: IP address starts with “110”
 Class D: IP address starts with “1110”
 Class E: IP address starts with “1111”
Special Cases
• 0.0.0.0: default route, used only during Startup

• 127.xx.yy.zz: loopback, test TCP/IP for IPC on local


machine

• host all 0: this host

• host all 1: limited broadcast (local net)


Problems with Classful IPv4 Addresses
 The original classful address scheme had a number of problems

Problem-1: Too few network addresses for large


networks
 Class A and Class B addresses are gone

Problem-2: Two-layer hierarchy is not appropriate for


large networks with Class A and Class B addresses

For the Problem 1 and 2


Solution-1: Subnetting
Problem-3: Inflexible
Assume a company requires 2,000 addresses
 Class A and B addresses are overkill
 Class C address is insufficient (requires 8 Class C addresses)

Problem 4: Exploding Routing Tables:


Routing on the backbone Internet needs to have an entry for each
network address. In 1993, the size of the routing tables started to
outgrow the capacity of routers.

For the Problem 3 and 4


Solution-2: Classless Interdomain Routing (CIDR)
Problem-5: The Internet is going to outgrow the 32-bit
addresses

Solution-3: IP Version 6
Subnetting
 Sub netting is the process of taking a single Network address and
creating further smaller Network IDs from it, called Subnets (Sub
Networks).
 In the process of sub netting, bits can be borrowed from the host
portion of an IP Address, the borrowed bits are added to the Subnet
Mask of that IP address.
 The main goal behind sub netting a given network address is to
create our required number of smaller network IDs and to achieve
our desired number of hosts per subnet ID.
Subnetting a Class C IP Address
 The basic Subnetting process starts from below mentioned
questions:
How many subnets are required?
How many hosts per subnet are required?
Compute the effective subnets?
Compute the valid host IP Addresses?
 The anatomy of a typical Class C address is:
 N.N.N.H with subnet mask 255.255.255.0 or /24
 Default number of Network bits=24
 Default number of Host bits = 8
Example: An organisation want to setup an IT infrastructure to support 45
system in the office. Network 192.168.10.0/24 is available for allocation, but
the IP address assigning authority want to assign a subnet to this organisation
that will cater its need. Find out how many subnets can be created to support
required number of hosts, calculate the ranges of all the subnets.
Solution:
Step-1: Identify the required number of host bits to support 45 nodes
Host Bits (n) 0 1 2 3 4 5 6 7
Hosts (2^n) 1 2 4 8 16 32 64 128

Find which host number can accommodate the


required number of hosts. As per the table it is
64, so the required number of host bits
H=6
Step-2: Now find the number of Host bits borrowed by the network id
from host id or converted number of network bits
N = Default Host bits – H
= 8–6=2
Step3: Now find the total number of network bits in network id of the
required subnet
TN = Default Network Bits + N
= 24 + 2 =26 (i.e. /26)
Step-4: Now find the subnet mask of the required subnets
11111111.11111111.11111111.11000000
255 . 255 . 255 . 192
So the calculated subnet mask is 255.255.255.192 /26

Step-5: Total number of subnets = 2N = 22 = 4

Step-6: Total number of


Host/Subnet = 2H = 26 = 64
Step-7: Find the range of Subnets
Subnet Block Network Id Start IP End IP Broadcast Id
I 192.168.10.0 192.168.10.1 192.168.10.62 192.168.10.63
II 192.168.10.64 192.168.10.65 192.168.10.126 192.168.10.127
III 192.168.10.128 192.168.10.129 192.168.10.190 192.168.10.191
IV 192.168.10.192 192.168.10.193 192.168.10.254 192.168.10.255

Note:
1. Network id of the 1st subnet block is 192.168.10.0
2. To calculate the network id of the next block, we need to
calculate the difference between default subnet mask and
calculated subnet mask.
Default SM: 255.255.255.0
Calculated SM: 255.255.255.192
3. Check for the variation in values starting from last
octate.There is a variation in last octate.
4. Find the difference 256-192 = 64
5. Add the result in the octate where variation was found.

You might also like