IP Addressing
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
[Link]
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
• prefix/netmask (classless Interdomain routing)-CIDR
The old way: Internet Address Classes
The old way: Internet Address Classes
Example
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. [Link]
d. [Link]
Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
Example
Example: [Link]
•IP address is [Link]
– 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: [Link]/16
– Network prefix is 16 bits long
•Network mask is: [Link] or hex format: ffff0000
-----> Network id (IP address AND Netmask) is: [Link]
-----> Host number (IP address AND inverse of Netmask) is: 137.144
128.143 137.144
Problems with Classful IP Addresses
• The original classful address scheme had a number of problems
• In classful addressing, a large part of the available addresses were
wasted.
Problem 1. 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)
Alternate is: Subnetting
Subnetting
• Problem: Organizations
have multiple networks
University
UniversityNetwork
Network
which are independently
managed Engineering Medical
– Solution 1: Allocate an School School
address for each network
• Difficult to manage
• From the outside of the Library
organization, each
network must be
addressable ie 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
network prefix subnet number host number
extended network prefix
• Then:
• Subnets can be freely assigned within the organization
• Internally, subnets are treated as separate networks
• Subnet structure is not visible outside the organization
Example of a Subnetting Plan
Subnet [Link]/24
Internet
Subnet 1
Subnet [Link]/24
Subnet 3
Router R
Subnet [Link]/24
Subnet 4
Subnet 2
Subnet [Link]/24
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
Network without subnets
[Link]/16
Same Network with Subnets
Same network with different subnetmasks
[Link]
Subnet
Subnetting Example
• An organization with 4 departements has the following IP
address space: [Link]/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:
– [Link]/24 (256 addresses > 200)
– [Link]/26 (64 addresses >61)
– [Link]/26 (64 addresses > 55)
– [Link]/26 (64 addresses > 41)