Chapter six
Internet Protocol
and IP Addressing
Protocol function
2
Small set of functions that form basis of all protocols
Not all protocols have all functions
Reduce duplication of effort
Encapsulation
Fragmentation and reassembly
Connection control
Ordered delivery
Flow control
Error control
Addressing
Multiplexing
Transmission services
Why use IP?
3
An IP address is a logical address of a
computer which is expressed as a four 8-bit
group of bits (a total of 32 bits) separated by
periods.
Each 8-bit group of bits can be represented
by a 4-digit decimal that spans between 0 and
255.
A host needs an IP address to participate on
the Internet
Each host will be identified by the same
network to communicate
Basics of IPv4
4
It’s IP’s responsibility to deliver datagrams among the TCP/IP
networked computers.
To make such deliveries possible, each computer has a unique IP
address.
The IP address contains sufficient information to uniquely
identify a network and a specific computer on the network.
IP address is an address used in order to uniquely identify a
device on an IP network.
The address is made up of 32 binary bits, which can be divisible
into a network portion and host portion with the help of a subnet
mask.
The 32 binary bits are broken into four octets (1 octet = 8 bits).
Each octet is converted to decimal and separated by a period
(dot).
E.g [Link]( each octet ranges from 0 to 255 decimal, or 00000000 - 11111111
binary)
Network Classes
5
A computer’s IP address must uniquely identify not
only the computer but also the network the computer
is attached to
the IP address is split between a network identifier
(net id) part and a host identifier (host id) part.
The class of the address determines how many bits of
the IP address are reserved for network identification
and how many are reserved for host identification.
five classes of IP address .
Classes A, B, and C are classfull classes and used for
general-purpose; classes D and E are reserved for
special purposes.
IPv4 Address Formats
6
…
7
2n address , n= number of bits: Ip V4= 232
=4,294,967,296.
CLASSES Network No. of Hosts per Default subnet
possible Network mask
ranges
networks
A 1 –126 126 16,777,214 [Link]
B 128-191 16,382 65,534 [Link]
C 192-223 2,097,150 254 [Link]
D 224-239
E 240-255
Netid and hostid
Given the network address, we can find the class of the address,
the block, and the range of the addresses in the block
Subnet mask determines this. (all 1s represents net Id, all 0s
represents hostId)
Class A Networks (/8 Prefixes)
9
Each Class A network address has an 8-bit network-
prefix with the highest order bit set to 0 and a seven-bit
network number, followed by a 24-bit host-number.
Referred to as "/8s"
A maximum of 126 (27-2) /8 networks can be defined
Each /8 supports a maximum of 16,777,214 (224-2)
hosts per network.
Since the /8 address block contains 231 (2,147,483,648)
individual addresses, the /8 address space is 50% of the
total IPv4 unicast address space.
([Link] to [Link]) for general use
All 0 reserved
01111111 (127) reserved for loopback
Class B Networks (/16 Prefixes)
10
Each Class B network address has a 16-bit
network-prefix with the two highest order bits set
to 10 and a 14-bit network number, followed by a
16-bit host-number.
Class B networks are now referred to as"/16s"
since they have a 16-bit network-prefix.
A maximum of 16,384 (214) /16 networks can be
defined with up to 65,534 (216-2) hosts per network.
Since the entire /16 address block contains 230
(1,073,741,824) addresses, it represents 25% of the
total IPv4 unicast address space.
Range 128.x.x.x to 191.x.x.x
Class B addresses are for intermediate networks;
Class C Networks (/24 Prefixes)
11
Each Class C network address has a 24-bit network-
prefix with the three highest order bits set to 110 and a
21-bit network number, followed by an 8-bit host-
number.
Class C networks are now referred to as "/24s" since
they have a 24-bit network-prefix.
A maximum of 2,097,152 (221) /24 networks can be
defined with up to 254 (28-2) hosts per network.
Since the entire /24 address block contains 229
(536,870,912) addresses, it represents 12.5% (or 1/8th)
of the total IPv4 unicast address space.
Range 192.x.x.x to 223.x.x.x
allows up to 254 hosts per network.
SPECIAL IP ADDRESSES
12
IP addresses also called Description
[Link] /0 Default route
[Link]/32 This host
Used for local communications within a private network
[Link]- Private IP address
[Link]
Used for loopback addresses to the local host
[Link]- Loopback address
[Link]
Assigned automatically if the host does not get an IP
[Link]- APIPA (Automatic Private
from a DHCP server provided that the device is set to
IP Addressing)
[Link] obtain an IP address automatically
Used for local communications within a private network
[Link]- Private IP Address
[Link]
Used for local communications within a private network
[Link]- Private IP Address
[Link]
Reserved for multicast assignments
224-239 Class D
Reserved for future use
240-255 Class E
Network Addresses and Broadcast Addresses in a subnet
Dotted-Decimal Notation
13
To make Internet addresses easier for human users
to read and write, IP addresses are often expressed
as four decimal numbers, each separated by a dot.
divides the 32-bit Internet address into four 8-bit
(byte)
Types of IP address
14
Public and Private IP Addresses
All hosts that connect directly to the Internet require a
unique public IP address.
RFC 1918 is a standard that reserves several ranges of
addresses within each of the classes A, B and C.
these private address ranges consist of a single Class A
network, 16 Class B networks and 256 Class C networks
A very large network can use the Class A private network
which allows for over 16 million private addresses
On medium size networks, a Class B private network could be
used, which provides over 65,000 addresses per network.
Home and small business networks typically use a single class
C private address, which allows up to 254 hosts per network
15
Class Network Address Number of Number of
Networks Addresses
A [Link]-[Link] 1 16,777,216
B [Link] – [Link] 16 1,048,576
C [Link] – [Link] 256 65,536
Private addresses can be used internally by hosts in
an organization as long as the hosts do not connect
directly to the Internet. Therefore, the same set of
private addresses can be used by multiple
organizations.
16
Given the network address [Link], find
the class and the range of the addresses
IP Address Assignment
17
IP addresses can be assigned for devices either
statically or dynamically.
Static IP Address Assignment
The network administrator must manually
configure the network information for a host.
At a minimum, this includes the host IP address,
subnet mask and default gateway.
When using static IP addressing, it is important to
maintain an accurate list of which IP addresses are
assigned to which devices.
What is its advantage and disadvantages?
18
Dynamic IP Address Assignment
19
On local networks it is often
the case that the user
population changes frequently.
This is done using a protocol
known as Dynamic Host
Configuration Protocol
(DHCP).
DHCP provides a mechanism
for the automatic assignment
of addressing information such
as IP address, subnet mask,
default gateway, and other
configuration information
Advantage/disadvantage?
Subnetting
20
Subnetting is another method of managing IP
addresses
method of dividing full network address classes
into smaller pieces
It is not always necessary to subnet a small
network. However, for large or extremely large
networks, subnetting is required
The subnet field and the host field are created from
the original host portion for the entire network.
To create a subnet address, a network
administrator borrows bits from the host field and
designates them as the subnet field.
Subnetting/masking
21
The minimum number of bits that can be borrowed is
two.
The maximum number of bits borrowed can be any
number that leaves at least two bits remaining, for
the host number.
In any network (or subnet) one can use most of the
IP addresses for host addresses.
Considerations
1) How many total subnets does the organization
need today and in the future?
2) How many hosts are there on the organization's
largest subnet today and in the future?
22
ork
w
23
net
d
n de efix
te pr
Ex
During subnetting
24
Applying a mask which is larger than the default subnet
mask, will divide your network into subnets.
This is possible by borrowing bits from the host portion to
network.
Three hierarchy (Network, Subnet and Host) addresses will
be created.
Subneting is done by borrowing bits from the host part and
add them the network part
Example
Network address [Link] with /16 network
mask can be subnetted
Network Network as Host
default network
Host mask:
[Link] or /16
11111111 11111111 00000000 00000000
Example
25
Subnet mask [Link] will create 4 subnet
26
subnetted using a new subnet mask [Link]
or Network
/24 Network Subnet Host
11111111 11111111 11111111 00000000
N.B
No of possible Networks: 2N (N is the number of
bits for the network/subnet portion)
No of hosts per networks: 2H -2 (H is the number of
bits for the host portion) why we subtract 2?
Mask And IP address = Block Address
27
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 [Link]
Class B default mask is [Link]
Class C Default mask [Link]
Sunbetting process
28
A. Based on the network requirement
Determine the number of networks required and convert it into binary.
Reserve bits in the mask and find the increment
Find the network ranges based on the increment
B. based on the host requirement
Determine the number of host required per networks and convert it
into binary.
Reserve bits in the mask and find the increment
Find the network ranges based on the increment
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.
29
Given an IP address we can find
Subnet mask
Class
First valid address
Last valid address
Broadcasting address
Usable host addresses
Straight Method
30
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 [Link] and the subnet mask is [Link]?
11001000 00101101 00100010 00111000
11111111 11111111 11110000 00000000
11001000 00101101 00100000 00000000
The subnetwork address is [Link].
Short-Cut Method
31
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 [Link] and the mask is [Link]?
[Link] 84= 01010100
[Link] 192=11000000
19.30.64.---- subneted 64=01000000
Examples 1
32
An organization has been assigned the network
number [Link]/24 and it needs to define six
subnets. The largest subnet is required to support 25
hosts.
number of bits required =six bit
21=2, 22=4,23=8 two unused subnets that can be
reserved for future growth.
8 = 23, three bits are required to enumerate the eight subnets in
the block.
the organization is subnetting a /24 so it will need three more bits,
or a /27, as the extended-network-prefix expressed in dotted-decimal
notation as [Link]
each subnetwork with a 27-bit prefix represents a contiguous block
of 25 (32) individual IP addresses. since the all-0s and all-1s host
addresses cannot be allocated, there are 30 (25 -2) assignable host
addresses on each subnet.
33
No of Subnet Numbers
34
Base Net: 11000001.00000001.00000001 .00000000 = [Link]/24
Subnet #0: 11000001.00000001.00000001. 000 00000 = [Link]/27
Subnet #1: 11000001.00000001.00000001. 001 00000 = [Link]/27
Subnet #2: 11000001.00000001.00000001. 010 00000 = [Link]/27
Subnet #3: 11000001.00000001.00000001. 011 00000 = [Link]/27
Subnet #4: 11000001.00000001.00000001. 100 00000 =
[Link]/27
Subnet #5: 11000001.00000001.00000001. 101 00000 =
[Link]/27
Subnet #6: 11000001.00000001.00000001. 110 00000 =
[Link]/27
Subnet #7: 11000001.00000001.00000001. 111 00000 =
valid host addresses for Subnet #2
35
Subnet#2:11000001.00000001.00000001.010 00000 = [Link]/27
Host #1: 11000001.00000001.00000001.010 00001 = [Link]/27
Host #2: 11000001.00000001.00000001.010 00010 = [Link]/27
Host #3: 11000001.00000001.00000001.010 00011 = [Link]/27
Host #4: 11000001.00000001.00000001.010 00100 = [Link]/27
Host #5: 11000001.00000001.00000001.010 00101 = [Link]/27
.
.
.
Host #27: 11000001.00000001.00000001.010 11011 = [Link]/27
Host #28: 11000001.00000001.00000001.010 11100 = [Link]/27
Host #29: 11000001.00000001.00000001.010 11101 = [Link]/27
Host #30: 11000001.00000001.00000001.010 11110 = [Link]/27
Broadcast Address : 11000001.00000001.00000001.010 11111 = [Link]
Broadcast Address=n-1( n is 1st valid address for next subnet)
the broadcast address for Subnet #n is one less than the base address for Subnet # (n+1)
Example 2
36
An organization has been assigned the network
number [Link]/16 and it needs to create a set of
subnets that supports up to 60 hosts on each subnet.
number of bits required to define 60 hosts on each
subnet=
62 =(26-2) host addresses (2 reserved)or 126=(27-2) host addresses
(66 reserved)
A block of 126 host addresses requires 7-bits in the host-number
field.
Since 7-bits of the 32-bit IP address are required for the host-
number field, the extended-prefix must be a /25 ( 32-7).
[Link]
37
Each of the Subnet Numbers
38
Base Net: 10001100.00011001 .00000000.00000000 = [Link]/16
Subnet #0: 10001100.00011001. 00000000 . 0 0000000 = [Link]/25
Subnet #1: 10001100.00011001. 00000000 . 1 0000000 = [Link]/25
Subnet #2: 10001100.00011001. 00000001 . 0 0000000 = [Link]/25
Subnet #3: 10001100.00011001. 00000001 . 1 0000000 = [Link]/25
Subnet #4: 10001100.00011001. 00000010 . 0 0000000 = [Link]/25
Subnet #5: 10001100.00011001. 00000010 . 1 0000000 = [Link]/25
Subnet #6: 10001100.00011001. 00000011 . 0 0000000 = [Link]/25
.
.
.
Subnet #510: 10001100.00011001. 11111111 . 0 0000000 =
[Link]/25
Subnet #511: 10001100.00011001. 11111111 . 1 0000000 =
[Link]/25
Hosts Addresses for Each Subnet
39
Subnet #3: 10001100.00011001.00000001.1 0000000 =
[Link]/25
Host #1: 10001100.00011001.00000001.1 0000001 =
[Link]/25
Host #2: 10001100.00011001.00000001.1 0000010 =
[Link]/25
Host #3: 10001100.00011001.00000001.1 0000011 =
[Link]/25
Host #4: 10001100.00011001.00000001.1 0000100 =
[Link]/25
Host #5: 10001100.00011001.00000001.1 0000101 =
[Link]/25
Host #6: 10001100.00011001.00000001.1 0000110 =
[Link]/25
VLSM (Variable Length Subnet Masks)
40
VLSMs allow you to use different masks for each
subnet
Use VLSM to:
Create a larger subnet of more than 255 host addresses
Create very small subnets for WAN links
Example: Given the [Link]/16 network and
requirements below, develop a subnetting scheme
with the use of VLSM:
LAN1 must support 330 hosts
WAN must support 2 hosts for a T1 circuit to a remote site
LAN3 must support 6 hosts
…
41
The first step is to determine what mask allows the required
number of hosts.
LAN1 requires a /23 ([Link]) mask to support 510
hosts
WAN requires a /30 ([Link]) mask to support 2 hosts
LAN3 requires a /29 ([Link]) mask to support 6
hosts
The easiest way to assign the subnets is to assign the largest
first.
For example: You can assign the subnets in this manner:
LAN1 —[Link]/23 address range 0.0 to 1.255
LAN3 —[Link]/29 address range 0 to 7
WAN —[Link]/30 address range 8 to 11
Some protocols used with IP
42
Address Resolution Protocol
In order for devices to communicate, the sending
devices need both, the IP addresses and the MAC
addresses, of the destination devices.
When they try to communicate with devices whose
IP addresses they know, they must determine the
MAC addresses.
The TCP/IP suite has a protocol, called ARP that can
automatically obtain the MAC address.
ARP enables a computer to find the MAC address of
the computer that is associated with an IP address
E.g. [Link] 2A:w[Link]G:d1:F3
…
43
Dynamic Host Configuration protocol (DHCP)
DHCP is a mechanism to assign unique IP addresses to DHCP
clients automatically. Under DHCP, a computer is designated as
the DHCP server.
When a new node comes onto the network assuming it is
capable of being a DHCP client, it will broadcast a request for
an IP address.
the DHCP server will respond by checking its table of address
assignments, selecting the next available address, and sending
a response back to the requesting node.
The actual process is more complex , as the requesting client
must first find a DHCP server. Also, the protocol is constructed
so that a client may negotiate with more than one DHCP server.
Read more
Overview of IPv6 address
44
Motivation: why we use IPv6?
To overcome problem of IPv4
Internet has grown exponentially and the address
space allowed by IPv4 is saturating.
IPv4 on its own does not provide any security
features.
Data prioritization in IPv4 is not up-to-date.
IPv4 enabled clients can be configured manually or
they need some address configuration mechanism.
It does not have a mechanism to configure a device to
have globally unique IP address.
Characteristics of IPv6
45
IP retains many of the design features of the existing IPv4.
The new features of IP v6 can be grouped into 5 main
categories:
Address size: 128-bit addresses instead of 32 bits.
Header format: almost every field in the header has been
changed.
Extension Headers: IPv6 encodes info into separate
headers
QoS offerings: includes a mechanism which allows for
differentiated quality of service for applications.
• Extensible protocol: IPv6 does not specify all possible
protocol features
IPv6 Address Structure
46
address is made of 128 bits divided into eight 16-
bits blocks.
([Link])
Each block is then converted into 4-digit
Hexadecimal numbers
0010000000000001 separated by colon symbols.
0000000000000000
0011001000111000 1101111111100001
0000000001100011 0000000000000000
0000000000000000 1111111011111011
Each block is then converted into Hexadecimal and
separated by ‘:’ symbol:
[Link]
…
47
IPv6 provides some rules to shorten the address
Rule 1: Discard leading Zero(es):
[Link]
[Link]
Rule 2: If two or more blocks contain consecutive
zeroes, omit all of them and replace with double
colon sign ::
[Link]
[Link]
if there are still blocks of zeroes in the address, they
can be shrunk down to a single zero
[Link]
IPv6 features
48
IPv6 Address types
49
In IPv6, a destination address can belong to one of
three categories:
Unicast
Anycast
multicast
Unicast Address
A unicast address defines a single interface
(computer or router).
The packet sent to a unicast address will be routed to
the intended recipient
50
anycast
An anycast address defines a group of computers that
all share a single address.
A packet with an anycast address is delivered to only
one member of the group, the most reachable one.
An anycast communication is used, for example, when
there are several servers that can respond to an inquiry.
the addresses are assigned from the unicast block.
Multicast Address
A multicast address also defines a group of computers.
In multicasting each member of the group receives a
copy.
51
Reserved Address Description
FF02::1 A multicast address to all nodes on a link (link-local scope)
FF02::2 A multicast address to all routers on a link
FF02::5 OSPFv3 All SPF routers
FF02::6 OSPFv3 All DR routers
FF02::9 A multicast address to all routing information protocol (RIP) routers on a link
FF02::A EIGRP routers
FF02::1:FFxx:xxxx All solicited-node multicast addresses used for host auto-configuration and
neighbor discovery (similar to ARP in IPv4)
FF05::101 A multicast address to all Network Time Protocol (NTP) servers