87
Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Embed Size (px)

Citation preview

Page 1: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Introduction to Internetworking

3035/GZ01 Networked SystemsKyle Jamieson

Department of Computer ScienceUniversity College London

Page 2: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Building bigger, heterogeneous networks

• We’ve seen a few examples of local area networks so far: Ethernet, 802.11, CDMA

• But, local area networks have limitations:1. Scaling number of networks and users2. Link layer heterogeneity: users of one type of

network want to communicate with users of other

• How to interconnect large, heterogeneous networks?

Page 3: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Today

From design principles tothe actual design of the Internet

• Five basic Internet design decisions• Design of IP– Internet addressing– Forwarding in the Internet

Page 4: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Five basic Internet design decisions

1. Datagram packet switching

2. Best-effort service model

3. Layering

4. A single internetworking protocol

5. The end-to-end principle (and fate-sharing)

Page 5: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Datagram packet switching• Divide messages into a sequence of datagrams

• Network deals with each datagram individually– Each contains enough information to allow any switch

to decide how to get it to its destination– What is an alternative to this?

• Means that each datagram must contain all relevant network information in its header– Every packet contains complete destination address– Switch consults forwarding table– Process of building forwarding tables: routing

Page 6: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Routers• Routers are switches that use IP addresses to forward packets across the

Internet

• A router consists of– Set of input interfaces where packets arrive– Set of output interfaces from which packets depart– Some form of interconnect connecting inputs to outputs

• A router implements– Forwarding packet to corresponding output interface– Management of bandwidth and buffer space resources

host host host

LAN 1

... host host host

LAN 2

...

router router routerWAN WAN

Router

Page 7: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Why datagram packet switching?

1. Achieve higher levels of utilization– Statistical multiplexing– Review: Why is this more important for the Internet than

for the phone network?

2. Avoid (large) per-flow state inside the network– Plenty of routing state, but no per-flow state– Follows from notion of fate-sharing (will discuss later)– Enables robust fail-over if paths fail

Page 8: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Five basic Internet design decisions

1. Datagram packet switching

2. Best-effort service model

3. Layering

4. A single internetworking protocol

5. The end-to-end principle (and fate-sharing)

Page 9: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

What is “best effort?”

• Network makes no service guarantees– Just gives its best effort (BE)

• The network has failure modes:a) Packets may be lostb) Packets may be corruptedc) Packets may be delivered out of orderd) Packet may be significantly delayed

Source Destination

Internet

Page 10: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Why best effort (BE)?1. BE means the task of the network is simple– No need to do error detection and correction– No need to remember from one packet to next– No need to manage congestion in the network• No need to reserve bandwidth or memory

– No need to make packets follow same path

2. Easier to survive failures– Transient disruptions are okay during failover

3. Simplifies interconnection between networks– Minimal service promises

Page 11: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

But What About Applications?• Some applications want more, for example:

– Bulk file transfer: File Transfer Protocol (FTP)• Requires all the data, with no losses or corruption• Order that data is delivered doesn’t matter

– Telephone conversation: Skype, RTP• Requires minimal and predictable delays• Losses and corruption don’t matter (to a point)

• Perhaps the most important issue in design, which the Internet got right

Page 12: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Five basic Internet design decisions

1. Datagram packet switching

2. Best-effort service model

3. Layering

4. A single internetworking protocol

5. The end-to-end principle (and fate-sharing)

Page 13: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Other layers address failure modesa) Packets may be lost or arbitrarily delayed– Sender can send the packets again, or not– No network congestion control (beyond “drop”)• Sender can slow down in response to loss or delay

b) Packets may be corrupted– Higher-level protocol can detect/correct errors, or not

c) Packets may be delivered out-of-order– Receiver can put packets back in order, or not

d) Packets may be arbitrarily delayed– Receiver can buffer packets for smooth playout, or not

Page 14: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

What can’t higher layers do?• Higher layers cannot make delay smaller

• If applications needs guarantee of low delay, then need to ensure adequate bandwidth– Will keep queuing delay low– No way to help with speed-of-light latency

• What applications need guaranteed low-delay?

• Can the Internet support phone calls?

Page 15: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Review: What is layering?

