Chapter-6-Fundamentals of IPv4 Addressing
Chapter-6-Fundamentals of IPv4 Addressing
Undergraduate Program
School of Electrical and Computer Engineering
Outlines
• Internet Protocol
• Datagram, Fragmentation
• IPV4 datagram
• IPV6 datagram
• IP addressing
• IPV4 addressing And IPV6 addressing
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 2
Addressing
Internet as a connectionless network
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 3
Addressing
Internet service model
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 4
Addressing
Network Layer
• Responsible for host-to-host delivery
• Source
• Creates a packet from the data coming from upper layer
• Header of the packet contains the logical addresses of the source
and destination plus other information
• Intermediate nodes (routers or switches)
• Forwarding and routing
• Destination
• Address verification
• If the packet is fragmented –reassembles
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 5
Addressing
Network layer Functions
• Encapsulation
• On sending side encapsulates segments into datagrams
• On receiving side, delivers segments to transport layer
• Forwarding (Data plane)
• Local, Per-router function
• Determining how a datagram arriving at input port of router is
forwarded to router’s output port
• Routing (Control plane)
• Network-wide logic
• Determine the route taken by packets from source to destination
(path selection)
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 6
Addressing
The internet Protocol in Network Layer
• Includes a set of rules that embody the idea of unreliable packet
delivery
• defines the basic unit of data transfer and performs the routing function
• is the delivery mechanism used by the TCP/IP protocols
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 7
Addressing
IPV4 Datagram format
20 – 65,536 byte
20 – 60 bytes
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 8
Addressing
Cont.… (IPV4 Datagram format )
• Source IP address (32 bits): Network (logical address) of the source
station
• Protocol (8 bits): Defines the higher layer protocol that uses the
services of the IPv4 layer Value Protocol
1 ICMP
2 IGMP
6 TCP
17 UDP
46 RSVP
47 GRE
89 OSPF
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 9
Addressing
Cont.… (IPV4 Datagram format )
• Service type (8 bits):
• The name is changed from service type to differentiated services
(DiffServ)
• Service type
• Precedence –defines the priority of the datagram in issues such as
congestion (If a router is congested – discards datagram with lowest
precedence )
• Type of service(ToS)
• Activities requiring immediate attention –minimum delay
• Activities that send bulk data –maximum throughput
• Management activities –maximum reliability
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 10
Addressing
Cont.… (Service)
• Differentiated services
• 6 bits –code point (the last 2 bits are not used)
• When the 3 rightmost bits are 0s –the 3 left most bits are
interpreted the same as the precedence bits
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 11
Addressing
Cont.… (IPV4 Datagram format )
• Identification (16 bits), flags (3 bits), fragmentation offset (13 bits): use
in fragmentation
• Encapsulation/Decapsulation : Datagrams must move from machine to
machine via physical networks
20 – 65,536 byte
Datagram Header Datagram Data
46 – 1500 byte
• What if a datagram won’t fit in a frame? Fragmentation
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 12
Addressing
Cont.… (Maximum transfer unit)
• Each physical networking technology limits the amount of data that can
fit in a frame
• Ethernet: 1500 Bytes
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 13
Addressing
Cont.… (Fragmentation)
• Fragmentation–a process of dividing a datagram into a number of
smaller datagrams
• The maximum length of IPv4 datagram = 65,535 bytes
• When a datagram is encapsulated in a frame, the total size of the
datagram must be less than the maximum size of the data field
• If we use a protocol with a MTU < the packet size –fragmentation is
required
• Fragments
• Can be fragmented by the source or any router in the path
• Reassembled at the destination host
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 14
Addressing
Cont.… (Fragmentation)
• Fields related to fragmentation
• Identification
• Identification + IPv4 address uniquely define
a datagram
• All fragments have the same identification
number
• Helps the destination in reassembling the
datagram
• Flags
• D=1 –the machine must not fragment the
datagram
• D=0 –the datagram can be fragmented if
necessary
• M=0 –the last or only fragment
• M=1 –the datagram is not the last fragment
• Fragmentation offset
• The relative position of this fragment with
respect to the whole datagram
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 15
Addressing
Outlines
• Internet Protocol
• Datagram, Fragmentation
• IPV4 datagram
• IPV6 datagram
• IP addressing
• IPV4 addressing And IPV6 addressing
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 16
Addressing
From IPV4to IPV6
• Limited address space
• Internet population
• ∼630 million users end of 2002 −10% of world pop.
• ∼1320 million users end of 2007 −20% of world pop.
• ∼3400 million users end of 2016 −50% of world pop.
• Doubles every 5 years (approximately)
• Future? (World pop. ∼9B in 2050)
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 17
Addressing
So What has really changed in IPV6?
• Expanded address space
• Address length quadrupled to 16 bytes – hexatets
• 64 bits aligned
• Header Format Simplification
• Fixed length, optional headers are daisy-chained.
• IPv6 header is twice as long (40 bytes) as IPv4 header without
options (20 bytes).
• No checksum at the IP network layer
• Authentication and Privacy Capabilities
• IPsec is mandated
• No more broadcast
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 18
Addressing
IPV6 Datagram format
Up to - 65,536 byte
40 bytes
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 19
Addressing
Cont.… (IPv6 datagram format)
• Priority
• Defines the priority of each packet with
respect to other packets
• Congestion-controlled data are
assigned priorities from 0 to 7
• Background data- e.g. delivery of the
news
• Unattended data – e.g. E-mail
• Attended bulk data – e.g. FTP and
HTTP
• Interactive traffic – e.g., TELNET
• Control traffic - e.g. routing protocols
• Non-congestion-controlled traffic
• Traffic that expects minim delay
• Priority numbers from 8 to 15 are
assigned
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 20
Addressing
Cont.… (IPv6 datagram format)
• Extension headers
• The base header can be followed by up to six extension headers
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 21
Addressing
Transition from IPv4 to IPv6
• Three strategies are devised to help the
transition
1. Dual stack
• All station must run IPv4 and IPv6
simultaneously
• To determine which version to use –the
source host queries the DNS
2. Tunneling
• Used when two computers using IPV6
want to communicate with each other
and the packet must pass through a
region that uses IPv4
• Entering the region –the IPv6 packet is
encapsulated in an IPv4 packet
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 22
Addressing
Cont.… (Transition from IPv4 to IPv6)
3. Header translation
• The header of IPv6
packet is converted to
an IPv4 header
• Uses the mapped
address
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 23
Addressing
Outlines
• Internet Protocol
• Datagram, Fragmentation
• IP addressing
• IPV4 addressing
• Classful addressing
• Subnetting
• Classless Inter-Domain Routing (CIDR)
• Classless addressing and Variable length subnet Mask (VLSM)
• Network Address Translation (NAT)
• IPV6 addressing
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 24
Addressing
IP Addressing
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 25
Addressing
IPV4 Addressing
• IPv4
32 binary bits are broken into four octets (1 octet = 8 bits)
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 26
Addressing
Cont.… IPV4 Addressing
• Address blocks
• IP address are granted in the form of block/range of addresses
• Rules
• The addresses in a block must be contiguous
• The number of address must be a power of 2
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 27
Addressing
Network and Broadcast IPV4 Address
• The first address in a block is normally not assigned to any
device - used as the network address
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 28
Addressing
Subnet Mask
• A subnet mask (netmask) is 32 bit binary number required to provide to
distinguish the number of bits designated for a network:
• If a binary bit is set to a 0 (or off) in a subnet mask, the corresponding bit
in the address identifies the host.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 29
Addressing
Wild Mask
• A Wild mask (rarely used term) is also 32 bit binary number required to
provide to distinguish the number of bits designated for a host:
• If a binary bit is set to a 1 (or off) in a wild mask, the corresponding bit in
the address identifies the host.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 30
Addressing
E.g.:
• Given a particular host with an IP address of 158.80.164.3
255.255.0.0
• Looking at the above address and subnet mask in binary:
• IP Address: 10011110.01010000.10100100.00000011
• Subnet Mask: 11111111.11111111.00000000.00000000
• The first 16 bits of the subnet mask are set to 1.
• Thus, the first 16 bits of the address (158.80) identify the network.
• The last 16 bits of the subnet mask are set to 0.
• Thus, the last 16 bits of the address (164.3) identify the unique host
on that network.
• The address block
158.80.0.0 10011110.01010000.00000000.00000000
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 31
Addressing
Cont.…
158.80.0.0 10011110.01010000.00000000.00000000
Getaway
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 32
Addressing
Classful Addressing
• It is an earlier approach (outdated) of network addressing
architecture that divided IP addresses into 5 groups.
No of
Max
Address Networ available
Class Example IP number Application
Range k bits address
of ntk
per ntk
Used for large
IP Class A 1 to 126 1.0.0.1 8 128 224
number of hosts.
216 Used for medium
IP Class B 128 to 191 128.1.1.1 16 16384
size network.
28 Used for local area
IP Class C 192 to 223 192.1.11. 24 2097157
network.
Reserve for multi-
IP Class D 224 to 239 NA NA NA
casting.
This class is
IP Class E 240 to 254 NA NA NA
reserved for R&D.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 33
Addressing
Classful IP addressing
• Two-level hierarchy addressing
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 34
Addressing
Range of Special IP Addresses:
• Range of Special IP Addresses:
• 169.254.0.0 – 169.254.0.16 : Link-local addresses
• 127.0.0.0 – 127.0.0.8 : Loop-back addresses
• 0.0.0.0 – 0.0.0.8: used to communicate within the current network.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 35
Addressing
Limitations of classful IP addressing
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 36
Addressing
Subnetting
• An organization that is granted
a large block of addresses
• Creates multiple logical networks
that exist within a single Class A,
B, or C network.
• Can create cluster of networks –
subnets
• Divide the addresses between
the different subnets
• Three-level of hierarchy in
addressing
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 37
Addressing
Benefits of Subnetting
• Simplified management
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 38
Addressing
Practice Example 1:
An organization is assigned a class C network address of
201.35.2.0. It uses a subnet mask of 255.255.255.192 to
divide this into sub-networks.
• In classful approach
• The choice of IP addresses is limited. Min. no of addresses
assigned to an organization is 256 (class C).
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 43
Addressing
E.g.:
• A host address of 172.11.3.12 with a subnet mask of
255.255.255.192 would be represented as follows:
• In binary:
• 11111111.11111111.11111111.11000000
• The first 28 bits of the above subnet mask are set to 1.
• The CIDR notation for this subnet mask would thus be /26.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 44
Addressing
Example
• Given IP Address: 204.15.5.0/24
• Benefits:
• Allows efficient use of address space
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 49
Addressing
Cont..
• The network with next max. number of user = 28 (NetE)
• Add two addresses for network and broadcast = 28 + 2 = 32 can be
represented by 5 host bits
• The mask for the first subnet is 32 − 5 = 27
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 50
Addressing
Cont..
• The network with next max. number of user = 14 (NetA)
• Add two addresses for network and broadcast = 14 + 2 = 16 can be
represented by 4 host bits
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 51
Addressing
Cont..
• The network with next max. number of user = 7 (NetD)
• Add two addresses for network and broadcast = 7 + 2 = 9 can be
represented by 4 host bits
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 52
Addressing
Cont..
• The network with next max. number of user = 2 (NetC)
• Add two addresses for network and broadcast = 2 + 2 = 4 can be
represented by 2 host bits
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 53
Addressing
E.g. Cont.… (VLSM)
• The easiest way to assign the subnets is to assign the largest first. For
example, you can assign in this manner:
• netB: 204.15.5.0/27 host
address range 1 to 30
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 55
Addressing
Cont.…
• Answer:
• In subnet 1, the address 17.12.14.0/27 can give us the subnet
address
• In subnet 2, the address 17.12.14.32/28 can give us the subnet
address
• In subnet 3, the address 17.12.14.48/28 can give us the subnet
address
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 56
Addressing
Limitations of classful IP addressing
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 57
Addressing
Address allocation
• Internet Assigned Numbers Authority (IANA), a department
with in Internet cooperation for Assigned Names and
Numbers (ICANN) - a global authority responsible for
address allocation
• Allocate addresses to ISPs
• An ISP in turn divides its assigned block into subblocks and grants
to its customers
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 58
Addressing
Network Address Translation (NAT)
• Public address
• A Unique network address can be routed on the Internet.
• Hosts that must be Internet-accessible must be configured with (or
reachable by) public addresses.
• Allocation of public addresses is governed by the IANA.
• Private address
• is intended for internal use within a home or organization, and can be
freely used by anyone.
• Private addresses can never be routed on the Internet.
• Internet routers are configured to immediately drop traffic with private
addresses.
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 59
Addressing
Cont.…(Network Address Translation (NAT))
• If hosts with private IP wants to access the internet?
• NAT: translation of on IP address into another IP address
• enables a user to have a large set of addresses internally and one
or small set of addresses externally
• Private addresses
• Can be used without permission from the ISPs
• Unique inside an organization but not globally
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 60
Addressing
Address translation
• All the outgoing and incoming packets go through the NAT
router
• Outgoing – replaces the source address with the global NAT
address
• Incoming – replaces the destination address in the packet with the
appropriate private address
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 61
Addressing
Cont.… (Address translation)
• How does a NAT router know the destination address of
the incoming packets?
• Translation table
• Using one global IP address
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 62
Addressing
Outlines
• Internet Protocol
• Datagram, Fragmentation
• IP addressing
• IPV4 addressing
• Classful addressing
• Subnetting
• Classless Inter-Domain Routing (CIDR)
• Classless addressing and Variable length subnet Mask (VLSM)
• Network Address Translation (NAT)
• IPV6 addressing (Extra)
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 64
Addressing
IPv6 Address Representation
• Length - 16 bytes/128 bits
• Hexadecimal colon notation
• The 128 bits are divided into eight sections – each 2 bytes long
• Address abbreviation
• Successive fields of 0 represented as ::, but only once in an
address:
• :: representation
• RFC5952 recommends that the rightmost set of :0: be replaced
with :: for consistency
• 2001:db8:0:2f::5 rather than 2001:db8::2f:0:0:0:5
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 68
Addressing
IPV6 addressing
• Unicast addresses
• Geographical and provider based
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 69
Addressing
Cont.… (Unicast addresses )
• Manually configured
• Anycast addresses
• Defines group of nodes
• The packet destined to anycast address is delivered to one of the
member of the multicast group – the nearest one
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 72
Addressing
Cont.…
• Reserved addresses
• Unspecified address – when the host does not know its own
address and send an inquiry to find its address
• Loopback address – used by a host to test itself
• A compatible address – used when a host using IPv6 want to send
a message to another computer using IPv6 , but the message
needs to pass through IPv4 network
• A mapped address – used when a computer that uses IPv6 want to
send a packet to a host using IPv4
Sem. II, 2023/24 Data communication and Computer networks - Ch. 6 –Network Layer 73
Addressing