You are on page 1of 60

Understanding IP Addressing

Prepared by : Rajesh Kumar


IP ADDRESSES

Structure of an IP address
Subnetting
CIDR
IP Version 6 addresses
IP ADDRESSES
WHAT IS AN IP ADDRESS?
An IP address is a unique global address for a network interface

An IP address:
- is a 32 bit long identifier
- encodes a network number (network prefix)
and a host number
DOTTED DECIMAL NOTATION
IP addresses are written in a so-called dotted decimal notation
Each byte is identified by a decimal number in the range [0..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).
In classful addressing the address space is
divided into 5 classes:

A, B, C, D, and E.
FINDING THE CLASS IN BINARY NOTATION
FINDING THE ADDRESS CLASS
Show that Class A has
231 = 2,147,483,648 addresses
Find the class of the following IP addresses
00000001 00001011 00001011 11101111
11000001 00001011 00001011 11101111

Solution

•00000001 00001011 00001011 11101111


1st is 0, hence it is Class A
•11000001 00001011 00001011 11101111
1st and 2nd bits are 1, and 3rd bit is 0 hence, Class C
FINDING THE CLASS IN DECIMAL NOTATION
Find the class of the following addresses
158.223.1.108
227.13.14.88

Solution
158.223.1.108
1st byte = 158 (128<158<191) class B
•227.13.14.88
1st byte = 227 (224<227<239) class D
NETID AND HOSTID
IP ADDRESS WITH DEFAULT SUBNET MASK

The network address is the


beginning address of each block.
It can be found by applying
the default mask to
any of the addresses in the block
(including itself).
It retains the netid of the block
and sets the hostid to zero.
Class A default mask is 255.0.0.0
Class B default mask is 255.255.0.0
Class C Default mask 255.255.255.0

Class D and E don’t have net id and


host id so no masking apply on this
address
THE SUBNET MASK

Part of an IP address identifies the network. The other part of the address
Identifies the host. A subnet mask is required to provide this distinction:
158.80.164.3
255.255.0.0
The above IP address has a subnet mask of 255.255.0.0. The subnet mask
follows two rules:
1. If a binary bit is set to a 1 (or on) in a subnet mask, the corresponding bit in the
address identifies the network.
2. if a binary bit is set to a 0 (or off) in a subnet mask, the corresponding bit in the
address identifies the host.
CIDR CLASSLESS INTERDOMAIN ROUTING
Classless Inter-Domain Routing (CIDR) is a simplified
method of representing a subnet mask. CIDR identifies
the number of binary bits set to a 1 (or on) in a subnet
mask, preceded by a slash.
For example, a subnet mask of 255.255.255.240 would
be represented as
Follows in binary:
11111111.11111111.11111111.11110000
The first 28 bits of the above subnet mask are set to 1. The
CIDR notation
for this subnet mask would thus be /28.
EXAMPLE
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
SUBNET MASK APPLY TO OTHER CLASS
It is entirely possible to use subnet masks other than the
default. For
example, a Class B subnet mask can be applied to a
Class A address:
10.1.1.1 /16
However, this does not change the class of the above
address. It remains a Class A address, which has been
subnetted using a Class B mask.

Note: Remember, the only thing that determines the


class of an IP address is the first octet of that address.
Likewise, the subnet mask is the only thing that
determines what part of an address identifies the
network, and what part identifies the host.
SUBNET ADDRESS AND BROADCAST ADDRESS
On each IP network, two host addresses are reserved for special
use:
1. • The subnet (or network) address
2. • The broadcast address
The subnet address is used to identify the network itself. A routing
table contains a list of known networks, and each network is
identified by its subnet address. Subnet addresses contain all 0 bits
in the host portion of the address.
The broadcast address identifies all hosts on a particular network. A
packet sent to the broadcast address will be received and processed
by every host on that network.
EXAMPLE SUBNET AND BROADCAST ADDRESS
192.168.1.0/24 is a subnet address. (Convert to binary
form)
IP Address: 11000000.10101000.00000001.00000000
Subnet Mask: 11111111.11111111.11111111.00000000
Note that all host bits in the address are set to 0.
Broadcast addresses contain all 1 bits in the host
portion of the address. For example, 192.168.1.255/24
is a broadcast address. Note that all host bits are set
to 1:
IP Address: 11000000.10101000.00000001.11111111
Subnet Mask: 11111111.11111111.11111111.00000000
Subnetting
SUBNETTING