• Modularity partitions functionality into modules

• Laying is a particularly simple form of modularity

• Modules only deal with layers above and below– Simplifies interactions between modules– Simplifies introduction of new protocols

Page 16: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Five basic design decisions

1. Datagram packet switching

2. Best-effort service model

3. Layering

4. A single internetworking protocol

5. The end-to-end principle (and fate-sharing)

Page 17: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

IP: one networking layer protocol

• Design goal #1 of the Internet: Connect existing heterogeneous networks together

• IP unifies the architecture of the network of networks

• As long as applications can run over IP-based protocols, they can run on any network

• As long as networks support IP, they can run any application

Page 18: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

The Internet hourglass

• Only one network-layer protocol: Internet Protocol (IP)• The “narrow waist” facilitates interoperability

Application

Transport

Network

Link

Physical

FTP HTTP TFTP DNS

TCP UDP

IP

Ethernet PPP WiFi

Copper Radio

Page 19: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Alternatives to universal IP?• What would happen if we had more than one network

layer protocol?

• Are there disadvantages to having only one network layer protocol?– Some loss of flexibility, but the gain in interoperability

more than makes up for this– Because IP is embedded in applications and in

interdomain routing, it is very hard to change• Having IP be universal made this mistake easier to

make, but it didn’t cause this problem

Page 20: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Five basic design decisions

1. Datagram packet switching

2. Best-effort service model

3. Layering

4. A single internetworking protocol

5. The end-to-end principle (and fate-sharing)

Page 21: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Review: the end-to-end principle

• Basic principle: some types of functionality can only be completely and correctly implemented end-to-end

• Because of this, end hosts:– Can satisfy the requirement without network’s help– Will/must do so, since can’t rely on network’s help

• Therefore, don’t go out of your way to implement them in the network

Page 22: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Related notion of fate-sharing• Principle: When storing state in a distributed system,

keep it co-located with the entities that ultimately rely on the state

• Fate-sharing is a technique for dealing with failure– Only way that failure can cause loss of the critical

state is if the entity that cares about it also fails ...– … in which case it doesn’t matter

• Often argues for keeping network state at end hosts rather than inside routers– In keeping with end-to-end principle– e.g., packet-switching rather than circuit-switching– e.g., NFS file handles, HTTP “cookies”

Page 23: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Today

From design principles tothe actual design of the Internet

• Five basic Internet design decisions• Design of IP– Internet addressing– Forwarding in the Internet

Page 24: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Designing IP

• What does it mean to “design” a protocol?

• Answer: specify the syntax of its messages and their meaning (semantics).– Syntax: elements in packet header, their types and layout;

representation– Semantics: interpretation of elements; information

• What semantics should the IP header support?

Page 25: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

IP functionality (1/2)

• Getting the packet there:– Where is the packet going?– Which protocol will process packet on host?

• Network handling of packet:– How should the packet be forwarded (e.g., priority)– Where does header and packet end?

• Coping with problems:– Has the header been corrupted? (Why not payload?)– Has the packet been fragmented? If so, provide information

needed to reconstruct– Is packet caught in a loop? If so, drop packet

Page 26: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

IP functionality (2/2)

• Extensibility: How can we let IP change?– Which IP version and options are expected?

• Miscellaneous:– Where did the packet come from? (Why is this needed?)

Page 27: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

From semantics to syntax

• The past two slides discussed the kinds of information the header must provide

• Will now show the syntax (layout) of the header, and discuss the semantics in more detail

Page 28: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

• Version (four bits)– Indicates the version of the IP

protocol– Needed to know what other fields to

expect– Typically “4” (IPv4), else “6” (IPv6)

• HLen (four bits)– Number of 32-bit words in the header– Typically “5” (for a 20-byte IPv4

header)– Can be more if IP options are used

• TOS (one byte)– Type of service– Allows packets to be treated

differently based on needs– e.g., low delay for audio, high

bandwidth for bulk transfer

The IP packet header

bit:

Page 29: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

• Length (16 bits)– Number of bytes in the

packet– Maximum size is 65,535

bytes (216−1) though underlying links may impose smaller limits

• Ident (16 bits), Flags (three bits), Offset (13 bits)– Support IP fragmentation

