csci 6433 internet protocols class 5
DESCRIPTION
CSCI 6433 Internet Protocols Class 5. David C. Roberts. Agenda. Network Address Translation (NAT) User Datagram Protocol (UDP) Reliable Stream Transfer Service (TCP). NAT. Developed in order to extend life of IP address pool Used these characteristics of Internet connections: - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/1.jpg)
CSCI 6433Internet Protocols
Class 5
Dave Roberts
1
![Page 2: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/2.jpg)
Internet Protocol Principles
0Good Citizen Principle0 When a resource is scarce, use less of it
0Conservation of 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
![Page 3: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/3.jpg)
Tonight
0Network Address Translation (NAT)0User Datagram Protocol (UDP)0Reliable Stream Transfer Service (TCP)
3
![Page 4: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/4.jpg)
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
![Page 5: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/5.jpg)
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
![Page 6: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/6.jpg)
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
![Page 7: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/7.jpg)
How It Works
7
![Page 8: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/8.jpg)
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
![Page 9: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/9.jpg)
On to UDP and TCP!
9
![Page 10: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/10.jpg)
What Does IP Do?
0Addressing0Data encapsulation0Fragmentation and reassembly0Routing/indirect delivery
10
![Page 11: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/11.jpg)
UDP and TCP
11
![Page 12: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/12.jpg)
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
![Page 13: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/13.jpg)
UDP and TCP in Operation
13
![Page 14: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/14.jpg)
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
![Page 15: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/15.jpg)
UDP Message Format
15
![Page 16: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/16.jpg)
UDP Message Format
16
Question: How many different UDP ports can there
be on a PC?
![Page 17: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/17.jpg)
UDP Layering
18
Application programs access UDP, and UDP uses IP to send and receive datagrams
UDP message is encapsulated in an IP datagram
![Page 18: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/18.jpg)
UDP Demultiplexing
19
![Page 19: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/19.jpg)
Question
0What good is data that’s not delivered correctly?0Why would we want errors in data?0What is UDP used for? 0Does ICMP use UDP?
20
![Page 20: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/20.jpg)
Well-Known Port Assignments
21
![Page 21: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/21.jpg)
Summary
0UDP is a “thin” protocol0 Unreliable0 Best-effort
0Distinguishes between applications016-bit port number is used0UDP lies in the transport layer
22
![Page 22: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/22.jpg)
On to TCP!
23
![Page 23: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/23.jpg)
What TCP Does
0Addressing and multiplexing0Connection establishment, management and
termination0Data handling and packaging0Provides reliability and transmission quality services0Provides flow control and congestion avoidance
features
24
![Page 24: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/24.jpg)
How TCP Does Its Job
0Connection-oriented0Bidirectional0Multiply-connected0Reliable0Acknowledged0Stream-oriented0Data-unstructured0Data flow managed
25
![Page 25: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/25.jpg)
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
26
![Page 26: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/26.jpg)
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
27
![Page 27: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/27.jpg)
Reliable Delivery, Unreliable Transport
0Ethernet is unreliable0 IP is unreliable0But TCP, that runs over IP, is reliable0How?
28
![Page 28: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/28.jpg)
Unreliable Transport
29
![Page 29: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/29.jpg)
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
30
![Page 30: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/30.jpg)
Reliable Transport
31
![Page 31: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/31.jpg)
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.
32
![Page 32: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/32.jpg)
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.
33
![Page 33: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/33.jpg)
Sliding Window Approach
34
![Page 34: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/34.jpg)
Sliding Window Example
35
![Page 35: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/35.jpg)
Enhanced Positive Acknowledgement
36
![Page 36: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/36.jpg)
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?
37
![Page 37: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/37.jpg)
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
38
![Page 38: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/38.jpg)
TCP and UDP Layering
39
![Page 39: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/39.jpg)
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? 40
![Page 40: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/40.jpg)
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.
41
![Page 41: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/41.jpg)
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
42
![Page 42: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/42.jpg)
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
43
![Page 43: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/43.jpg)
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?
44
![Page 44: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/44.jpg)
TCP Segment Format
45
![Page 45: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/45.jpg)
Code Bits
Code bits determine purpose, contents of the segment
46
![Page 46: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/46.jpg)
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
47
![Page 47: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/47.jpg)
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
48
![Page 48: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/48.jpg)
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 retransmissions
49
![Page 49: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/49.jpg)
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
50
![Page 50: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/50.jpg)
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
51
Karn’s Algorithm is an example of which principle of Internet protocols?
![Page 51: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/51.jpg)
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
52
![Page 52: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/52.jpg)
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.
53
![Page 53: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/53.jpg)
Establishing TCP Connections
Three-way handshake is used to establish TCP connection.
54
![Page 54: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/54.jpg)
Close TCP Connection
55
![Page 55: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/55.jpg)
The TCP FSM
56
![Page 56: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/56.jpg)
Well-Known Port Assignments
57
![Page 57: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/57.jpg)
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
58
![Page 58: CSCI 6433 Internet Protocols Class 5](https://reader036.vdocuments.mx/reader036/viewer/2022062520/56816389550346895dd4794f/html5/thumbnails/58.jpg)
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
59
Since TCP provides reliable communication, why do we need UDP? Why not just use TCP for all Internet communication?