Subnetting is the process of


creating new networks (or
subnets) by stealing bits from the
host portion of a subnet mask.
stealing bits from hosts creates
more networks but fewer hosts
per network
SUBNETTING

Problem: Organizations have multiple


networks which are independently
managed
 Solution 1: Allocate an address for
University Network
each network Engineering
 Difficult to manage Medical
School School
 From the outside of the
organization, each network
must be addressable ie Library
have an identifiable
address.
 Solution 2: Add another level of hierarchy
to the IP addressing structure

Subnetting
BASIC IDEA OF SUBNETTING

Split the host number portion of an IP address into a subnet number and a
(smaller) host number.
Result is a 3-layer hierarchy

network prefix host number

Then: network prefix subnet number host number

 Subnets can be freely assigned within the organization


 Internally, subnets are treated as separate networks
 Subnet structure is not visible outside the organization
FINDING THE SUBNET ADDRESS

Given an IP address, we can find the


subnet address the same way we
found the network address. We
apply the mask to the address. We
can do this in two ways: straight or
short-cut.
Straight Method
In the straight method, we use binary
notation for both the address and
the mask and then apply the AND
operation to find the subnet
address.
EXAMPLE

What is the subnetwork address if


the destination address is
200.45.34.56 and the subnet mask is
255.255.240.0?
SOLUTION

11001000 00101101 00100010 00111000


11111111 11111111 11110000 00000000
11001000 00101101 00100000 00000000

The subnetwork address is 200.45.32.0.


Short-Cut Method
** If the byte in the mask is 255, copy
the byte in the address.
** If the byte in the mask is 0, replace
the byte in the address with 0.
** If the byte in the mask is neither 255
nor 0, we write the mask and the address
in binary and apply the AND operation.
EXAMPLE
What is the subnetwork address if the destination
address is 19.30.84.5 and the mask is 255.255.192.0?
SUBNETTING EXAMPLE
The number of subnets must be
a power of 2.
: 2n
The exponent ‘n’ identifies the
number of bits to steal from the
host portion of the subnet mask
EXAMPLE

A company is granted the site address


201.70.64.0 (class C). The company needs six
subnets. Design the subnets.
The number of 1s in the default
mask is 24 (class C).
The company needs six subnets. This number 6
is not a power of 2. The next number that is a
power of 2 is 8 (23). We need 3 more 1s in the
subnet mask. The total number of 1s in the
subnet mask is 27 (24  3).
The total number of 0s is 5 (32  27). The mask
is 11111111 11111111 11111111 11100000
or 255.255.255.224
The number of subnets is 8.
The number of addresses in each subnet is 25 (5
is the number of 0s) or 32.
EXAMPLE 2

192.168.254.0
The default subnet mask for this network
is 255.255.255.0
Create 10 new network from given
Address
SOLUTION
The default Class C mask (255.255.255.0) looks as
follows in binary:
11111111.1111111.1111111.00000000
There are a total of 24 bits set to 1, which are used to
identify the network.
There are a total of 8 bits set to 0, which are used to
identify the host, and
these host bits can be stolen to create new network.
2n = 24= 16 = 16 new networks created
A total of 16 new networks do meet the original
requirement. Stealing four
host bits results in the following new subnet mask:
11111111.11111111.11111111.11110000 =
255.255.255.240
To determine the number of hosts this results in, for
each of the new 16 networks, a slightly modified
formula is required:
2h – 2
Consider the result if four bits are available for hosts:
2h – 2 = 24 – 2 = 16 – 2 = 14 usable hosts per network
ADVANTAGES OF SUBNETTING
With subnetting, IP addresses use a 3-layer hierarchy:
 Network
 Subnet
 Host