The IP packet header

bit:

Page 30: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

How to cope with different MTUs?• Key to addressing heterogeneity in the Internet

• Each link layer has a maximum datagram size or maximum transmission unit (MTU)

• How to make datagrams as big as the minimum MTU over link layers along path they happen to take (path MTU)?– This would minimize header overheads

• Don’t want to send all datagrams sized with the lowest MTU of any link layer– Inefficient, and the lowest MTU is unknown, and changes

depending on route

Page 31: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

IP’s datagram fragmentation• Routers break datagrams into smaller fragments– Each fragment is its own self-contained IP datagram

• Ident (16 bits): used to tell which fragments belong together

• Flags (three bits):– More (M): set to “1” if fragment is not the last one, else “0”

– Don’t Fragment (D): instruct routers to not fragment even if this fragment won’t fit• Instead, they drop the packet and send back a “Too

Large” ICMP control message• Forms the basis for “Path MTU Discovery,” covered later

– Reserved (R): unused bit

• Offset (13 bits): what part of the original datagram this fragment covers in eight-byte units

Page 32: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Where should reassembly happen?

• Answer #1: within the network, with no help from end-host B (receiver)

1000500 500

MTU=1000B MTU=500B MTU=1000BHost AHost B

R1R2

1000

Page 33: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Where should reassembly happen?

• Answer #1: within the network, with no help from end-host B (receiver)

• Answer #2: at end-host B (receiver) with no help from the network

500 500

MTU=1000B MTU=500B MTU=1000BHost AHost B

R1R2 1000

Page 34: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Where should reassembly happen?

• Answer #1: within the network, with no help from end-host B (receiver) ✗

• Answer #2: at end-host B (receiver) with no help from the network ✔

• Fragments can travel across different paths!

500

MTU=1000B MTU=500B MTU=1000BHost AHost B

R1R2

1000

R3

500

Page 35: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Fragmentation example

Ethernet MTU: 1492 bytesFDDI MTU: 4500 bytesPPP MTU: 532 bytes

M; offset=0

M; offset=64

Offset=128

Page 36: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Fragmentation considered harmful• Although IP’s fragmentation is in keeping with the end-to-end

principle, fragmentation is generally considered harmful for two performance-related reasons:

1. Fragmentation causes inefficient use of resources

2. Loss of fragments leads to degraded performance– Loss of any fragment requires retransmit of entire datagram

500MTU=1000B MTU=500B MTU=1000BHost A

Host BR1

R21000

R3

500

Page 37: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Path MTU discovery• Source initially sets path MTU estimate (PMTU) to be

the MTU of first hop

• Source sends datagrams with Don’t Fragment (DF) bit set in Flags field

• If any datagrams are too big to be forwarded:– Intermediate router discards them and send an ICMP

“Destination Unreachable” message with “datagram too big” flag set back to the source• Source then reduces its PMTU estimate

Page 38: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

• TTL (8 bits)– Potentially catastrophic

problem– Forwarding loops can cause

datagrams to cycle forever– As these accumulate,

eventually consume all capacity

• Solution: Routers decrement TTL field at each hop, packet is discarded if TTL reaches zero– ICMP “time exceeded”

message sent back to source

The time-to-live field

bit:

Page 39: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

• Protocol (8 bits)– Identifies higher-layer protocol– e.g. “6” for Transmission

Control Protocol (TCP)– e.g. “17” for User Datagram

Protocol (UDP)– Important for demultiplexing at

the end host– Indicates what kind of header

to expect within IP payload

Protocol demultiplexing

bit:

Protocol=6TCP header

TCP payload

Protocol=17UDP header

UDP payload

Page 40: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

• Checksum (16 bits)– Recall: Complement of the one’s

complement sum of all 16-bit words in the IP packet header

• If verification fails, router should discard the packet– So it doesn’t act on bogus

information

• Checksum recalculated at each hop– Why?– Why include the TTL field in the

checksum?– Why only over the header?

IP checksum

bit:

Page 41: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

• Checksum (16 bits)– Recall: Complement of the one’s

complement sum of all 16-bit words in the IP packet header

