designing ip

48
1 Designing IP EE 122: Intro to Communication Networks Fall 2010 (MW 4-5:30 in 101 Barker) Scott Shenker TAs: Sameer Agarwal, Sara Alspaugh, Igor Ganichev, Prayag Narula http://inst.eecs.berkeley.edu/~ee122/ Materials with thanks to Jennifer Rexford, Ion Stoica, Vern Paxson and other colleagues at Princeton and UC Berkeley

Upload: hana

Post on 06-Jan-2016

21 views

Category:

Documents


0 download

DESCRIPTION

Designing IP. EE 122: Intro to Communication Networks Fall 2010 (MW 4-5:30 in 101 Barker) Scott Shenker TAs: Sameer Agarwal, Sara Alspaugh, Igor Ganichev, Prayag Narula http://inst.eecs.berkeley.edu/~ee122/ - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Designing IP

1

Designing IP

EE 122: Intro to Communication Networks

Fall 2010 (MW 4-5:30 in 101 Barker)

Scott Shenker

TAs: Sameer Agarwal, Sara Alspaugh, Igor Ganichev, Prayag Narula

http://inst.eecs.berkeley.edu/~ee122/

Materials with thanks to Jennifer Rexford, Ion Stoica, Vern Paxsonand other colleagues at Princeton and UC Berkeley

Page 2: Designing IP

2

Goals of Today’s Lecture

Transitioning from high-level principles to low-level design

• Review basic design decisions

• Discuss the design of IP– The “what” and “why” of the IP header

• Compare with IPv6

Page 3: Designing IP

Review of Basic Design Decisions

3

Page 4: Designing IP

Five Basic Design Decisions (so far)

1. Packet-switching

2. Best-effort service model

3. Layering

4. A single internetworking layer

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

4

Page 5: Designing IP

1. What is Packet Switching?

• Divide messages into a sequence of packets

• Network deals with each packet individually– What is an alternative to this?

• Means that each packet must contain all relevant network information in its header– Design of protocol almost synonymous with header

5

Page 6: Designing IP

Why Packet-Switching?

• Achieve higher levels of utilization– Statistical multiplexing– Why is this more important for the Internet than for the

phone network?

• Avoid per-flow state inside the network– Plenty of routing state, but no per-flow state– Follows from notion of fate-sharing– Enables robust fail-over

• Why not virtual circuits?– The notion of “soft-state” is midway between DG and VC6

Page 7: Designing IP

7

2. What is “Best Effort”?

• Network makes no service guarantees– Just gives its “best effort

• Service can be imperfect–Packets may be lost–Packets may be corrupted–Packets may be delivered out of order–Packet may be significantly delayed

source destination

IP network

Page 8: Designing IP

8

Why Best-Effort (BE)?

• BE means never having to say you’re sorry…– No need to reserve bandwidth and memory– No need to do error detection & correction– No need to remember from one packet to next– No need to make packets follow same path

• Easier to survive failures– Transient disruptions are okay during failover

• Simplifies interconnection between networks– Minimal service promises

Page 9: Designing IP

But What About Applications?

• Some applications want more:– No losses or corruption, with packets delivered in order

o They just want the data

– Minimal and predictable delayso And they want it now!

• Is Best Effort good enough for these applications?

• Perhaps most important question Internet got right

9

Page 10: Designing IP

10

Use Higher Layers to Compensate

• No error detection or correction– Higher-level protocol can provide error checking

• Successive packets may not follow the same path– Not a problem as long as packets reach the destination

• Packets can be delivered out-of-order– Receiver can put packets back in order (if necessary)

• Packets may be lost or arbitrarily delayed– Sender can send the packets again (if desired)– Receiver can buffer packets for smooth playout

• No network congestion control (beyond “drop”)– Sender can slow down in response to loss or delay

Page 11: Designing IP

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 queueing delay low– No way to help with speed-of-light latency

• What applications need guaranteed low-delay?

• Can the Internet support phone calls?11

Page 12: Designing IP

3. What is and Why 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

12

Page 13: Designing IP

4. Why one networking layer protocol?

• Unifies the architecture

• 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

13

Page 14: Designing IP

14

The Internet Hourglass

Data Link

Physical

Applications

The Hourglass Model

Waist

There is just one network-layer protocol, IP.The “narrow waist” facilitates interoperability.

SMTP HTTP NTPDNS

TCP UDP

IP

Ethernet SONET 802.11

Transport

FiberCopper Radio

Page 15: Designing IP

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

15

Page 16: Designing IP

16

5. What is the End-to-End Principle?

• E2E Principle guides placement of functionality– If hosts can implement functionality correctly, implement

it in a lower layer only as a performance enhancement– But do so only if it does not impose burden on

applications that do not require that functionality