Improves efficiency of IP addresses by not consuming
an entire address space for each physical network.
Reduces router complexity. Since external routers do
not know about subnetting, the complexity of routing
tables at external routers is reduced.

Note: Length of the subnet mask need not be identical at


all subnetworks.
SUBNETTING EXAMPLE

An organization with 4 departments has the following IP address


space: 10.2.22.0/23. As the systems manager, you are required to
create subnets to accommodate the IT needs of 4 departments.
The subnets have to support to 200, 61, 55, and 41 hosts
respectively. What are the 4 subnet network numbers?

Solution:
 10.2.22.0/24 (256 addresses > 200)
 10.2.23.0/26 (64 addresses >61)
 10.2.23.64/26 (64 addresses > 55)
 10.2.23.128/26 (64 addresses > 41)
EXAMPLE SUBNET

An organization is granted the block 130.34.12.64/26.


The organization needs to have four subnets. What are
the subnet addresses and the range of addresses for
each subnet?

The suffix length is 6. This means the total number of


addresses in the block is 64 (26). If we create four
subnets, each subnet will have 16 addresses
Let us first find the subnet prefix (subnet mask). We need four
subnets, which means we need to add two more 1s to the site prefix.
The subnet prefix is then /28.
Subnet 1: 130.34.12.64/28 to 130.34.12.79/28.
Subnet 2 : 130.34.12.80/28 to 130.34.12.95/28.
Subnet 3: 130.34.12.96/28 to 130.34.12.111/28.
Subnet 4: 130.34.12.112/28 to 130.34.12.127/28.
EXAMPLE

An ISP is granted a block of addresses starting with 190.100.0.0/16.


The ISP needs to distribute these addresses to three groups of
customers as follows:
1. The first group has 64 customers; each needs 256 addresses.
2. The second group has 128 customers; each needs 128 addresses.
3. The third group has 128 customers; each needs 64 addresses.

Design the subblocks and give the slash notation for each subblock.
Find out how many addresses are still available after these
allocations.
SOLUTION
Group 1
For this group, each customer needs 256 addresses. This means
the suffix length is 8 (28  256). The prefix length is then 32  8 
24.
01: 190.100.0.0/24190.100.0.255/24
02: 190.100.1.0/24 190.100.1.255/24
…………………………………..
64: 190.100.63.0/24190.100.63.255/24
Total  64  256  16,384
Group 2
For this group, each customer needs 128 addresses. This means the
suffix length is 7 (27  128). The prefix length is then 32  7  25.
The addresses are:
001: 190.100.64.0/25 190.100.64.127/25
002: 190.100.64.128/25 190.100.64.255/25
………………..
128: 190.100.127.128/25 190.100.127.255/25
Total  128  128  16,384
Group 3
For this group, each customer needs 64 addresses. This means the
suffix length is 6 (26  64). The prefix length is then 32  6  26.
001:190.100.128.0/26 190.100.128.63/26
002:190.100.128.64/26 190.100.128.127/26
…………………………
128:190.100.159.192/26 190.100.159.255/26
Total  128  64  8,192
SOLUTION (TOTAL ADDRESS COUNTING)

Number of granted addresses: 65,536


Number of allocated addresses: 40,960
Number of available addresses: 24,576
CIDR - CLASSLESS INTERDOMAIN ROUTING
Goals:
 Restructure IP address assignments to increase efficiency
 Hierarchical routing aggregation to minimize route table entries

Key Concept: The length of the network id (prefix) in IP addresses is arbitrary/flexible and is
defined by the network hierarchy.

