CSCI 6433 Internet Protocols Class 5 Dave Roberts 1.

Post on 24-Dec-2015

219 views 3 download

Tags:

Transcript of CSCI 6433 Internet Protocols Class 5 Dave Roberts 1.

CSCI 6433Internet Protocols

Class 5

Dave Roberts

1

Internet Protocol Principles

0Good Citizen Principle0 When a resource is scarce, use less of it

0Conserve Router Time0 Minimize the work done by routers

0Soft State0 Save information that takes traffic to obtain that might

be used again; age and replace it

2

Agenda

0Network Address Translation (NAT)0User Datagram Protocol (UDP)0Reliable Stream Transfer Service (TCP)

3

NAT

0Developed in order to extend life of IP address pool0Used these characteristics of Internet connections:

0 Most hosts are clients that don’t need to be publicly accessible

0 Not all hosts access the Internet at the same time0 Internet connections are routed

0NAT shares globally unique IP addresses among the hosts that are actually using an Internet connection

4

Analogy

0Think of a NAT router as a company’s telephone operator

0Connects outside callers to local extensions0Connects local extensions to the outside network

5

NAT

0Extends the pool of addresses0Creates a form of two-level addressing0Could be used even more widely to extend the pool of

IPv4 addresses0Does not allow for a server inside the NAT network to

hosts outside0Can be port-based or not

6

How It Works

7

Limitation

0Traditional NAT is said to be “unidirectional”, allows only for transactions originated inside the network

0No allowance for a server inside the network that serves users across the Internet

0Domain Naming Services (DNS) can be used to make a name visible outside the local network (to be discussed)

8

On to UDP and TCP!

9

What Does IP Do?

0Addressing0Data encapsulation0Fragmentation and reassembly0Routing/indirect delivery

10

UDP and TCP

11

Ports

0Destination of a datagram is a program0Selection is by protocol port number0Messages carry source and destination port

numbers0UDP and TCP provide protocol ports, provide

ability to distinguish among destinations within a given host

12

UDP and TCP in Operation

13

UDP--User Datagram Protocol

0UDP provides unreliable, best-effort, connectionless datagram delivery services to multiple destinations within a single host computer, using IP to carry messages

14

UDP Message Format

15

UDP Message Format

16

Question: How many different UDP ports are there

on a PC?

UDP Layering

18

Application programs access UDP, and UDP uses IP to send and receive datagrams

UDP message is encapsulated in an IP datagram

UDP Demultiplexing

19

Well-Known Port Assignments

20

Summary

0UDP is a “thin” protocol0 Unreliable0 Best-effort

0Distinguishes between applications016-bit port number is used0UDP lies in the transport layer

21

On to TCP!

22

What TCP Does

0Addressing and multiplexing0Connection establishment, management and

termination0Data handling and packaging0Provides reliability and transmission quality services0Provides flow control and congestion avoidance

features

23

How TCP Does Its Job

0Connection-oriented0Bidirectional0Multiply-connected0Reliable0Acknowledged0Stream-oriented0Data-unstructured0Data flow managed

24

Why Stream Delivery?

0Using stream delivery protocol frees the application from any concern about network delivery of data

0Packets may arrive out of order0Packet data may contain errors0Application program doesn’t want to know optimal

packet size

25

TCP—Reliable Stream Transport Service

0Stream orientation—receiver gets the same sequence of octets sent by the sender

0Unstructured stream—no way to mark boundaries, applications must use a stream

0Virtual circuit connection—source and destination operate at the same time, interact during the transfer

0Buffered transfer—large blocks can be transferred, fed to receiver as needed

0Full duplex connection—communication can take place in both directions

26

Reliable Delivery, Unreliable Transport

0Ethernet is unreliable0 IP is unreliable0But TCP, that runs over IP, is reliable0How?

27

Unreliable Transport

28

Positive Acknowledgement with Retransmission

0Sender starts a timer when sending, saves data0Receiver sends acknowledgement (ACK) when data

arrives successfully 0When ACK arrives, sender cancels timer, deletes data0 If timer expires, sender retransmits data, starts

another timer

29

Reliable Transport

30

Delays

A positive acknowledgement protocol introduces a number of delays because it delays sending a new packet until it receives an acknowledgement for the previous packet.

31

Sliding Windows

To solve the problem, we use the sliding window approach to decouple transmissions from reception of acknowledgements.

The sender transmits multiple packets before waiting for an acknowledgement. The number of packets is said to be the window size.

32

Sliding Window Approach

33

Sliding Window Example

34

Enhanced Positive Acknowledgement

35

Sliding Window Approach

Question: Suppose the IP link travels over a very high-capacity satellite connection that

has ¼ second latency in each direction. What is the effect on throughput if the window size