• Fate Sharing guides placement of state– Keep state on elements that rely on it, when possible

Page 17: Designing IP

The Design of IP

17

Page 18: Designing IP

18

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 & layout

o representation

– Semantics = interpretation of elementso information

• What semantics do we need in the IP header?

Page 19: Designing IP

What Info Should Header Provide?

• Getting the packet there:– Where is 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?

• Dealing with problems:– Has header been corrupted? [Why not payload?]– Has packet been fragmented?

o If so, provide information needed to reconstruct

– Is packet caught in a loop?o If so, drop packet

19

Page 20: Designing IP

Header Info (continued)

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

• Miscellaneous:– Where did packet come from? [Why is this needed?]

20

Page 21: Designing IP

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

21

Page 22: Designing IP

22

5 Minute Break

Questions Before We Proceed?

Page 23: Designing IP

IP Packet Structure

4-bitVersion

4-bitHeaderLength

8-bitType of Service

(TOS)16-bit Total Length (Bytes)

16-bit Identification3-bitFlags 13-bit Fragment Offset

8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum

32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

Payload

Page 24: Designing IP

IP Packet Structure

4-bitVersion

4-bitHeaderLength

8-bitType of Service

(TOS)16-bit Total Length (Bytes)

16-bit Identification3-bitFlags 13-bit Fragment Offset

8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum

32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

Payload

Page 25: Designing IP

25

IP Packet Header Fields

• Version number (4 bits)– Indicates the version of the IP protocol– Necessary to know what other fields to expect– Typically “4” (for IPv4), and sometimes “6” (for IPv6)

• Header length (4 bits)– Number of 32-bit words in the header– Typically “5” (for a 20-byte IPv4 header)– Can be more when IP options are used

• Type-of-Service (8 bits)– Allow packets to be treated differently based on needs– E.g., low delay for audio, high bandwidth for bulk transfer

Page 26: Designing IP

IP Packet Structure

4-bitVersion

4-bitHeaderLength

8-bitType of Service

(TOS)16-bit Total Length (Bytes)

16-bit Identification3-bitFlags 13-bit Fragment Offset

8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum

32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

Payload

Page 27: Designing IP

27

IP Packet Header Fields (Continued)

• Total length (16 bits)– Number of bytes in the packet– Maximum size is 65,535 bytes (216 -1)– … though underlying links may impose smaller limits

• Fragmentation: when forwarding a packet, an Internet router can split it into multiple pieces (“fragments”) if too big for next hop link

• Must reassemble to recover original packet– Need fragmentation information (32 bits)– Packet identifier, flags, and fragment offset

Page 28: Designing IP

28

Where Should Reassembly Happen?

• A1: router R2

1000500 500

MTU=1000BMTU=500B

MTU=1000BHost AHost B

R1

R2

MTU (Maximum Transfer Unit) = Maximum packet size handled by network

1000

Page 29: Designing IP

29

Where does Reassemble Happen?

• A2: end-host B (receiver)

500 500

MTU=1000BMTU=500B

MTU=1000BHost AHost B

R1

R2

MTU (Maximum Transfer Unit) = Maximum packet size handled by network

1000

Page 30: Designing IP

30

Where does Reassemble Happen?

• A2: correct answer– Fragments can travel across different paths!

500

MTU=1000BMTU=500B

MTU=1000BHost AHost B

R1

R2

MTU (Maximum Transfer Unit) = Maximum packet size handled by network

1000

R3

500

Page 31: Designing IP

31

Fragmentation, con’t

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

• Flags (3 bits):– Reserved (RF): unused bit– Don’t Fragment (DF): instruct routers to not fragment the

packet even if it won’t fito Instead, they drop the packet and send back a “Too Large” ICMP

control messageo Forms the basis for “Path MTU Discovery”, covered later

– More (MF): this fragment is not the last one

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

Page 32: Designing IP

32

Example of Fragmentation

• Suppose we have a 4,000 byte datagram sent from host 1.2.3.4 to host 3.4.5.6 …

• … and it traverses a link that limits datagrams to 1,500 bytes

Version4

HeaderLength

5

Type of Service0

Total Length: 4000

Identification: 56273R/D/M0/0/0 Fragment Offset: 0

TTL127

Protocol6 Checksum: 44019

Source Address: 1.2.3.4

Destination Address: 3.4.5.6

(3980 more bytes here)

Page 33: Designing IP

33

Example of Fragmentation (con’t)

2020

4000

39803980

2020 14801480

1500

2020 12001200

1220

2020 13001300

1320

• Datagram split into 3 pieces

• Example:

Page 34: Designing IP

34

Example of Fragmentation, con’t

• Datagram split into 3 pieces. Possible first piece:

Version4

HeaderLength