Consequence:
 Routers use the IP address and the length of the prefix for forwarding.
 All advertised IP addresses must include a prefix
CIDR EXAMPLE

CIDR notation of a network address:


192.0.2.0/18
 "18" says that the first 18 bits are the network part of the address
The network part is called the network prefix
Example:
 Assume that a site requires an IP network domain that can support 1000 IP host
addresses
 With CIDR, the network is assigned a continuous block of 1024 = 210 (>1000)
addresses with a 32-10 = 22-bit long prefix
CIDR AND ADDRESS ASSIGNMENTS
Backbone ISPs obtain large blocks of IP address space and then reallocate portions
of their address blocks to their customers.

Example:
Assume that an ISP owns the address block 206.0.64.0/18, which represents 16,384
(232-18=214) IP host addresses
Suppose a client requires 800 host addresses
 512=29<800<1024=210 -> 32-10 = 22,
 Assigning a /22 block, i.e. 206.0.68.0/22 -> gives a block of 1,024 (210) IP addresses to
client.
CIDR: PREFIX SIZE VS. HOST SPACE
CIDR Block Prefix # of Host Addresses
/27 32 hosts
/26 64 hosts
/25 128 hosts
/24 256 hosts
/23 512 hosts
/22 1,024 hosts
/21 2,048 hosts
/20 4,096 hosts
/19 8,192 hosts
/18 16,384 hosts
/17 32,768 hosts
/16 65,536 hosts
/15 131,072 hosts
/14 262,144 hosts
/13 524,288 hosts
SUBNETTING AND CLASSLESS INTER DOMAIN
ROUTING (CIDR)

Subnetting is done by allocating some of the leading bits of the host number to
indicate a subnet number.
With subnetting, the network prefix and the subnet number make up an extended
network prefix.
The extended prefix can be expressed in terms of a subnetmask or, using CIDR
notation, by adding the length of the extended subnetmask after the IP address.
 For example, for Argon, the first byte of the host number (the third byte of the IP
address) is used to denote the subnet number.
128.143.0.0/16 is the IP address of the network (network prefix /16),
128.143.137.0/24 is the IP address of the subnet,
128.143.137.144/24 is the IP address of the host, and
255.255.255.0 is the subnetmask of the host (or subnet prefix /24))
IPV6 - IP VERSION 6
IP Version 6
 Is the successor to the currently used IPv4
 Specification completed in 1994
 Makes improvements to IPv4 (no revolutionary changes)

One (not the only !) feature of IPv6 is a significant increase in size of the IP address
to 128 bits (16 bytes)
 IPv6 will solve – for the foreseeable future – the problems with IP addressing
IPV6 HEADER
IPV6 VS. IPV4: ADDRESS COMPARISON

IPv4 has a maximum of


232  4 billion addresses
IPv6 has a maximum of
2128 = (232)4  4 billion x 4 billion x 4 billion x 4 billion addresses
IPV6 PROVIDER-BASED ADDRESSES
The first IPv6 addresses will be allocated to a provider-based plan
Registry Provider Subscriber Subnetwork Interface
010
ID ID ID ID ID

Type: Set to “010” for provider-based addresses


Registry: identifies the agency that registered the address
The following fields have a variable length (recommeded length in “()”)
Provider: Id of Internet access provider (16 bits)
Subscriber: Id of the organization at provider (24 bits)
Subnetwork: Id of subnet within organization (32 bits)
Interface: identifies an interface at a node (48 bits)
MORE ON IPV6 ADDRESSES
The provider-based addresses have a similar flavor as CIDR addresses

IPv6 provides address formats for:


 Unicast – identifies a single interface
 Multicast – identifies a group. Datagrams sent to a multicast address are sent to all
members of the group
 Anycast – identifies a group. Datagrams sent to an anycast address are sent to one of the
members in the group.
Query Session ?

Thanks !

You might also like