• If verification fails, router should discard the packet– So it doesn’t act on bogus information

• Recalculated at each hop– Why? Because the TTL field is

decremented on each hop.– Why include the TTL field in the

checksum? Ensures loop detection works correctly in presence of router bugs.

– Why only over the header? e2e argument: if higher layers need reliability, they will implement it; errors can be introduced between layers as well.

IP checksum (notes)

bit:

Page 42: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

• SourceAddr (32 bits)– Unique identifier for the

sending host– Recipient can decide whether

to accept packet– Routers can decide whether

to forward packet– Enables recipient to reply

• DestinationAddr (32 bits)– Unique identifier for the

receiving host– Allows each router to make

forwarding decisions

IP addresses

bit:

Page 43: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Today

From design principles tothe actual design of the Internet

• Five basic Internet design decisions• Design of IP– Internet addressing– Forwarding in the Internet

Page 44: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Designing IP’s addresses• Question #1: what should an address be associated

with?– e.g., a telephone number is associated not with a

person, but with a handset

• Question #2: what structure should addresses have? – What are the implications of different types of

structure?

• Question #3: who determines the particular addresses used in the global Internet? – What are the implications of how this is done?

Page 45: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

IPv4 addresses• A unique 32-bit number

• Uniquely identifies and associated with an interface (on a host, on a router, &c.)

• Represented in dotted-quad notation– a.b.c.d where each component is an eight-bit decimal

number between zero and 255– e.g. 12.34.158.5

12 34 158 5

00001100 00100010 10011110 00000101

Page 46: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Addressing: a scalability challenge

• Suppose hosts had arbitrary addresses– Then every router would need to store all addresses in its forwarding table– This arrangement doesn’t scale

1.2.3.4 5.6.7.8 2.4.6.8 1.2.3.5 5.6.7.9 2.4.6.9

1.2.3.4

1.2.3.5

forwarding table

host host host

LAN 1

... host host host

LAN 2

...

router router routerWAN WAN

2.4.6.8

... ...

Page 47: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Hierarchical addressing• Universal trick in complex systems: When you need more

scalability, impose a hierarchical structure

• The Internet is an “inter-network” that connects networks together, not hosts– Natural two-level hierarchy: WAN delivers to right LAN;

LAN delivers to right host– Key idea: Separate routing tables at each level of

hierarchy, each of manageable scale

host host host

LAN 1

... host host host

LAN 2

...

router router routerWAN WAN

Page 48: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Hierarchical addressing

• Prefix is network address: suffix is host address

• “Slash notation” describes prefixes

• e.g. 12.34.158.0/23 is a 23-bit prefix with 29 addresses– Terminology: “slash twenty-three”

Network (23 bits) Host (nine bits)

12 34 158 5

00001100 00100010 10011110 00000101

Page 49: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Scalability improved

• Number related hosts with same prefix– 1.2.3.0/24 on the left LAN– 5.6.7.0/24 on the right LAN

1.2.3.4 1.2.3.5 1.2.3.156 5.6.7.8 5.6.7.9 5.6.7.123

1.2.3.0/24

5.6.7.0/24

forwarding table

host host host

LAN 1

... host host host

LAN 2

...

router router routerWAN WAN

Page 50: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Easy to add new hosts

• No need to update the routers– e.g. adding a new host 5.6.7.124 on the right– Doesn’t require adding a new forwarding entry

1.2.3.4 1.2.3.5 1.2.3.156 5.6.7.8 5.6.7.9 5.6.7.123

1.2.3.0/24

5.6.7.0/24

forwarding table

host host host

LAN 1

... host host host

LAN 2

...

router router routerWAN WAN

host

5.6.7.124

Page 51: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Structure of Internet addresses

• Original Internet address structure– First eight bits: network address block (/8)– Last 24 bits: host address

• Assumed 256 networks were more than enough! (They weren’t).

Network Host8 24

Page 52: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Next design: Classful Addressing

• Constrain network, host parts to be fixed lengths– Class A: Very large blocks (e.g. IBM, MIT, HP have /8’s)– Class B: Large blocks (e.g. medium-sized organizations)– Class C: Small blocks (e.g. very small organizations)

Class A:

Class B:

