what can ip do? deliver datagrams to hosts – the ip address in a datagram header identify a host...

24
What Can IP Do? • Deliver datagrams to hosts – The IP address in a datagram header identify a host • IP treats a computer as an endpoint of communication • Best effort delivery -- no guarantees

Upload: elijah-reed

Post on 24-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

What Can IP Do?• Deliver datagrams to hosts– The IP address in a datagram header identify a host

• IP treats a computer as an endpoint of communication

• Best effort delivery -- no guarantees

Page 2: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

What Do Your Applications Need?• Individual packets go to their own applications

– Your machine may run multiple applications simultaneously• Outlook, Firefox, Windows Media Player.

• Different levels of services– Every bit of information should be received correctly.

• Email

– Can tolerate some information loss• Streamed media

Page 3: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Transport Layer Services• Transport layer provides end-to-end

connectivity across the network– Virtual communications via TCP software

Page 4: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Endpoint Identification with Protocol Port Numbers

• Port numbers– Independent of the OS

• All computers running TCP and UDP recognize the standard protocol port numbers

• TCP and UDP must provide a mapping between protocol port numbers and the program identifiers that the OS uses

Page 5: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Well-Known Port Numbers

• 22: SSH• 25: SMTP• 80: HTTP

• http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

Page 6: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Layer 4 Packet: Segment

• Segments carry application data across the network

• Segments are carried within IP datagrams within frames

802.11 App, e.g., HTTPIP TCP

Frame

Segment

Datagram

Page 7: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Transport Layer Services• TCP/IP suite contains two transport protocols.– User Datagram Protocol (UDP)– Transmission Control Protocol (TCP)

Unreliable ReliableMessages UDP ?

Stream ? TCP

Page 8: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Comparison of Transport Protocols

• TCP is full-featured, UDP is a glorified packet

TCP (Stream) UDP (Message)Connections Connectionless

Point-to-point communication Arbitrary InteractionBytes are delivered once,

reliably, and in orderMessage may be lost, reordered, duplicated

Arbitrary length content Limited message size

Flow control matches sender to receiver

Can send regardless of receiver state

Congestion control matches sender to network

Can send regardless of network state

Page 9: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

UDP: User Datagram Protocol

Page 10: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

User Datagram Protocol • Used by apps that don’t want reliability or stream

service– Voice-over-IP (unreliable)– DNS, RPC (message-oriented)– DHCP (bootstrapping, multicast)

• Arbitrary Interaction– 1 1; 1 N; N 1; or N M

• Best-effort delivery via IP– Lost, duplicated, delayed, delivered out-of order, corrupted

Page 11: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

User Datagram Protocol • Places the data in a single message for transmission– In practice, choose message size that fits in a standard

MTU (e.g., 1500 bytes)• 1400 or 1450 to leave space for IP and UDP headers

• Pros:– Applications preserve data boundaries

• Cons:– Each UDP message must fit into a single IP datagram– UDP message size can lead to inefficient use of the

network

Page 12: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

UDP Datagram Format • Each UDP message is called a user datagram and

consists of two parts: – a short header that specifies the sending and receiving

application – a payload that carries the data being sent

Page 13: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

UDP Checksum and Pseudo Header

• Checksum: An optional, 16-bit field may be used by the destination host to verify whether the message reaches the correct destination.– All bits set to 0 if unused

• When computing the checksum, UDP software includes a pseudo header:

Page 14: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Using the Pseudo Header• The destination host must obtain the UDP length,

and the source, destination, and type field from the IP datagram to verify the checksum value.

• The pseudo header is NOT part of the UDP datagram and NOT transmitted with the datagram.

Page 15: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

TCP: Reliable Transport Service

Page 16: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Challenges

• To achieve efficient, reliable data transmission, a transport protocol must face several major problems:– Unreliable underlying IP service– End system reboot– Heterogeneous end systems– Congestion

Page 17: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Sequencing Handle Duplicates and Out-of-Order Delivery

• Each packet has a sequence number.• The receiver stores both the sequence number of

the last packet received in order and packets arriving out of order

• The receiver examines the sequence number – Expected packet– Packet out of order– Duplicated

Page 18: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

TCP

Last packet # in order:

Packets out of order: 7

23

Application

1 2

34

5

53

Page 19: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Retransmissions Handle Lost Packets• Whenever a frame arrives intact, the receiver

sends a small ACK message that reports successful reception

• The sender ensures that each packet is transferred successfully– Whenever it sends a packet, the sender starts a timer

543210543

ACK

Page 20: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Connection Establishment• Both sender and receiver must be ready before we start the

data transfer

• Three-Way Handshake: To establish connections reliably, TCP exchanges three messages to ensure unambiguous agreement. – SYNs are retransmitted if lost

Page 21: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Connection Establishment

• Sequencing: To establish connection, TCP requires each side to probe the other with a fresh Initial Sequence Number– A randomly generated 32-bit number

Page 22: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Connection Establishment

• Three steps:– Host 1 sends SYN(x)– Host 2 replies with ACK(x+1) + SYN(y)– Host 1 replies with ACK(y+1)

Page 23: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Connection Establishment• Q: Why choose a random number as the Initial

Sequence Number for each connection, instead of using “1”?

1. Two computers agree to communicate at 1 PM2. One computer sends a sequence of 10 packets to the other3. A hardware problem causes packet 3 to be delayed4. Routes change to avoid the hardware problem5. Protocol software on the sending computer retransmits

packet 3 and sends the remaining packets without error

6. At 1:05 PM the two computers agree to communicate again7. After the second packet arrives, the delayed copy of packet

3 arrives from the earlier conversation8. Packet 3 arrives from the second conversation

Extraordinarily long delay Replay Error!

Page 24: What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best

Connection Termination

• The three-way handshake used to close a connection uses FIN segments.