EP2120 Internetworking IK2218 Protocols and Principles of the Internet
Lecture 4
György Dán KTH/EE/LCN Literature: Forouzan, TCP/IP Protocol Suite (3ed Ch 6,8, 27.1, 27.3)(4ed Ch 6,7,27) IP
Global IP Address Allocation •
•
•
Internet Assigned Numbers Authority (IANA@ICANN) manages –
Public IP addresses
–
Autonomous system (AS) numbers
IANA allocates blocks to Regional Internet Registries (RIR) –
Réseaux IP Européens Network Coordination Centre (RIPE NCC)
–
American Registry for Internet Numbers (ARIN)
–
Latin American and Caribbean Internet Addresses Registry (LACNIC)
–
Asia Pacific Network Information Centre (APNIC)
–
African Network Information Centre (AfriNIC)
RIRs allocate blocks to National/Local Internet Registry (LIR) –
•
Internet Service Providers (ISP), Institutions
LIRs assign addresses to end users
Basic forwarding, Addressing
Source: Wikipedia
1
IPv4 Address Exhaustion • Last IPv4 address block allocated by IANA – 3 February 2011
• Already exhausted (/8) – APNIC (Apr 2011) - allocating 1 /22 block per member – RIPE (14 Sep 2012), ARIN (Jul 2015) – LACNIC (Jun 2014)
• Others to be exhausted soon – 80% assignment rule
• Future – Transition to IPv6 – More efficient use of IP addresses – policies – Address block trading $$$ – Network Address Translation (NAT) – private addresses Basic forwarding, Addressing
How to Allocate Addresses? • Number of addresses in a block – 232-n (n is prefix length) – always power of 2 – Not all addresses are usable (by hosts or routers) • Network address – first address of the block • Directed broadcast address – last address of the block
• Example: 130.237.48.0/22 – Address range: 130.237.48.0-130.237.51.255 – Special addresses – not usable • Network address: 130.237.48.0 • Directed broadcast address: 130.237.51.255
– Number of usable addresses: 210-2
Basic forwarding, Addressing
2
How to Allocate Address Blocks • Consider an institution with address block 130.237.0.0/18 • Allocate addresses to the labs/departments/schools – 128 labs require 62 addresses each – 32 departments require 254 addresses each – 8 schools require 1022 addresses each
• What is the winning strategy? – Allocate blocks sequentially – expansion? – Spread out the blocks – inefficient use – new customer? – Remember NetID and Directed broadcast address 1
2
3
1
2
4
3
4
Basic forwarding, Addressing
Exercise: Address Allocation • Use the following block of addresses to allocate addresses to the network shown below – Address block: 121.100.128.0/19
• Answer the following questions – What are the network and broadcast addresses? – What are the router and host addresses? – What network is announced by R1? – Blackholing? (non-allocated blocks) C
D
~1000 hosts
E
B H
G
F A J Basic forwarding, Addressing
K R1
3
Exercise: Address Allocation • Block of addresses: 121.100.128.0/19 • Split into two /20 blocks: 121.100.128.0/20 and 121.100.144.0/20 non-allocated
J 121.100.140.8/29
D 121.100.144.0/22
G 121.100.140.0/29
E 121.100.148.0/22
C 121.100.136.0/22
F 121.100.152.0/22
121.100.128.0/20
B 121.100.132.0/22
H 121.100.156.0/29
A 121.100.128.0/22
K 121.100.156.8/29
C
D
~1000 hosts
E
B H
G
F A J Basic forwarding, Addressing
K R1
Basic Forwarding Continued Delivery and Forwarding in IP
Basic forwarding, Addressing
4
Address aggregation and forwarding • Aggregate NetIDs – Shorter prefix – bigger address block – Less RIB and FIB entries – Black holing – announce net you do not have 100.128.2.0/23, m0, 100.128.0.0/23, m1,R2m2 100.128.3.0/24, m1,R3 R1 0.0.0.0/0,m2,R3m1 m0 m2 m1 100.128.2.0/24 100.128.3.0/24
100.128.0.0/24
m1 m2 m0
100.128.0.0/22, m1,R1m2 ....
R2 m1
100.128.1.0/24
100.128.0.0/24, m0,100.128.1.0/24, m1,100.128.3.0/24, m2,0.0.0.0/0,m2,R1m1
• Longest prefix matching! Basic forwarding, Addressing
Address aggregation and forwarding • Aggregate NetIDs – Shorter prefix – bigger address block – Less RIB and FIB entries – Black holing – announce net you do not have 100.128.2.0/23, m0, 100.128.0.0/23, m1,R2m2 100.128.3.0/24, m1,R3 R1 0.0.0.0/0,m2,R3m1 m0 m2 m1 100.128.2.0/24 100.128.3.0/24
100.128.0.0/24
m1 m2 m0
100.128.0.0/22, m1,R1m2 ....
R2 m1
100.128.1.0/24
• Longest prefix matching!
100.128.0.0/24, m0,100.128.1.0/24, m1,100.128.3.0/24, m2,0.0.0.0/0,m2,R1m1 Dst=100.128.3.3
Basic forwarding, Addressing
5
Address aggregation in practice • Effective address allocation policy needed – e.g., based on geographic location
• IANA RIR (NIR) LIR end users – E.g., 071/8 - ARIN (~N.America), 061/8 – APNIC (Asia-Pacific) – 61.213.162.230 - Tokyo, Japan (NTT) – 61.120.145.198 – Tokyo, Japan (NTT) – 61.1.3.1 – New Delhi, India (BSNLNET) – 61/8 is in Asia – yet different routes
• Caveats – Multi-homing – Lack of IP addresses Allocation of long (/24) prefixes – Enforcement needed (e.g., RIPE 80% rule)
• Current forwarding tables – # of entries ~500000 (~60% are /24 prefixes) Basic forwarding, Addressing
Forwarding Table Sizes • IPv4 networks announced in BGP (FIB)
• Autonomous systems (AS)
Basic forwarding, Addressing
Source: http://www.cidr-report.org
6
Forwarding Table – Common Fields Mask
Network Address
Next-hop Address
..... ...
......... .......... ..... .....
Interface Flags
Reference count
Use
.......... ...... ........... .... .... ... ..... ..
• Mask – netmask applied for the entry [255.255.0.0] • Network address – destination network [145.168.0.0] • Next-hop address – next router [130.237.43.1] • Interface – outgoing interface [eth0] • Flags – status/info [U(p), G(ateway), H(ost-specific)...] • Reference count – # of users using this route (route cloning) • Use – # of packets transmitted for this destination Basic forwarding, Addressing
Exercise: Forwarding table •
A router has the following forwarding table 1 2 3 4 5 6 7
Destination 111.0.0.0/8 193.14.5.160/27 193.14.5.192/27 194.17.21.16/32 192.16.7.0/24 194.17.21.0/24 0/0
Next Hop 111.20.18.14 111.15.17.32 111.20.18.14 111.30.31.18
Flags U U U UGH UG UG UG
Interface m0 m2 m1 m0 m0 m0 m0
• Determine the next-hop address and the outgoing interface for each packet that arrives to the router if the packet’s destination address is • • • • • • •
a) b) c) d) e) f) g)
111.45.32.16 192.16.7.31 194.17.21.45 220.7.14.7 193.14.5.16 193.14.5.196 192.168.130.25
– Try to sketch the network as seen from the router, based on the routing table. Basic forwarding, Addressing
7
Exercise: Forwarding table •
A router has the following forwarding table Destination 111.0.0.0/8 193.14.5.160/27 193.14.5.192/27 194.17.21.16/32 192.16.7.0/24 194.17.21.0/24 0/0
1 2 3 4 5 6 7
Next Hop 111.20.18.14 111.15.17.32 111.20.18.14 111.30.31.18
Flags U U U UGH UG UG UG
Interface m0 m2 m1 m0 m0 m0 m0
• Determine the next-hop address and the outgoing interface for each packet that arrives to the router if the packet’s destination address is • • • • • • •
a) b) c) d) e) f) g)
111.45.32.16 192.16.7.31 194.17.21.45 220.7.14.7 193.14.5.16 193.14.5.196 192.168.130.25
• • • • • • •
Direct delivery on m0 111.15.17.32 on m0 111.20.18.14 on m0 111.30.31.18 on m0 (default) 111.30.31.18 on m0 (default) Direct delivery on m1 111.30.31.18 on m0 (default)
– Try to sketch the network as seen from the router, based on the routing table.
Basic forwarding, Addressing
Fast Address Lookup: Trie /0
0 0
1 1
0
Less specific /1 P r e f /2 i x
1 0 0
1
0
1 1
0
1
l e /3 n g t h
Ex: 101/3
0
1
0 Ex: 0010/4
1
/4 More specific
• Longest prefix matching: find most specific match Basic forwarding, Addressing
S. Nilsson, G. Karlsson, “IP-Address Lookup Using LC-Tries,” IEEE JSAC, vol. 17, no. 6, 1999
8
IP Router Model Control Plane
IP Routing IP Forwarding
RIB
Routing Information Base
FIB
Forwarding Information Base
Data Plane Ethernet Interface
FDDI Interface
Router • Two planes of router operation – data plane: fast and special purpose • handles packet forwarding in real-time
– control plane: general purpose Basic forwarding, Addressing
• handles routing in the background
IP Forwarding Summary • Router forwards packets between network interfaces – Extract header information from the incoming datagram • Destination IP address
– Lookup in the forwarding information base (match networks) • Next-Hop IP address, • Outgoing interface,...
– Modify datagram header (why?) – Send out on outgoing interface
• Router can perform much more than address lookup – Access lists, filtering – Traffic management – Other protocols: Bridging, MPLS, IPv6, ...
Basic forwarding, Addressing
9
Internet Protocol (IP) IP Basic functionality and IPv4 and IPv6 packet headers
IP
IP Service and Functionality • Best effort service - unreliable and connectionless • Application or Transport layer handles e2e reliability
• Design follows the end-to-end argument – Implements only the absolutely necessary functionality
• IPv4 and IPv6 functionality – network layer functionality – Addressing • Globally unique addresses • Aggregation, subnet identification
– Forwarding – Fragmentation
Protocol specifications (IPv4 and IPv6)
– Multiplexing/Demultiplexing – Routing protocols – Error handling and diagnosis IP
10
Versioning - Upgradability • Version 3 (IEN 21, 1 February 1978) – Stems from when NCP was being split into one component handling hop-by-hop communication (IP) and one component handling end-to-end communication (TCP).
• Version 4 (RFC 791) – IPv4 – exclusively used since 1983.01.01
• Version 5 (IEN119/RFC 1190/RFC1819) – ST-II - Internet Stream Protocol (ST) – multimedia streaming • Connection oriented with resource reservation
• Version 6 (RFC 2460) – IPv6 – coming (?!) IP
Needed for packet processing IPv4 • Header Length (4 bits) – Size of IPv4 header including options (20-60 bytes) – Granularity: 4 bytes • 5≤HLEN≤15 • limits header size (20 ≤HS ≤60)!!!
• Total Length (16 bits) – Total length of datagram including header (20-65535 bytes, practice ≤ 8KB) – If datagram is fragmented: length of fragment – Granularity: 1 byte IP
11
Needed for packet processing IPv4
IPv6
• Header Length (4 bits) – Size of IPv4 header including options (20-60 bytes) – Granularity: 4 bytes • 5≤HLEN≤15 • limits header size (20 ≤HS ≤60)!!!
• Total Length (16 bits) – Total length of datagram including header (20-65535 bytes, practice ≤ 8KB)
• Payload Length (16 bits) – Total length of payload excluding base header (0-65535 bytes) – If datagram is fragmented: length of fragment – Granularity: 1 byte – Extendable: Jumbo payload up to 4GB (see later)
– If datagram is fragmented: length of fragment – Granularity: 1 byte IP
Addressing • Packet contains source and destination addresses
IPv4 • 32 bit addresses
IPv6 • 128 bit addresses
IP
12
Multiplexing/Demultiplexing • Interface to higher layers IPv4
IPv6
• Protocol type field
• Next header field
– 8 bits
– 8 bits
• Assigned by IANA – Internet Assigned Numbers Authority
• ~137 assigned IP
decimal
keyword
protocol
1
ICMP
Internet Control Message
4
IP
IP in IP (encapsulation)
6
TCP
Transmission Control
17
UDP
User Datagram
41
IPv6
IPv6 in IPv4
46
RSVP
Reservation Protocol
Fragmentation – MTU • Adaptation to capabilities of the link layer • Maximum payload size of a link – Maximum Transfer Unit (MTU)
©The McGraw-Hill Companies, Inc., 2000
• Fragmentation – Datagram size > MTU
divide datagram into fragments
• Questions • Who should fragment? • How to route the fragments? • Who should reassamble? • What if a fragment is missing? IP
• What information is needed?
13
Fragmentation in IPv4 vs. IPV6 Who should fragment?
IPv4
IPv6
Hosts and routers (unless DF bit set)
Hosts only (router discards and notifies sender)
How to route fragments?
Independently
Who should reassemble?
Destination host
Lost fragment?
Discard entire datagram
Minimum link MTU
68 bytes/576 bytes (rfc791)
1280 bytes (RFC 2460)
Where to store the information?
IPv4 header
Fragmentation extension header
IP
Fragmentation Fields in IPv4 • Identification: 16 bits – Datagram uniquely identified by: src IP, dest IP, ID and protocol – The ID is copied to all fragments of a datagram upon fragmentation
• Flags: 3 bits – RF (Reserved Fragment) – for future use (set to 0) – DF (Dont Fragment). • Set to 1 if datagram should not be fragmented. • If set and fragmentation needed, datagram will be discarded and an error message will be returned to the sender
– MF (More Fragments) • Set to 1 for all fragments, except the last.
• Fragmentation Offset: 13 bits – 8-byte units: (ipip_frag