Class C:

Networks Hosts/network126 16 million

16,384 65,534

2 million 254

Page 53: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Address classes inhibited growth• Class C networks too small for mid-sized organizations, so most

organizations got a class B

• Resulting demand for class B networks lead to scarcity of class B networks

• If network reaches the physical size limit imposed by the link layer, then need to allocate a new network address block to that organization, even though it hasn’t filled its class B block!

Number of networks Hosts/networkClass A 126 16 millionClass B 16,384 65,535Class C 2 million 256

Page 54: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Subnetting allows growth at L2

• Subnetting: allow multiple physical networks (subnets) to share a single network number– Add a third level, subnet, to the address hierarchy– Borrow from the host part of the IP address– Subnet number = IP address & subnet mask

Page 55: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

• 128.96.33.0/24• 128.96.34.0/24 128.96.34.0/25 and 128.96.34.128/25

Page 56: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

• Routers still need to know about all networks (up to two million Class C, 65,536 class B)

– Problem #1: way too many networks; routing tables start to grow at a super-linear rate

• Problem #2: Poor address assignment efficiency

– When deciding between class C and class B, and anticipating growing beyond beyond 256 hosts, network planners had to choose class B

– Result: Wasted address space

Problems remain, despite subnetting

[data: Geoff Huston, CAIA]

Page 57: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Addressing in the Internet today: CIDR• CIDR = Classless Interdomain Routing, also known as

supernetting

• Classless: CIDR removes the constraint on network, host address size– Flexible boundary between network, host addresses,

resulting in high address assignment efficiency

• Advantage: Get high address assignment efficiency without excessive forwarding table storage requirements at routers

Page 58: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

CIDR addressing

• Mask must be a contiguous prefix of 1s, starting from the most significant bit, then 0s thereafter; this gives rise to a mask length

IP address: 12.4.0.0 IP mask: 255.254.0.0

Address:

Mask:

Use two 32-bit numbers to represent a network. Network number = IP address AND mask

Written as network number/mask length;e.g. 12.4.0.0/15 or 12.4/15

Network number Host part

00001100 00000100 00000000 00000000

11111111 11111110 00000000 00000000

Page 59: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

CIDR: Hierarchal address allocation

• Prefixes are key to Internet scalability– Addresses allocated in contiguous chunks (prefixes)– Routing protocols and packet forwarding based on prefixes

12.0.0.0/8

12.0.0.0/15

12.253.0.0/16

12.2.0.0/1612.3.0.0/16

12.3.0.0/2212.3.4.0/24

12.3.254.0/23

12.253.0.0/1912.253.32.0/1912.253.64.0/1912.253.64.108/3012.253.96.0/1812.253.128.0/17

… …

Page 60: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

CIDR scalability: Address aggregation

“Send me anythingwith addresses beginning 200.23.16.0/20”

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

Provider A

Customer #0

Customer #7 Internet

Customer #1

Provider B “Send me anythingwith addresses beginning 199.31.0.0/16”

200.23.20.0/23Customer #2

• Routers in the rest of Internet just need to know how to reach 200.23.16.0/20 • Provider A can then direct packets to the correct customer

… …

Page 61: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

1994−1998: CIDR slows routing table growth

Advent of CIDRenables aggregation

[data: Geoff Huston, CAIA]

Roughly lineargrowth trend

Page 62: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

CIDR: Aggregation not always possible

“Send me 200.23.16.0/20”

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

Provider A

Customer #0

Customer #7 Internet

Customer #1 Provider B “Send me 199.31.0.0/16, 200.23.18.0/23”

200.23.20.0/23Customer #2

• Multi-homed Customer #1 (200.23.18.0/23) has two providers• Rest of Internet needs to know how to reach Customer #1 through either• Therefore, 200.23.18.0/23 route must be globally visible

… …

Page 63: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

1989−2005: Superlinear growth trend

Advent of CIDRenables aggregation

Internet boom:Multihoming drives superlinear growth

.com Internetbubble bursts

Conclusion: CIDR has gone a long way to addressing routing table growth, but is not the last word in Internet scalability.

[data: Geoff Huston, CAIA]

Page 64: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Are 32-bit addresses enough?• Not all that many unique addresses

