05 Network Layer Part 02
05 Network Layer Part 02
Faculty of Computing
Year 01 Semester 01 11
Lesson outline
• IPv6 – IP protocol version 6: datagram format
• IPv6 addresses
• IPv6 auto configuration features
• IPv6 subnetting and address allocation
2
Key terms and concepts
• IPv6 (Internet Protocol version 6)
• IPv6 Datagram Format
• Multicast
• Global Unicast Addresses(GUA)
• Link Local Addresses (LLA)
3
NAT: network address translation
▪ all devices in local network have 32-bit addresses in a “private”
IP address space (10/8, 172.16/12, 192.168/16 prefixes) that
can only be used in local network
▪ advantages:
▪ just one IP address needed from provider ISP for all devices
▪ can change addresses of host in local network without
notifying outside world
▪ can change ISP without changing addresses of devices in
local network
▪ security: devices inside local net not directly addressable,
visible by outside world
4
NAT: network address translation
implementation: NAT router must (transparently):
▪ outgoing datagrams: replace source IP address of every outgoing
datagram to NAT IP address
• remote clients/servers will respond using NAT IP address as
destination address
▪ remember (in NAT translation table) every source IP address to NAT IP
address translation pair
▪ incoming datagrams: replace NAT IP address in destination fields of
every incoming datagram with corresponding source IP address stored
in NAT table
5
NAT: network address translation
2: NAT router changes
datagram source address from NAT translation table
1: host 10.0.0.1 sends
10.0.0.1 to 138.76.29.7 and Outside addr Inside addr datagram to
updates translation table. 138.76.29.7 10.0.0.1 128.119.40.186
(Router has been told that it …… ……
can use 138.76.29.7)
S: 10.0.0.1
Actually, to share one D: 128.119.40.186
public IP address 10.0.0.1
among many hosts, 1
S: 138.76.29.7
NAT changes the Layer 2 D: 128.119.40.186 10.0.0.4
10.0.0.2
4 port number in
addition to the Layer 3 138.76.29.7 S: 128.119.40.186
4
IP address. We will talk S: 128.119.40.186
D: 10.0.0.1
10.0.0.3
about this later, after D: 138.76.29.7 3
we have talked about 3: reply arrives at the NAT 4: NAT router looks up the table and
Layer 4 protocols TCP router with destination address changes datagram destination
and UDP 138.76.29.7 address from 138.76.29.7 to 10.0.0.1
6
NAT: Exercise
• Connect to the SLIIT-STD WiFi network from your notebook or
mobile
• Find the IP address of your device
• On iPhone devices, go to Settings -> Wi-Fi and then tap on i icon next to
SLIIT-STD
• On Android devices, go to Settings -> Wi-Fi and Network Connections and
then tap on the SLIIT-STD network name
• On notebooks go to Control Panel / System settings and see properties of
the wireless network interface
• Now open a browser on your device, and go to
whatismyipaddress.com
• This web page will show you the public IP address your NAT router is using
for your device.
• Fill the form <to lecturer: provide a form URL on courseweb>
7
IPv6: motivation
• initial motivation: 32-bit IPv4 address space would be
completely allocated
• additional motivation:
• speed processing/forwarding: 40-byte fixed length header
• enable different network-layer treatment of “flows”
• The initial IPv6 specification was published in 1998
• IPv6 is not new – 26 years old in 2024 (IPv4 is 43 years old)
• Key differences between IPv4 and IPv6
• Much larger address space (128 bits compared to 32)
• No broadcast address – support only multicast
• Host autoconfiguration features
• Simpler IPv6 header (next slide)
8
IPv6 datagram format
flow label: identify
priority: identify
32 bits datagrams in same
priority among ver pri flow label "flow.” (concept of
datagrams in flow
payload len next hdr hop limit “flow” not well
source address defined).
128-bit (128 bits)
IPv6 addresses destination address
(128 bits)
payload (data)
10
IPv6 extension headers (ctd)
• Three IPv6 datagrams with
a) Only the base header
b) Base header and one extension header
c) Base header and two extension headers
11
IPv6 Addresses
• An IPv6 address is 128 bits (16 bytes) long
• Written as 8 fields (16 bits each) separated using colons
• The colon hexadecimal notation is used to express an IPv6 address
2001:0DB8:1001:2002:3008:4800:200C:417A or
2001:0db8:1001:2002:3008:4800:200c:417a (use of lowercase
recommended in RFC5952)
• Leading zero suppression
• Leading zeros in any of the 8 fields can be omitted
• 2001:0db8:0000:0000:0008:0800:200c:417a can be written as
2001:db8:0:0:8:800:200c:417a
• Only leading zeros can be suppressed. Trailing zeros cannot be.
• So, 0800 can only be written as 800, but not as 8
12
IPv6 Addresses: Zero compression
• A string of repeated zeroes can be replaced by a pair of colons
• ff05:0:0:0:0:0:0:b3 can be written as
ff05::b3
• 2001:db8:0:0:8:800:200c:417a can be written as
2001:db8::8:800:200c:417a
• Zero compression can be applied only once in an address
• 2001:db8:0:0:1:0:0:2 can be written as
13
IPv6 Addresses: Zero compression (ctd)
• “::” should NOT be used to represent a single 0 field
• 2001:db8:0:1:8:800:200c:417a
2001:db8::1:8:800:200c:417a ✕
• If there are two sets of 0 fields in an address, the longest set must
be represented with “::”
• 2001:db8:0:0:1:0:0:0
2001:db8:0:0:1::
• If there are two sets of 0 fields of equal length, the first set must
be represented with “::”
• 2001:db8:0:0:1:0:0:2
2001:db8::1:0:0:2
14
IPv6 Address format
• Just like an IPv4 address, an IPv6 address has a subnet part and a
host part
• Subnet part is called the IPv6 Prefix
• The length of the IPv6 Prefix is the Prefix Length
• The host part is called the Host ID or Interface ID
• The length of the host part is (128 – Prefix Length)
15
CIDR notation for IPv6 Addresses
• The CIDR notation or slash notation is used to indicate IPv6 address
ranges as well as individual IPv6 addresses
• The general format is an IPv6 Prefix or an IPv6 address followed by Prefix Length
• If the host part is non-zero or the prefix length is 128, it indicates an address
• Otherwise, and address space or a subnet address
• Examples of address spaces/subnets
• 2000::/3 is the Global Unicast Address space
• 2001:db8::/64 is a subnet in the Global Unicast Address space
• fe80::/10 is the Link Local Address space
• Examples of addresses
• 2001:db8::8:800:200c:417a/64
Subnet is 2001:db8::/64 and the host ID is 8:800:200c:417a
• ::/128 is the unspecified address
• ::1/128 is the loopback address
16
IPv6 Address types
• There are three address types in IPv6
• Unicast addresses
• Destination address specifies a single computer
• The packet must be routed to the destination via a shortest path
• Anycast addresses
• Destination address specifies a set of computers, possibly at different
locations. All share a single address
• Packet must be routed to any one in the set along a shortest path
• Multicast addresses
• Destination address specifies a set of computers, possibly at multiple
locations
• One copy of the packet should be sent to each member of the group using
hardware multicast or broadcast, if applicable
17
IPv6 Address types
IPv6 Addresses
18
Broadcast and Multicast
• IPv4 provides a broadcast mechanism
• all 1’s to broadcast to all hosts on the local network (limited broadcast)
• network number followed by all 1’s to broadcast on a particular network
(directed broadcast)
• But in IPv6 there is no broadcast address for a network
• The link-local multicast address ff02::1 (all nodes multicast address)
• Targets all nodes on the local link (i.e., all hosts on the local network)
• A packet destined to ff02::1 is received by all IPv6-enabled hosts on local network
• Serves the purpose of an IPv4-like broadcast within the local network
• But the effect of broadcast is achieved through multicast, and is limited to local network
• So, limited broadcast is possible with IPv6 multicast address ff02::1
• Directed broadcast is not possible with IPv6
19
Unspecified and Loopback addresses
• The address of all 0s - 0:0:0:0:0:0:0:0/128 (or ::/128) is the
unspecified address which hosts may use as the source address
when they are booting
• The unspecified address may not be used in the destination address field
• This is like 0.0.0.0/32 for IPv4
• The loopback address is 0:0:0:0:0:0:0:1/128 (or ::1/128)
• A packet destined to the loopback address must not leave the local
machine
• This is like 127.0.0.1/32 for IPv4
Loopback
Host Interface
20
Embedded IPv4 Addresses
• An IPv4 address can be embedded in an IPv6 address
• Previously, 80 zeros followed by 0000 or ffff and the 32-bit IPv4 address
• But using 0000 is now deprecated (by RFC4291)
• Example
• Consider IPv4 address 223.1.1.1
• It can be represented as ::ffff:223.1.1.1 (this is mixed notation)
• In pure IPv6 notation it is ::ffff:df01:101
21
Using embedded IPv4 Addresses
• A translator can be used for communication between IPv4 and
IPv6 hosts
• The translator uses pure IPv4 to communicate with the IPv4 host, and
pure IPv6 to communicate with the IPv6 host
• The IPv6 host A can send an IPv6 packet with the embedded IPv4 address
of host B to the translator
• The translator will translate this to an IPv4 packet with B’s IPv4 address
• Similar translation needed for packets going from IPv4 side to IPv6 side
IPv4 datagram IPv6 datagram
B Dest = Translator Dest = A
a.b.c.d ::ffff:a.b.c.d
IP address =
a.b.c.d
IPv4 side IPv6 side
22
Global Unicast Addresses
• IPv6 global unicast addresses (GUAs) are globally unique and
routable on the IPv6 internet
• Currently, only GUAs starting with 001 (2000::/3) are being assigned
• Begins with a hexadecimal 2 or a 3
• The format of a GUA Address is as shown below
• IPv6 Prefix part is broken into two fields: Global Routing Prefix + Subnet ID
• Global Routing Prefix: the prefix, defines the address range provided by an
address provider (e.g. ISP) to a customer or site
• Subnet ID: Used by an organization to identify subnets within the site
n m 128 - n - m
24
Link Local Addresses (LLA)
• An IPv6 link-local address (LLA) enables
a device to communicate with other
IPv6-enabled devices on the same link
(subnet) and only on that link (subnet) fe80::2/64 fe80::3/64
26
Modified EUI-64 mechanism
• IEEE EUI-64 process defines a standard format for globally unique 64-
bit Interface IDs
• Uses the MAC (L2) address of the interface to generate the Interface ID
• Ethernet MAC addresses are 48 bits long, and are made up of two
parts:
• Organizationally unique identifier (OUI): A 24-bit vendor code assigned by IEEE
• Device identifier: A unique 24-bit value within a common OUI
• To form an Interface ID
• Insert fffe (16 bits) between OUI and Device Identifier of the MAC address
• Invert the 7th bit (the universal/local [U/L] bit)
• For example, if the MAC address is fc:99:47:75:ce:e0
• Inserting fffe gives fc99:47ff:fe75:cee0
• Inverting 7th bit gives fe99:47ff:fe75:cee0
27
Modified EUI-64 mechanism (ctd)
28
Pseudo-Random Interface ID
• As a solution to privacy issues associated with EUI-64, hosts can use a
randomly generated Interface ID
• But for devices like servers which accept incoming connections, the
Interface ID must not change
• A common practice is to use a stable address and temporary addresses
• Stable address: Use EUI-64 generated
Interface ID for accepting incoming connections
• Temporary address: Use a pseudo-random
generated Interface ID for outgoing connections
• Most operating systems now provide options
to use a fixed MAC address or a random
MAC address
• Using EUI-64 with a randomly generated MAC
address will give different Interface IDs
29
Lesson summary
• The lecture covered the basics of IPv6, highlighting its significance in
addressing the limitations of IPv4, such as the exhaustion of available IP
addresses.
• It explained the different types of IPv6 addresses, including global unicast
and link-local addresses, and how they are formatted and used within a
network.
• The session discussed the structure of IPv6 datagrams, emphasizing the
efficiency improvements over IPv4, such as simplified headers and the
elimination of certain fields to speed up processing.
• The lecture introduced IPv6 auto-configuration capabilities, like SLAAC, and
addressed various methods of compressing and simplifying IPv6 addresses
for practical network deployment.
30
References
• Chapter 4 - IPv6 Address Format and Address Types
Graziani, R., IPv6 Fundamentals: A Straightforward Approach to
Understanding IPv6 (2nd Edition), Cisco Press, 2017
31
32
Additional Reading
32
IPv4 and IPv6 Coexistence
33
Dual-stack
34
Tunneling
• A method of transporting an
IPv6 packet over an IPv4
network.
• The IPv6 packet is encapsulated
inside an IPv4 packet.
35
Translation
• The Network Address Translation 64 (NAT64) allows IPv6-enabled devices to communicate with IPv4-
enabled devices using a translation technique
• An IPv6 packet is translated to an IPv4 packet, and vice versa.
36