Upload
others
View
9
Download
0
Embed Size (px)
Citation preview
Alvaro Vives | 26 June 2017 | Workshop on Open Source Solutions for the IoT
Basics of IPv6
Introduction to IPv6 - I
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 2
Contents• Digital Data Transmission • Packet-Switched Networks • Layered Model • IPv4 and IPv6 basics
- IPv4 Header - IPv6 Header - Differences
• IPv6 addresses - Types of IPv6 addresses - IPv6 Notation - Interface Identifier (IID) - IPv6 Addresses Exercise
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 3
Digital Data Transmission (1)
• Objective: send information from one place/device to another
• Different type of info, through different transport networks
• Need to codify the info -> digitally - Three symbols: using 1 transmitted unit of information you
could represent 3 different codes (A,B or C)(3^1) - If you transmit 2 units of information: 9 codes (3^2)
• Binary codification -> uses two characters: 0 / 1 • Bit (0 or 1) minimal unit of information • Byte = 8 bits -> used by ASCII characters => 256
(2^8)
A B C
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 4
Digital Data Transmission (2)• If you want to transmit “hi”:
- h -> - i -> - This codification is defined by ASCII - There could be other ones
• Could codify hexadecimal (16 from 0 to F) numbers using 4 bits (2^4 = 16) - 0 = -> Represented as 0x0 - 1 = -> Represented as 0x1 - 2 = -> Represented as 0x2 - . . . - A = -> Represented as 0xA
0 0 0 0 00 0 0 0
0 0 0 00 0 0 10 0 1 0
1 0 1 0
1 1 111 1 1
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 5
Packet-Switched Networks (1)
• Digital pieces of information put in packets
• Packets sent over packet-switched networks: • Paths can vary • Shared resources (best effort) • Communication can start at any moment
(example: postal mail, Internet)
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 6
Packet-Switched Networks (2)Basic elements on a switched network: • Sender: Generates the info to be sent to a receiver.
Should codify the message. • Receiver: Is the destination of the information sent
by the sender. Should decode the message. • Forwarder: Nor the origin or the destination of the
information. Just receive and forward the information in its path to the destination
• Identification: Each element in the switched network should be uniquely identified
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 7
Packet-Switched Networks (3)Senders Forwarders Receivers
F1 F2
F3 F4
F5 F6
F7 F8
S1
S2
R1
R2SRC: S2 | DST: R1
SRC: S2 | DST: R1
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 8
Layered Model (1)Let’s define things: • Layered model: physical, link, network, etc. each
one is in charge of different things/services • Network elements: Node, host, router, server • Addresses: link layer, network layer
• Protocol: definition of the format and order of messages exchanged between two or more communicating entities, as well as the actions taken on the transmission and/or reception of a message or other event
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 9
Layered Model (2)
• TCP/IP layered model -> Used in Internet
Layer 5
Layer 4
Layer 3
Layer 2
Layer 1
Layer 2
Layer 1
Layer 3
Layer 2
Layer 1
Layer 5
Layer 4
Layer 3
Layer 2
Layer 1
Application
Transport
Network
Link
Physical
Host Switch Router Host
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 10
Layered Model (3)
• PDU: Protocol Data Unit
• Layer 3 Header includes Source and destination Network Address (IP Address)
• Layer 3 is the only common layer in Internet: IP
Layer 5
Layer 4
Layer 3
Layer 2
Layer 1
Message
Segment
Datagram
Frame
I-PDU
Send
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 11
IPv4 and IPv6 basics (1)
• IPv6 is an evolution of IPv4
LEGEND
Field’s name kept from IPv4 to IPv6
Field not kept in IPv6
Name and position changed in IPv6
Version
IHL Type of Service Total Length
Identification Flags Fragment Offset
Time to Live Protocol Header Checksum
Source Address
Destination Address
Options Padding
IPv4 Header
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 12
IPv4 and IPv6 basics (2)
• Simplified, fixed-length, 64 bits aligned -> complexity from core to border
LEGEND
Field’s name kept from IPv4 to IPv6
Name and position changed in IPv6
New field in IPv6
Source Address
Destination Address
Version Traffic Class Flow Label
Payload Length Next Header Hop Limit
IPv6 Header
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 13
IPv4 and IPv6 basics (3)
• New IPv6 basic header has advantages: - Simplified, fixed length, and aligned to 64 bits -> routers
can process it faster --> Scalable
- Redundant or not needed features are eliminated: checksum, header length (IHL)
- New QoS field (IntServ): Flow Label
- Much more addresses
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 14
IPv4 and IPv6 basics (4)
• Fixed: Types and order
• Flexible use
• Processed only at endpoints
• Exceptions: Hop-by-hop (and Routing)
• Only appear once
• Exception: Destination Options
* Options for IPs in routing header
** Options for destination IP
Basic IPv6 Header
Hop-by-hop Options
Destination Options*
Routing
Fragmentation
IPSec: AH
IPSec: ESP
Destination Options**
Upper Layer
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 15
IPv4 and IPv6 basics (5)• Basic IPv6 header is processed in all hops
• Extension headers processed at destination (exception Hop-by-hop)
R1S R2 R3 D
IPv6 EHs DATA
IPv6 EHs DATA
IPv6 EHs DATA
IPv6 EHs DATA
IPv6
IPv6 EHs
IPv6
IPv6
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 16
Types of IPv6 Addresses
• Unicast (one-to-one) • Link-local • Unique Local (ULA) • IPv4-mapped • Global (GUA) • Site-local (deprecated) • IPv4-compatible (deprecated)
• Multicast (one-to-many) • Anycast (one-to-nearest) (taken from unicast space) • Reserved (Trans. Mechs, documentation, loopback, etc.) • There are no BROADCAST addresses -> well-known
multicast
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 17
IPv6 addresses: Notation (1)
Group 1
16 bits
: Group 2
16 bits
: Group 3
16 bits
: Group 4
16 bits
: Group 5
16 bits
: Group 6
16 bits
: Group 7
16 bits
Nibble 1
4 bits
Nibble 2
4 bits
Nibble 3
4 bits
Nibble 4
4 bits Binary 0000 0001 0010 0011
… 1111
Hexadecimal 0 1 2 3 … F
: Group 8
16 bits
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 18
IPv6 addresses: Notation (2)
• IPv6 address notation rules: - 8 Groups of 16 bits separated by “:” - Hexadecimal notation of each nibble (4 bits) -> - No case sensitive
• Compression rules: - Leftmost zeroes within each group could be eliminated - One or more consecutive groups of all zeroes could be
changed by “::”. Only once!
Binary 0000 0001 0010 0011
… 1111
Hexadecimal 0 1 2 3 … F
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 19
IPv6 addresses: Notation (3)
• Use “[]” to specify port -> http://[2001:db8::10]:8080
• Examples:
- 2001:0db8:0102:0DA0:0000:0000:0000:1000 -> 2001:db8:102:DA0::1000
- 2001:db8:0000:0000:0020:0000:0000:0abc -> ?
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 20
IPv6 addresses: Notation (4)
• Network prefixes follow CIDR notation • Compression rules could be applied
• Examples: • 2001:db8::/32 -> 2001:0db8:0000:0000:0000:0000:0000:0000• 2001:db8:1200::/40 -> 2001:0db8:1200:0000:0000:0000:0000:0000
• Non-prefix bits (rightmost) used for subneting • Example: I’ll take the first two /52 prefixes out of 2001:db8:abcd::/48
• 2001:db8:abcd::/48 -> 2001:0db8:abcd:0000:0000:0000:0000:0000
• 2001:0db8:abcd:0000:0000:0000:0000:0000 -> 2001:db8:abcd:0000::/52 • 2001:0db8:abcd:1000:0000:0000:0000:0000 -> 2001:db8:abcd:1000::/52
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 21
IPv6 addresses: IID (1)
• IID could be created in many different ways
- Automatically from MAC addresses (EUI-64)
- Automatically using some kind of algorithm (randomly)
- Manually
- DHCPv6
• /64 prefix for a LAN
• IIDs generated locally in the host (except DHCP)
Interface IDLink Prefix
64 bits 64 bits
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 22
IPv6 addresses: IID (2)
• EUI-64: IID generated from MAC address
48 bits - MAC Address
FF FE
24 bits 24 bits
Interface ID
64 bits
u bit
1
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 23
IPv6 addresses: Link-local
• Valid only in a link
• Always present in IPv6-enabled interface
• Prefix fe80::/10 (In practice fe80::/64)
• IID generated locally in the host: based on MAC, randomly or anyhow
Interface IDfe80::
64 bits 64 bits
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 24
IPv6 addresses: ULA
• ULA addresses: FC00::/7 Prefix
• L = 1 prefix is locally assigned
• L = 0 may be defined in the future (defined for centrally assigned prefixes)
• Global ID: pseudo-randomly generated
• You’ll create a /48 prefix, starting with FD00::/8
Interface IDfc00::/7
16 bits 64 bits
L Global ID Subnet ID
40 bits7 bits 1 bit
ULA Prefix = 48 bits
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 25
IPv6 addresses: Multicast (1)
• Multicast addresses: Prefix FF00::/8
• Flags: used for multicast routing and services
• Scope: part of network where address is valid - 1 - Interface-Local - 2 - link-local - 4 - admin-local - 5 - site-local - 8 - organization-local - E - global
• Group ID: Identifies the multicast group
Group ID
4 bits 112 bits
FF Flags
8 bits 4 bits
Scope
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 26
IPv6 addresses: Multicast (2)
• Substitute of IPv4 Broadcast addresses
• Well-known IPv6 multicast addresses: - FF02::1 (all nodes)
- FF02::2 (all routers)
- FF02::1:2 (all DHCP-agents)
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 27
IPv6 addresses: Types and Prefixes• Unicast (one-to-one)
• Link-local (FE80::/10) • Unique Local (ULA) (FC00::/7) • IPv4-mapped (::FFFF:IPv4/128) • Global (GUA) (2000::/3) (binary: 0010) • Site-local (deprecated) (FEC0::/10) • IPv4-compatible (deprecated) (::IPv4/128)
• Multicast (one-to-many) (FF00::/8) • Anycast (one-to-nearest) (taken from unicast space) • Reserved (Trans. Mechs, documentation (2001:db8::/32),
loopback (::1/128), unspecified (::/128), etc.) • No BROADCAST addresses -> well-known multicast
(FF02::1, FF02::2)
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 28
IPv6 addresses: Scope• Where the address is valid
GLOBAL SITE
LINK
INTERFACE
fe80::A:b:100 ff01::2
ff02::1FD00:A:B::100 FF05::1:3
2001:67c:2e:1::c1
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 29
IPv6 addresses: Exercise (1)• Short Exercise with IPv6 Addresses:
- Your IPv6 prefix 2001:0db8:1002:AB00::/56 - Take three /64 prefixes from it to assign to three different
LANs: LAN1, LAN 2 and LAN3 - Give IPv6 address to hosts: H1, H2, H3, and H4
IPv6 Internet
R1
R2 R3
H1 H2 H3 H4
LAN1 LAN2 LAN3
2001:db8:1002:AB00::/56
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 30
IPv6 addresses: Exercise (2)
• Complete the table:
Description Prefix / Address
LAN 1 /64
LAN 2 /64
LAN 3 /64
H1
H2
H3
H4
Alvaro Vives | Workshop on Open Source Solutions for the IoT | 26 June 2017 31
IPv6 addresses: Exercise (3)
• Start with /56 prefix -> you have to divide into /64s
2001:0db8:1002:AB00:0000:0000:0000:0000
• In total 28 = 256 /64 prefixes: 2001:db8:1002:ab00::/64, 2001:db8:1002:ab01::/64, … 2001:db8:1002:abFF::/64
: 1010 1011 0000 0000 : (binary) : 1010 1011 0000 0001 : (binary) . . . : 1010 1011 1111 1111 : (binary)
:AB00: (hex.) :AB01: (hex.) … :ABFF: (hex.)
[email protected] @TrainingRIPENCC