– 232 = 4,294,967,296 (just over four billion)– Plus, some (many) reserved for special purposes– And, addresses are allocated in larger blocks

• And, many devices need IP addresses– Computers, PDAs, routers, tanks, toasters, …

• Long-term solution (perhaps): larger address space– IPv6 has 128-bit addresses (2128 = 3.403 × 1038)

• Short-term solutions: limping along with IPv4– Network address translation (NAT)– Dynamically-assigned addresses (DHCP)– Private addresses

Page 65: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Network Address Translation (NAT)

• Before NAT: Every machine on the Internet had a unique IP address

1.2.3.4

1.2.3.5

5.6.7.8

LAN

Clients

Server

Internet1.2.3.45.6.7.880 1001

dest addr src addrdst port

src port

5.6.7.8 1.2.3.4 80 1001

Page 66: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

NAT mechanics

192.2.3.4

192.2.3.5

5.6.7.8

Clients

Server

InternetNAT

1.2.3.4

5.6.7.8 192.2.3.4 80 1001

192.2.3.4:1001 1.2.3.4:2000

5.6.7.8 1.2.3.4 80 2000

1.2.3.45.6.7.880 2000

5.6.7.8 192.2.3.480 1001

• Independently assign addresses to machines behind a NAT– Usually in address block 192.168.0.0/16

• Use bogus port numbers to multiplex/demux internal addresses

• Example web request from behind a NAT:

Page 67: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

NAT mechanics (2)

192.2.3.4

192.2.3.5

5.6.7.8

Clients

Server

InternetNAT

1.2.3.4

192.2.3.4:1001 1.2.3.4:2000

5.6.7.8 1.2.3.4 80 2001

1.2.3.45.6.7.880 2001

5.6.7.8 192.2.3.580 1001

192.2.3.5:1001 1.2.3.4:2001

5.6.7.8 192.2.3.5 80 1001

• Independently assign addresses to machines behind a NAT– Usually in address block 192.168.0.0/16

• Use bogus port numbers to multiplex/demux internal addresses

• Each actively-communicating client gets its own NAT table entry:

Page 68: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Today

From design principles tothe actual design of the Internet

• Five basic Internet design decisions• Design of IP– Internet addressing– Forwarding in the Internet

Page 69: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

• Each router has a forwarding table– Maps destination addresses to

outgoing interfaces

• Table derived from:– Routing algorithm, or– Static configuration

• Upon receiving a datagram– Inspect the destination IP

address in the header– Index into forwarding table– Forward packet out

appropriate interface

Hop-by-hop datagram forwarding

Page 70: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Using the forwarding table

• With classful addressing, this is easy:– Early bits in the IP address specify network mask

• Class A [0]: /8 Class B [10]: /16 Class C [110]: /24

– Can then find exact match in forwarding table• Use prefix as index into hash table

• Why won’t this work for CIDR?– The IP address doesn’t specify a CIDR mask

• Two difficulties with CIDR forwarding tables– Finding match isn’t trivial– Non-topological addressing

Page 71: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Example 1: Provider with four customers

Prefix Link201.143.0.0/22 Link 1

201.143.4.0.0/24 Link 2201.143.5.0.0/24 Link 3201.143.6.0/23 Link 4

Customer 2Customer 1 Customer 3 Customer 4201.143.0.0/22 201.143.4.0/24 201.143.5.0/24 201.143.6.0/23

Provider ALink 1

Link 2 Link 3

Link 4

Page 72: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Unique prefix matching

• Suppose: No forwarding table entry is a prefix of another• Finding a match is still non-trivial!

201.143.0.0/22

201.143.4.0/24

201.143.5.0/24

201.143.6.0/23

11001001 10001111 000000−− −−−−−−−−

• First 21 bits match four partial prefixes• First 22 bits match three partial prefixes• First 23 bits match two partial prefixes• First 24 bits match exactly one full prefix

11001001 10001111 00000100 −−−−−−−−

✔✔✔✔

11001001 10001111 00000101 −−−−−−−−

11001001 10001111 0000011− −−−−−−−−

11001001 10001111 00000101 00000000Consider

incoming IP:

