Module 3
Session 3
Network Layer: IPv4/IPv6
(Putting the Net in Internet)
Possible Addressing Schemes
Flat
[Link] host is identified by a 48-bit MAC address
Router needs an entry for every host in the world
◼ Too big
◼ Too hard to maintain (hosts come and go all the time)
◼ Too slow (more later)
Hierarchy
Addressesbroken down into segments
Each segment has a different level of specificity
Binary Hierarchy Example
1** Datagram, Destination
10* = 101
100
101 11*
0**
110 00*
111 000
001 01*
010
011
IP Addressing
IPv4: 32-bit addresses
Usually written in dotted notation, e.g. [Link]
Each number is a byte
Stored in Big Endian order
0 8 16 24 31
Decimal 192 168 21 76
Hex C0 A8 15 4C
Binary 11000000 10101000 00010101 01001100
IP Addressing and Forwarding
Routing Table Requirements
For every possible IP, give the next hop
But for 32-bit addresses, 232 possibilities!
Too slow: 48GE ports and 4x10GE needs 176Gbps bandwidth
DRAM: ~1-6 Gbps; TCAM is fast, but 400x cost of DRAM
Hierarchical address scheme
Separate the address into a network and a host
0 31
Pfx Network Host
Known by all Known by edge
routers (LAN) routers
How Do You Get IPs?
IP address ranges controlled by IANA
Internet Assigned Number Authority
Roots go back to 1972, ARPANET, UCLA
Today, part of ICANN
IANA grants IPs to regional authorities
ARIN (American Registry of Internet Numbers) may grant you a
range of IPs
You may then advertise routes to your new IP range
There are now secondary markets, auctions, …
IP Datagrams
IP Datagrams are like a letter
Totally self-contained
Include all necessary addressing information
No advanced setup of connections or circuits
0 4 8 12 16 19 24 31
Version HLen DSCP/ECN Datagram Length
Identifier Flags Offset
TTL Protocol Checksum
Source IP Address
Destination IP Address
Options (if any, usually not)
Data
IP Header Fields: Word 1
Version: 4 for IPv4
Header Length: Number of 32-bit words (usually 5)
Type of Service: Priority information (unused)
Datagram Length: Length of header + data in bytes
0 4 8 12 16 19 24 31
Version HLen DSCP/ECN Datagram Length
Identifier Flags Offset
TTL Protocol Checksum
Limits packets
Source IP Address
to 65,535
Destination IP Address
bytes
Options (if any, usually not)
Data
IP Header Fields: Word 3
Time to Live: decremented by each router
Used to kill looping packets
Protocol: ID of encapsulated protocol
6 = TCP, 17 = UDP
Checksum
0 4 8 12 16 19 24 31
Version HLen DSCP/ECN Datagram Length
Identifier Flags Offset
TTL Protocol Checksum
Source IP Address
Used to Destination IP Address
implement Options (if any, usually not)
trace route Data
IP Header Fields: Word 4 and 5
Source and destination address
In theory, must be globally unique
In practice, this is often violated
0 4 8 12 16 19 24 31
Version HLen DSCP/ECN Datagram Length
Identifier Flags Offset
TTL Protocol Checksum
Source IP Address
Destination IP Address
Options (if any, usually not)
Data
Problem: Fragmentation
MTU = 4000 MTU = 2000 MTU = 1500
Datagram Dgram1 Dgram2 1 2 3 4
Problem: each network has its own MTU
DARPA principles: networks allowed to be heterogeneous
Minimum MTU may not be known for a given path
IP Solution: fragmentation
Split datagrams into pieces when MTU is reduced
Reassemble original datagram at the receiver
IP Header Fields: Word 2
Identifier: a unique number for the original datagram
Flags: M flag, i.e. this is the last fragment
Offset: byte position of the first byte in the fragment
Divided by 8
0 4 8 12 16 19 24 31
Version HLen TOS Datagram Length
Identifier Flags Offset
TTL Protocol Checksum
Source IP Address
Destination IP Address
Options (if any, usually not)
Data
Fragmentation Example
MTU = 4000 MTU = 2000 MTU = 1500
Length = 2000, M = 1
Offset = 0
IP Data
Length = 3820, M = 0
20 1980
IP Hdr Data
20 3800 1980
Length = 1840, M = 0 + 1820
Offset = 1980 = 3800
IP Data
20 1820
Fragmentation Example
MTU = 2000 MTU = 1500
Length = 2000, M = 1 Length = 1500, M = 1
Offset = 0 Offset = 0
IP Data IP Data Length = 1500, M = 1
20 1980 20 1480 Offset = 1980
IP Data
Length = 520, M = 1 20 1480
1480
Length = 1840, M = 0 Offset = 1480 + 500
Offset = 1980 IP Data Length
= =1980
360, M = 0
Offset = 3460
IP Data 20 500
20 1820
IP Data
20 340
IP Fragment Reassembly
Length = 1500, M = 1, Offset = 0 Performed at destination
IP Data
20 1480
M = 0 fragment gives us
Length = 520, M = 1, Offset = 1480
total data size
360 – 20 + 3460 = 3800
IP Data
20 500 Challenges:
Length = 1500, M = 1, Offset = 1980 Out-of-order fragments
IP Data Duplicate fragments
20 1480
Missing fragments
Length = 360, M = 0, Offset = 3460
Basically, memory
IP Data
management nightmare
20 340
Fragmentation Concepts
Highlights many key Internet characteristics
Decentralized and heterogeneous
◼ Each network may choose its own MTU
Connectionless datagram protocol
◼ Eachfragment contains full routing information
◼ Fragments can travel independently, on different paths
Best effort network
◼ Routers/receivermay silently drop fragments
◼ No requirement to alert the sender
Most work is done at the endpoints
◼ i.e. reassembly
Fragmentation in Reality
Fragmentation is expensive
Memory and CPU overhead for datagram reconstruction
Want to avoid fragmentation if possible
MTU discovery protocol
Send a packet with “don’t fragment” bit set
Keep decreasing message length until one arrives
May get “can’t fragment” error from a router, which will
explicitly state the supported MTU
Router handling of fragments
Fast,specialized hardware handles the common case
Dedicated, general purpose CPU just for handling fragments
The IPv4 Address Space Crisis
Problem: the IPv4 address space is too small
232 = 4,294,967,296 possible addresses
Less than one IP per person
Parts of the world have already run out of addresses
IANA assigned the last /8 block of addresses in 2011
Regional Internet Registry
Region (RIR) Exhaustion Date
Asia/Pacific APNIC April 19, 2011
Europe/Middle East RIPE September 14, 2012
North America ARIN 13 Jan 2015 (Projected)
South America LACNIC 13 Jan 2015 (Projected)
Africa AFRINIC 17 Jan 2022(Projected)
IPv6
IPv6, first introduced in 1998(!)
128-bit addresses
4.8 * 1028 addresses per person
Address format
8 groups of 16-bit values, separated by ‘:’
Leading zeroes in each group may be omitted
Groups of zeroes can be omitted using ‘::’
[Link]
[Link]
[Link]
IPv6 Header
Double the size of IPv4 (320 bits vs. 160 bits)
0 4 8 12 16 19 24 31
Version DSCP/ECN Flow Label
Datagram Length Next Header Hop Limit
Groups packets into
Version = 6 flows, used for QoS
Source IP Address
Destination IP Address
Differences from IPv4 Header
Several header fields are missing in IPv6
Header length – rolled into Next Header field
Checksum – was useless, so why keep it
Identifier, Flags, Offset
◼ IPv6 routers do not support fragmentation
◼ Hosts are expected to use path MTU discovery
Reflects changing Internet priorities
Today’s networks are more homogeneous
Instead, routing cost and complexity dominate
Performance Improvements
No checksums to verify
No need for routers to handle fragmentation
Simplified routing table design
Addressspace is huge
No need for CIDR (but need for aggregation)
Standard subnet size is 264 addresses
Simplified auto-configuration
Neighbor Discovery Protocol
Used by hosts to determine network ID
Host ID can be random!
Additional IPv6 Features
Source Routing
Host specifies the route to wants packet to take
Mobile IP
Hosts can take their IP with them to other networks
Use source routing to direct packets
Privacy Extensions
Randomly generate host identifiers
Make it difficult to associate one IP to a host
Jumbograms
Support for 4Gb datagrams