is set to 1? What if it is set to, say, 1,000?

36

TCP Protocol Enhancements

0There are a number of protocol extensions and hardware products designed to speed up TCP in the presence of delays

0Generally they involve some form of providing ACKs to the sender before the receiver has received the packet

0The extension then has to provide some form of retransmission itself, since TCP counts success when it receives an ACK

37

TCP and UDP Layering

38

Ports and Connections

0UDP uses the port as a queue to process incoming data

0TCP uses port numbers, but the port number is part of identifying a connection

0A connection is identified as a pair of pairs in the form <host, port>

• Question: can two programs both use the same TCP port on the same machine at once? 39

TCP Segments and Streams

Data stream divided into segments. Window used to send multiple segments before acknowledgement arrives. Allows receiver to restrict transmission until it has

buffer space.

40

Flow Control

0Each ack includes a window advertisement, giving the number of additional octets the receiver is willing to accept

0Sender increases or decreases its window size based on the window advertisement

0The sliding window provides end-to-end flow control

0Congestion, that can occur at intermediate points, is dealt with by congestion control mechanisms

41

MSS

0MSS—maximum segment size is negotiated0MSS may be the MTU of a single connecting network,

if both ends are on the same network0MSS may be the MTU of path if sender and receiver

are on different networks0Risk of poor performance if MSS is too large or too

small

42

Problems with Wrong MSS

0 If too large: segments will be fragmented, requiring extra network messages and routing

0 If too small: fixed size of TCP header, IP header, Ethernet header all are still required for a small amount of data

Question: what’s the right size for a TCP segment?

43

TCP Segment Format

44

Code Bits

Code bits determine purpose, contents of the segment

45

Urgent TCP Data

0Programs may need to send “out of band” data0That is, data is treated as being sent through another

connection0 In TCP, this can be done by setting the urgent flag0Receiving program processes urgent data ahead of the

rest of the data stream

46

TCP Acknowledgements

0TCP acknowledgements can’t refer to datagram or segment numbers, since retransmission can change message size

0TCP ack specifies sequence number of the next octet the receiver expects to receive

0Called a cumulative acknowledgement0Both efficient and inefficient

47

Timeout, Retransmission

0Great variation in transit times, from local net to distant network

0Adaptive retransmission algorithm—monitors the performance of each connection, deduces reasonable timeout value

0Stores round trip time, uses new RTT to change stored RTT slowly

0Timeout is some constant times RTT0Note that acknowledgements are ambiguous in

case of retransmissions48

Karn’s Algorithm

0Timer backoff strategy0 Compute an initial timeout0 If retransmission, then increase timeout0 Often, double the timeout0 Timeout increases have an upper limit

0Karn uses only unambiguous acknowledgements to compute RTT

new_timeout = γ * old_timeout

49

Response to Congestion0No way for TCP to directly know about congestion, which

causes retransmission, increasing congestion even further

0Multiplicative decrease congestion avoidance—when segment is lost, sender congestion window is reduced by half (starts same as receiver advertisement), ack timer is increased

0Allowed window=min(receiver_advertisement, congestion_window)

0Slow-start recovery—start congestion window at single segment size, increase by one for each ack

50

Karn’s Algorithm is an example of which principle of Internet protocols?

Explicit And Explicit Notification

0Most versions of TCP use implicit feedback mechanisms—using timeout and multiple ACKs to detect loss and congestion

0Some versions of explicit feedback have been developed for TCP/IP

0Selective acknowledgement—receiver identifies left edge, right edge of received segments

0Explicit congestion notification—routers add notification to TCP header, then receiver notifies sender in next ACK

51

Global Synchronization

0When router is congested, early routers used tail-drop strategy

0Tail-drop—drop most recent datagram0This can cause drops from many TCP sources at

the same time, leads to global synchronization0Random Early Discard (RED)—uses min and max.

If fewer than min datagrams in queue, add it. If more than min, randomly discard one datagram. More than max, then drop new datagram.

52

Establishing TCP Connections

Three-way handshake is used to establish TCP connection.

53

Close TCP Connection

54

The TCP FSM

55

Well-Known Port Assignments

56

Silly-Window Syndrome

0Receiver reports buffer space available as WINDOW field in ACK

0Advertising single byte window causes sender to send one-octet segment

0Avoid it by:0 Receiver doesn’t advertise until space has accumulated0 Sender doesn’t send unless enough data to fill

medium-size segment. But sends data when an ack arrives, even if still accumulating

57

Summary

0TCP provides an important service: Full duplex, reliable connection between two machines

0Segment as basic unit of interchange0Flow control through advertising, backoff0Many additional techniques to increase performance

58

Since TCP provides reliable communication, why do we need UDP? Why not just use TCP for all Internet communication?