Page 73: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Example 2: Aggregating customers

Prefix Link201.143.0.0/21 Link 1201.144.0.0/21 Link 2

201.144.0.0/22 201.144.4.0/24 201.144.5.0/24 201.144.6.0/23

Provider B

Customer 6Customer 5 Customer 7 Customer 8

Link 1

201.143.0.0/22 201.143.4.0/24 201.143.5.0/24 201.143.6.0/23

Provider A

Customer 2Customer 1 Customer 3 Customer 4

TransitProvider Link 2

Page 74: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Example 2 (cont’d): a complication

• Suppose the following:– Customer 3 switches to Provider B– Customer 6 switches to Provider A

• How will we represent this in Transit Provider’s forwarding table?

201.144.0.0/22 201.144.4.0/24 201.144.5.0/24 201.144.6.0/23

Provider B

Customer 6Customer 5 Customer 7 Customer 8

Link 1

201.143.0.0/22 201.143.4.0/24 201.143.5.0/24 201.143.6.0/23

Provider A

Customer 2Customer 1 Customer 3 Customer 4

TransitProvider Link 2 201.144.0.0/21201.143.0.0/21

Page 75: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

First try: Unique prefix matchingNetwork Link201.143.0.0/22 11001001 10001111 000000−− −−−−−−−− Link 1201.143.4.0/24 11001001 10001111 00000100 −−−−−−−− Link 1201.144.4.0/24 11001001 10010000 00000100 −−−−−−−− Link 1201.143.6.0/23 11001001 10001111 0000011− −−−−−−−− Link 1201.144.0.0/22 11001001 10010000 000000−− −−−−−−−− Link 2201.143.5.0/24 11001001 10001111 00000101 −−−−−−−− Link 2201.144.5.0/24 11001001 10010000 00000101 −−−−−−−− Link 2201.144.6.0/23 11001001 10010000 0000011− −−−−−−−− Link 2

201.144.0.0/22 201.144.4.0/24 201.144.5.0/24 201.144.6.0/23

Provider B

Customer 6Customer 5 Customer 7 Customer 8

Link 1

201.143.0.0/22 201.143.4.0/24 201.143.5.0/24 201.143.6.0/23

Provider A

Customer 2Customer 1 Customer 3 Customer 4

TransitProvider Link 2 201.144.0.0/21201.143.0.0/21

✗ Lack of delegation ✗ Lack of aggregation

Page 76: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

A more compact representation

Network Link201.143.0.0/21 11001001 10001111 00000−−− −−−−−−−− Link 1201.144.4.0/24 11001001 10010000 00000100 −−−−−−−− Link 1201.144.0.0/21 11001001 10010000 00000−−− −−−−−−−− Link 2201.143.5.0/24 11001001 10001111 00000101 −−−−−−−− Link 2

201.144.0.0/22 201.144.4.0/24 201.144.5.0/24 201.144.6.0/23

Provider B

Customer 6Customer 5 Customer 7 Customer 8

Link 1

201.143.0.0/22 201.143.4.0/24 201.143.5.0/24 201.143.6.0/23

Provider A

Customer 2Customer 1 Customer 3 Customer 4

TransitProvider Link 2 201.144.0.0/21201.143.0.0/21

• Break our convention that no entry is a prefix of another• Use /21s for the bulk of traffic; list /24s as exceptions

Page 77: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Longest prefix matching (LPM)

Network Link201.143.0.0/21 11001001 10001111 00000−−− −−−−−−−− Link 1201.144.4.0/24 11001001 10010000 00000100 −−−−−−−− Link 1201.144.0.0/21 11001001 10010000 00000−−− −−−−−−−− Link 2201.143.5.0/24 11001001 10001111 00000101 −−−−−−−− Link 2

201.144.0.0/22 201.144.4.0/24 201.144.5.0/24 201.144.6.0/23

Provider B

Customer 6Customer 5 Customer 7 Customer 8

Link 1

201.143.0.0/22 201.143.4.0/24 201.143.5.0/24 201.143.6.0/23

Provider A

Customer 2Customer 1 Customer 3 Customer 4

TransitProvider Link 2 201.144.0.0/21201.143.0.0/21