5

Type of Service0

Total Length: 1500

Identification: 56273R/D/M0/0/1 Fragment Offset: 0

TTL127

Protocol6 Checksum: xxx

Source Address: 1.2.3.4

Destination Address: 3.4.5.6

Page 35: Designing IP

35

Example of Fragmentation, con’t

• Possible second piece:

Version4

HeaderLength

5

Type of Service0

Total Length: 1220

Identification: 56273R/D/M0/0/1

Fragment Offset: 185(185 * 8 = 1480)

TTL127

Protocol6 Checksum: yyy

Source Address: 1.2.3.4

Destination Address: 3.4.5.6

Page 36: Designing IP

36

Example of Fragmentation, con’t

• Possible third piece:

Version4

HeaderLength

5

Type of Service0

Total Length: 1320

Identification: 56273R/D/M0/0/0

Fragment Offset: 335(335 * 8 = 2680)

TTL127

Protocol6 Checksum: zzz

Source Address: 1.2.3.4

Destination Address: 3.4.5.6

Page 37: Designing IP

37

Offsets vs Numbering Fragments?

• Q: why use a byte-offset for fragments rather than a numbering each fragment?

• Ans #1: with a byte offset, the receiver can lay down the bytes in memory when they arrive

• Ans #2 (more fundamental): allows further fragmentation of fragments

Page 38: Designing IP

IP Packet Structure

4-bitVersion

4-bitHeaderLength

8-bitType of Service

(TOS)16-bit Total Length (Bytes)

16-bit Identification3-bitFlags 13-bit Fragment Offset

8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum

32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

Payload

Page 39: Designing IP

39

Time-to-Live (TTL) Field (8 bits)

• Potentially lethal problem– Forwarding loops can cause packets to cycle forever– As these accumulate, eventually consume all capacity

• Time-to-live field in packet header– Decremented at each hop, packet discarded if reaches 0– …and “time exceeded” message is sent to the source

o Using “ICMP” control message; basis for traceroute

Page 40: Designing IP

40

IP Packet Header Fields (Continued)

• Protocol (8 bits)–Identifies the higher-level protocol

o E.g., “6” for the Transmission Control Protocol (TCP)o E.g., “17” for the User Datagram Protocol (UDP)

–Important for demultiplexing at receiving hosto Indicates what kind of header to expect next

IP header IP header

TCP header UDP header

protocol=6 protocol=17

Page 41: Designing IP

41

IP Packet Header Fields (Continued)

• Checksum (16 bits)–Complement of the ones-complement sum of all

16-bit words in the IP packet header

• If not correct, router discards packeto So it doesn’t act on bogus information

• Checksum recalculated at every router– Why?– Why include TTL?– Why only header?

Page 42: Designing IP

IP Packet Structure

4-bitVersion

4-bitHeaderLength

8-bitType of Service

(TOS)16-bit Total Length (Bytes)

16-bit Identification3-bitFlags 13-bit Fragment Offset

8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum

32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

Payload

Page 43: Designing IP

43

IP Packet Header (Continued)

• Two IP addresses–Source IP address (32 bits)–Destination IP address (32 bits)

• Destination address–Unique identifier/locator for the receiving host–Allows each node to make forwarding decisions

• Source address–Unique identifier/locator for the sending host–Recipient can decide whether to accept packet–Enables recipient to send a reply back to source

Page 44: Designing IP

IPv6

Page 45: Designing IP

IPv4 and IPv6 Header Comparison

Version IHL Type of Service Total Length

Identification FlagsFragment

Offset

Time to Live Protocol Header Checksum

Source Address

Destination Address

Options Padding

Version Traffic Class Flow Label

Payload LengthNext

HeaderHop Limit

Source Address

Destination Address

IPv4 IPv6

Field name kept from IPv4 to IPv6

Fields not kept in IPv6

Name & position changed in IPv6

New field in IPv6

Page 46: Designing IP

Summary of Changes

• Eliminated fragmentation

• Eliminated header length

• Eliminated checksum

• New options mechanism (next header)

• Expanded addresses

• Added Flow Label

46

Page 47: Designing IP

IPv4 and IPv6 Header Comparison

Version IHL Type of Service Total Length

Identification FlagsFragment

Offset

Time to Live Protocol Header Checksum

Source Address

Destination Address

Options Padding

Version Traffic Class Flow Label

Payload LengthNext

HeaderHop Limit

Source Address

Destination Address

IPv4 IPv6

Field name kept from IPv4 to IPv6

Fields not kept in IPv6

Name & position changed in IPv6

New field in IPv6

Page 48: Designing IP

48

Next Lecture

• IP Addressing

• Read K&R: 4.4.2

• If you want to check out IPv6: K&R 4.4.4