11001001 10010000 00000100 01010101Customer 6 IP:

Customer 7 IP: 11001001 10010000 00000101 01010101

✔✔

Page 78: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Why use LPM?• Nontrivial to find matches in CIDR even w/o longest

prefix match– Because can’t tell where network address ends– Must walk down bit-by-bit

• Decreases size of routing table– Speeding up lookup– Reducing memory consumption

• But how does it work, and how can we speed it up?

Page 79: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Problem: Address space exhaustion

• Motivation: CIDR, subnetting, and NATs help, but eventually the 32-bit IPv4 address space will be exhausted

[caida]

Page 80: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

IPv6

IPv6 header:

• 128-bit address space– Compare IPv4: 4.3 × 109

– IPv6: 3.4 × 1038 (1,500 addresses/ft2 of earth’s surface)

• Summary of changes:1. Eliminated header length2. Eliminated checksum3. New options mechanism

(NextHeader)4. Expanded addresses5. Added FlowLabel

Page 81: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

IPv6 addressing

• What does an IPv6 address look like?

• Eight hexadecimal 16-bit integers separated by colon (“:”)

• Example: 47CD:0000:0000:0000:0000:0000:A456:0124– Can replace at most one set of contiguous 0’s with “::” to yield,

e.g., 47CD::A456:0124

• Address space allocation– IPv6 addresses are classless, but like classful IPv4 addresses,

leading bits specify different uses of an IPv6 address

Page 82: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

IPv6 deployment: Avoiding a “flag day”

• Goal: Avoid a specified day on which every host and router is upgraded from IPv4 to IPv6

• Two sub-goals, then:1. Allow IPv4 nodes to talk to other IPv4 nodes and IPv6

nodes indefinitely

2. Allow IPv6 nodes to talk to other IPv6 nodes even when path contains IPv4 nodes

Page 83: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Dual-stack IPv4/IPv6

• IPv6 nodes also have a complete IPv4 stack– Can send and receive IPv4 or IPv6 datagrams– Use Version field to determine which stack handles incoming

datagram

• Problem: Loss of header information over IPv4 hops

A B E F

IPv6 IPv6 IPv6 IPv6

C D

IPv4 IPv4

Flow: XSrc: ADest: F

A to B:IPv6

Src: ADest: F

B to C:IPv4

Src: ADest: F

D to E:IPv4

Flow: ?Src: ADest: F

D to E:IPv6

Page 84: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Tunneling IPv6 in IPv4

• Whenever an IPv6 node connects to IPv4 networks, configure it to set up a tunnel to another IPv6 router on the other side

• Significant administrative overhead

A B E F

IPv6 IPv6 IPv6 IPv6

tunnelLogical view:

Physical view:A B E F

IPv6 IPv6 IPv6 IPv6

C D

IPv4 IPv4

Page 85: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

Tunneling IPv6 in IPv4

A B E F

IPv6 IPv6 IPv6 IPv6

tunnelLogical view:

Physical view:A B E F

IPv6 IPv6 IPv6 IPv6

C D

IPv4 IPv4

Flow: XSrc: ADest: F

data

Flow: XSrc: ADest: F

data

Flow: XSrc: ADest: F

data

Src: BDest: E

Flow: XSrc: ADest: F

data

Src: BDest: E

A to B:IPv6

E to F:IPv6

B to C: IPv4(encapsulating IPv6)

D to E: IPv4(encapsulating IPv6)

Page 86: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

IPv6: Final thoughts

• Lesson: It’s enormously difficult to change network-layer protocols

• That’s what we expect, because they are the basis for interoperability in the Internet

• Consequence: Pace of innovation at the application, link, and physical layers far outstrips the network layer

Page 87: Introduction to Internetworking 3035/GZ01 Networked Systems Kyle Jamieson Department of Computer Science University College London

NEXT TIME

The Domain Name SystemInternetworking II: Virtual Networks, MPLS, and Traffic EngineeringPre-Reading: P & D, §§4.3, 9.3.1 (5/e); §§4.5, 9.1.3 (4/e)

AcknowledgementParts adapted from lecture material by Scott Shenker (UC Berkeley), and Kurose and Ross (4/e)