TO 4-25-06 p. 1 Spring 2006 EE 5304/EETS 7304 Internet Protocols Tom Oh Dept of Electrical Engineering [email protected] Lecture 15 TCP - Part 3
Feb 10, 2016
TO 4-25-06 p. 1
Spring 2006
EE 5304/EETS 7304 Internet Protocols
Tom OhDept of Electrical Engineering
Lecture 15
TCP - Part 3
TO 4-25-06 p. 2
Administrative Issues
We will have final exam next week (6:30PM May 9, 2006)
TO 4-25-06 p. 3
Outline
TCP header options TCP for transactions RED
TO 4-25-06 p. 4
TCP Header Options
20-byte TCP 20-byte TCP headerheader
TCP header TCP header optionsoptions DataData
Option kindOption kind Option lengthOption length Option-dependent Option-dependent datadata
1 byte 1 byte Variable
TO 4-25-06 p. 5
TCP Header Options (cont)
Maximum segment size (MSS): In first SYN segment, sender can specify largest segment
that it is willing to receive If not specified, default 536 bytes assumed (not including
TCP/IP headers)
Kind = 2Kind = 2 Length = 4Length = 4 MSSMSS
1 byte 1 byte 2 bytes
TO 4-25-06 p. 6
TCP Header Options (cont)
Window scale factor [RFC 1323]: Specifies factor to shift advertised window field Shift n means multiply by 2n (max. n = 14 allows window
of 230 = 1 billion bytes) Larger windows are better for routes with large bandwidth-
delay products
Kind = 3Kind = 3 Length = 3Length = 3 Shift countShift count
1 byte 1 byte 1 byte
TO 4-25-06 p. 7
TCP Header Options (cont)
Selective acknowledgements (SACK) [RFC 2018]: TCP acknowledgements are cumulative This option allows selective acknowledgement of non-
continuous data, so sender knows exactly what needs to be retransmitted
TO 4-25-06 p. 8
TCP for Transactions
Short transactions might consist of only a query and reply (one packet each way)
UDP does not guarantee reliability, but TCP’s 3-way handshake to set up and clear connections will be wasteful
TCP for transactions (T/TCP) tries to keep TCP’s reliability and short-cut connection set-up for single packets
Uses new header option called CC (connection count)
CC is incremented for each new T/TCP connection from a host
TO 4-25-06 p. 9
TCP for Transactions (cont)
In best case, only 3 segments used
T/TCP SYN, query, FIN, client CC
T/TCP SYN, reply, ACK, FIN, server CC
Request to open connection with CC, pass query, and close; CC number should be increment of previously used CC numbers from this host
ACK
Request to open connection with CC, pass reply, ACK of FIN, and close; CC number should be increment of previously used CC numbers from this host
ACK of FIN
TO 4-25-06 p. 10
TCP for Transactions (cont)
Any packet loss results in time-out and retransmissions
CC allows duplicate packets to be detected If server is not capable of T/TCP, it can resort to
normal TCP 3-way handshake T/TCP is not in common use yet
TO 4-25-06 p. 11
RED
Problem: TCP congestion avoidance algorithm will push network into losing a packet, then back off into slow start
TCP sources tend to become synchronized, going into slow start at same time
Router queue
TCP TCP sourcesource
TCP TCP sourcesource
• • •
1. Buffer overflows, dropping packets
2. Sources detect congestion after RTT
3. Buffer overflow continues in meantime, effecting several sources
4. Several sources back off at same time
TO 4-25-06 p. 12
RED (cont)
TCP rates
Packet loss
Slow start
Retransmission timeouts
Aggregate source
rate into queue
Packet loss
Packet loss
Severe underutilzation
Severe overutilzation
Sources are syncrhonized
From queueing theory, irregular traffic rate will be bad - large queues and packet loss
TO 4-25-06 p. 13
RED (cont)
RED (random early detection) attempts to break the synchronization by making sources back off at different times
No mechanism for explicit notification, so RED relies implicit feedback
Packet will be dropped at random (before buffer overflows), forcing a source to back off before others
Random for fairness De-synchronizing the sources helps to smooth out
aggregate source rate → reduce packet losses and increase throughputs
TO 4-25-06 p. 14
RED (cont)
TCP rates
Packet loss
Aggregate source
rate into queue
Out-of-sync sources result in smoother rate - more sources, more smooth
Packet loss
Packet loss
From queueing theory, smooth traffic rate will be good - small queues and packet loss
TO 4-25-06 p. 15
RED (cont)
RED keeps track of average queue length = smoothed recent history of queue length (to discount transient changes)
Probability of dropping packet (randomly) depends on average queue length
Pr(drop)
MaxP
MinThresh MaxThresh
1
TO 4-25-06 p. 16
RED (cont)
RED has been shown to be very effective with TCP Widely supported in routers
But best choices for parameters (MaxP, MinThresh, MaxThresh) can be difficult to determine
TO 4-25-06 p. 17
Spring 2006
EE 5304/EETS 7304 Internet Protocols
Tom OhDept of Electrical Engineering
Lecture 15
Client-server, DNS, WWW, P2P
TO 4-25-06 p. 18
Outline
Client-server applications Domain Name System (DNS) World Wide Web (WWW) Peer to peer (P2P) protocols
TO 4-25-06 p. 19
Client-Server Applications
Client-server is most common way of organizing processes in a distributed system
Easy to understand, clean organization Computers are clients or servers (or both)
A server is a process running a specific service, eg, file server, web server, name server
A client is a process that makes a request from server and waits for response
RequestReplyClientClient ServerServer
TO 4-25-06 p. 20
Client-Server (cont)
Communications can be connectionless, eg, UDP/IP Efficient but problems over WANs If reply is missing, requests can be retransmitted, but reply
might be just late → duplicate request can cause service to be done twice
Hard for client to tell what really happened Reliable TCP/IP is usually used
Cost is 3-way handshake to establish and terminate connections just for 2 data packets
TCP for transactions (T/TCP) is efficient alternative
TO 4-25-06 p. 21
3-Tiered Client-Server
3-tiered architectures can have intermediaries that are both client and server
Commonly used in transaction processing (application server = transaction monitor coordinates all transactions across different data servers)
Client
Request operation
Reply result
Applicationserver
Databaseserver
Request data
Reply data
TO 4-25-06 p. 22
Horizontal Distribution
Horizontal distribution: a client or server can be physically split into logically equivalent parts, usually for load balancing
Horizontal distribution of servers: example is replicated web servers (identical copies of web contents) for load balancing
Horizontal distribution of clients: peer-to-peer network (actually no server)
TO 4-25-06 p. 23
DNS (Domain Name System)
An application used by other applications, not by users
Example of middleware - works between applications and network
Translates between user-friendly host names (www.website.com) and IP addresses
Frees applications to use host names instead of IP addresses
Totally distributed and decentralized for scalability and reliability
TO 4-25-06 p. 24
DNS (cont)
In early days, central NIC (Network Info. Center) kept a flat (non-hierarchical) table of name-to-address bindings
New hosts were added manually Updated list was mailed out every few days to be installed
by local administrators Did not scale well
TO 4-25-06 p. 25
DNS (cont)
1984 Paul Mockapetris wrote RFCs 882, 883 for DNS and built a reference implementation, JEEVES
1988 Kevin Dunlap wrote an implementation for BSD Unix, BIND (Berkeley Internet Name Domain)
Designed to be a distributed database Local control is allowed over database segments (each
segment holds part of total namespace) Those with administrative responsibility for their domain
names see no outside interference Data from all database segments is accessible
everywhere
TO 4-25-06 p. 26
DNS - Name Space
Database info. is robust (resilient against failures) and highly available (responsive)
Replicated for robustness Cached for high availability
All names are elements of a name space Name space can be represented by a labeled,
directed graph
TO 4-25-06 p. 27
DNS - Name Space (cont)
3 types of nodes: Leaf node represents a named entity, and has no outgoing
edges Directory node has incoming and outgoing edges, each
labeled with a name• Stores a directory table of outgoing edges = (edge label, node
identifier) Root node (usually single) has outgoing edges, no
incoming edges
TO 4-25-06 p. 28
DNS - Name Space (cont)
Example
TO 4-25-06 p. 29
DNS - Name Space (cont)
Each path in graph is referred to by sequence of labels (path name)
Example: n0:<home, steen, mbox> or /home/steen/mbox A path name starting from root node is an absolute
path name A path name starting from another node is a
relative path name
TO 4-25-06 p. 30
DNS - Name Space (cont)
Common types of naming graphs: Hierarchical: like a tree, every node has exactly one
incoming edge and exactly one absolute path name Directed acyclic graph: nodes can have multiple incoming
edges, but graph cannot have a cycle
TO 4-25-06 p. 31
DNS - Name Space (cont)
DNS has a hierarchical name space Example: path name = houns54.clearlake.ibm.com
root-level name
top-level name
first-level name
second-level name
third-level name
(root)
edu
dell
clearlake
houns54
gov mil com org net
ibm hp
TO 4-25-06 p. 32
DNS - Name Space (cont)
DNS hierarchy can be viewed in 3 layers
Global layer: highest level nodes; stable (almost never changing)
Administrative layer: groups belonging to same organization; relatively stable (change occasionally)
Managerial layer: regularly changing, eg, shared files, user-defined directories; could be administered by end users - formally, not part of DNS
TO 4-25-06 p. 33
DNS - Servers
Zone is part of name space implemented in a name server
Although domains must be registered centrally, each domain can be arbitrarily subdivided into zones without registration
3 types of DNS servers within a zone: Primary DNS server or master server:
Only one primary within each zone Keeps zone data file = snapshot of DNS database, which
is read when DNS service starts up
TO 4-25-06 p. 34
DNS - Servers (cont)
Secondary DNS server or slave server: Serve as redundant backup and load balancing Gets its data from primary server in zone Checks for updated info
Caching servers Store recently accessed DNS records from other domains
to avoid performance penalty to make a remote query each time to access a resource outside local domain
TO 4-25-06 p. 35
DNS - Servers (cont)
15 root name servers act as top of DNS hierarchy worldwide
Ultimate source for name lookups that cannot be resolved otherwise
Designed to be highly reliable
TO 4-25-06 p. 36
DNS - Name Resolution
TCP/IP client can send name query (to resolve an address to name) or address query (to resolve a name to address)
This part of client is a name resolver Must be configured with a local DNS server or learn one
using DHCP Example: query for www.foo.com goes to local DNS
server Unless cached, local DNS server queries a root
server for IP address of .com DNS server
TO 4-25-06 p. 37
DNS -Name Resolution (cont)
Local DNS server queries .com DNS server for IP address of foo.com DNS server, then queries this server for foo.com zone
Query goes to primary server in foo.com zone (or secondary server)
Example of “iterative name resolution”
Root server
Resolver
Client8. DNS Reply
Cache
Local DNSserver
1. DNS QueryTop-level domain server
Second-level domain server
2
34
56
7
37
TO 4-25-06 p. 38
World Wide Web
Web is most important example of distributed document-based system
1965 Ted Nelson described idea of “hypertext” (text with hyperlinks)
1989 WWW first proposed by Tim-Berners Lee at CERN for physicists to share hyperlinked data, prototyped on a NeXT cube
1993 first graphical web browser Mosaic released by NCSA
TO 4-25-06 p. 39
WWW (cont)
1994 Marc Andreessen founded Mosaic/Netscape, released Netscape Navigator
1994 CERN and MIT joined to form World Wide Web Consortium (w3.org) to coordinate standards
Web traffic now accounts for 70+ percent Internet traffic
TO 4-25-06 p. 40
WWW Advantages
Simple graphical user interface instead of complex command line
Allows access to variety of resources (documents, graphics, programs)
Hyperlinks are easier to navigate (eg, compared to gopher)
Easy to use search engines Web pages are easy to create and publish
TO 4-25-06 p. 41
WWW Basics: Client-Server
1. DNS query and reply
2. TCP SYN
3. HTTP request4. HTTP response
HTTPTCPIP
HTTPTCPIP
5. TCP FIN
WebWebclientclient
WebWebserverserver
DNSDNSserverserver
TO 4-25-06 p. 42
WWW Basics: Client-Server (cont)
Web browser (client) selects URL (uniform resource locator) to request
Browser parses domain name which must be translated into IP address
Sends domain name to one of local DNS servers DNS server responds with IP address Browser establishes TCP connection with web
server Parses URL for document name, sends HTTP request for
document Web server returns document → browser displays
TO 4-25-06 p. 43
HTTP Protocol
Exchange consists of an HTTP message pair = client request + server response
Stateless: client and server do not keep memory Each exchange is treated as new Keeps servers simple
By default, TCP is transport layer protocol to relieve HTTP from concerns about lost packets (and connection errors are reported)
TO 4-25-06 p. 44
HTTP (cont) HTTP request contains method (operation) + document name +
protocol version Web server applies method in HTTP request and replies with
HTTP response Most common methods:
HTTP request contains method (operation) + document name + protocol version
Web server applies method in HTTP request and replies with HTTP response
Most common methods:Method Description
Head Request to return the header of a document
Get Request to return a document
Put Request to store a document
Post Add data to a collection of documents
Delete Request to delete a document
TO 4-25-06 p. 45
HTTP Request Message Format
Mandatory
Optional additional headers, eg, security info for authentication, client’s email address, date/time, acceptable language
TO 4-25-06 p. 46
HTTP Reply Message Format
Status codes with explanatory phrase:200 Request honored;400 Bad request403 Forbidden404 Not found
TO 4-25-06 p. 47
Web Documents
Every resource is a “document” and usually identified by URL
URL = protocol + host name + (optional port number) + pathname
Example: http://www.cs.vu.nl:80/home/steen/index.html Most documents in HTML (hypertext markup
language) Keywords specify structure of document in different
sections/parts (header, lists, tables, forms,…) Keywords also specify presentation and hyperlinks to
other documents
TO 4-25-06 p. 48
Web Documents (cont)
Other types of documents
TO 4-25-06 p. 49
Web Difficulties
TCP connection set-up/close involves overhead for every Web interaction
Delays in reaching web server Network latency depends on congestion Rule of thumb - users will wait 8 sec for a document
Possible web server overload Centralized servers do not scale well to large networks Vulnerable to denial of service attacks
Possible abuse of cookies (state stored in client)
TO 4-25-06 p. 50
Web Enhancements: CGI
CGI (common gateway interface) allows a web server to execute a program with client input (usually a form)
Allows dynamic interaction with web server
TO 4-25-06 p. 51
Web Enhancements: Servlets and Applets
Slightly different from CGI, a servlet is a program executed within the server (CGI is a separate program)
Applet is similar to servlet but on client side - a Java program sent to client and executed within browser
Browsers include a JVM (Java virtual machine) to interpret Java bytecode and provide a temporary, constrained execution environment
An alternative is Javascript, an interpreted scripting language
TO 4-25-06 p. 52
Web Enhancements: Client-Server
TO 4-25-06 p. 53
Web Client
Variety of document types → browser can call helper applications for display certain documents
Alternatively, a plug-in is small program that attaches to browser through a standard interface
Plug-ins are dynamically loaded as needed
TO 4-25-06 p. 54
Web Client (cont)
Alternatively, a web proxy can act as intermediary between client and server to handle application layer protocols (not HTTP)
Unnecessary today, but web proxies are used for caching purposes
Client Webproxy
HTTP RequestHTTP Reply
FTPserver
FTP RequestFTP Reply
TO 4-25-06 p. 55
Client-Side Caching
Cacheproxy
Cache
Enterprisenetwork
Webserver
Webbrowser
Cache
Webbrowser Recently accessed
content is cached;shared by multiple
clients withinenterprise
Recently accessedcontent is cached;
per browser Cache hit ratio turns out less than 50 percent, and only if cache is large
TO 4-25-06 p. 56
Client-Side Caching (cont)
If web request is not satisfied by browser’s cache, request is forwarded to cache proxy at edge of enterprise network
Cache proxy may contain recently viewed content for all users in enterprise
If not satisfied, request goes to web server Main problem is cache consistency (out of date
contents) Some proxies send a conditional HTTP get request with a
time, server will respond only if document has changed since that time
TO 4-25-06 p. 57
Server Replication
Web server is replicated in a server cluster A front end redirects client requests to one of the servers Protects against server overload
Webserver
Frontend
LAN
HTTP
Webserver
Webserver
Webserver
TO 4-25-06 p. 58
Peer-to-Peer Protocols
Client-server separates world neatly into a few publishers (servers) and many consumers (clients)
Peer-to-peer (P2P) is for equal sharing Information is completely decentralized and located at the
edges of network, not centralized (at servers) Communications is more symmetrical than client-server DNS is not used - nodes are too transient
TO 4-25-06 p. 59
Peer-to-Peer Protocols
Every computer is a publisher and consumer, searches across scattered collections stored at member nodes which appear to be a single indexed repository
Real-time index tracks all active nodes and files chosen for sharing (usually music, video, games)
Nodes can make direct connections with other nodes to share files
TO 4-25-06 p. 60
Peer-to-Peer (cont)
Benefits: Low cost file sharing Easy to build up large networks, dynamically self updating Distributed nature can be resilient to node failures
Disadvantages: Indexing may be inefficient or unreliable Listed information may be cluttered with a lot of noise Most info is music, video, games → used for piracy
TO 4-25-06 p. 61
Start of P2P: Napster
1999 Written by 18 year-old Shawn Fanning as a student at Northeastern U to swap MP3 music (Napster was nickname)
June 2002 legally shut down by RIAA (Recording Industry Assoc. of America)
Initially mp3.com allowed users to upload MP3 music onto a server, or download music
But only files released by artists, recording companies, paid for (by user for downloading), or otherwise in public domain
TO 4-25-06 p. 62
Napster
Fanning wanted a program to combine 3 functions: Search engine: to find MP3 files easily File sharing: to swap MP3 files directly without a central
server for storage Internet relay chat (IRC): to find and chat with other MP3
users Napster client is installed and runs on each node
A directory is chosen for sharing
TO 4-25-06 p. 63
Napster (cont)
Client connects to central Napster index server Server keeps an index of all Napster users currently
online, does not store any MP3 files User requests music by title or artist
Client sends a query to index server Server replies with a list of matches
User can connect directly with any machine in list and download
TO 4-25-06 p. 64
2nd Generation P2P: Gnutella
Many P2P file-sharing programs imitated Napster (Aimster, Morpheus, Kazaa, Grokster)
Sued by music producers, but some have been very difficult to shut down due to total decentralization
2000 Gnutella developed by programmers Justin Frankel and Tom Pepper (previously authored Winamp)
Gnutella is designed as an open protocol, any software can be Gnutella-compatible
Killed by AOL as unauthorized freelancing, but championed by open-source developers
TO 4-25-06 p. 65
Gnutella (cont)
Also designed to share any files, without any centralized management
A host needs to only connect to (any) one host in the Gnutella network
Host A joins by sending initialization PING to host B (in network)
B replies with PONG and info about number and size of files it has to share, then B forwards PING to other nodes that it is connected to
Hosts in vicinity of A reply with PONGs to B, which are forwarded to A
TO 4-25-06 p. 66
Gnutella (cont)
A makes a request for file (by keyword) Request is forwarded by B to its neighbors, then
propagated neighbor to neighbor Matching replies are forwarded back to A
A chooses a matching reply and connects to that machine
Example of distributed intelligence implemented at application layer: each node interprets and responds to a query in its own way
TO 4-25-06 p. 67
Gnutella (cont)
How to initially join? “Host caches” are hosts always up as connecting point
into Gnutella A new host is given a list of other hosts to connect
to (ie, recently seen hosts) But host caches can be swamped by new users
Effectively host caches were causing nodes to be closely clustered into highly interconnected cells, but cells were not well connected
Later enhanced so host caches communicate and distribute new hosts more uniformly
TO 4-25-06 p. 68
Gnutella (cont)
Gnutella nodes are not all equal Some nodes are “more equal than others” - have more
capacity and elected as indexing nodes 3rd generation P2P add features for anonymity
Freenet, I2P, GNUnet, Entropy, MUTE, Napshare
TO 4-25-06 p. 69
BitTorrent
2002 BitTorrent written by Bram Cohen to use P2P file distribution to aid Web downloads
Now popular method for file distribution Normally, downloading large files (video) causes
bottlenecks at servers BitTorrent breaks files into smaller fragments, eg,
250 kB A downloading host finds fragments of a file from
closest peers, perhaps in random (not sequential) order, while providing an upload connection to the fragments it already has
TO 4-25-06 p. 70
BitTorrent - Elements
Web server BitTorrent client: host software for simultaneous
downloading and sharing (uploading) .torrent file: contains information about fragments
of a file (names, sizes, hashes) and address of tracker server
Tracker server: keeps log of which users are downloading and their progress
TO 4-25-06 p. 71
BitTorrent - Downloading
BitTorrent client first downloads .torrent file containing tracker address
Tracker server informs client of other peers with fragments that the client wants
Client requests fragments from its peers using BitTorrent P2P protocol (over TCP)
At same time, client allows peers to download fragments from it
• Clients with entire file are “seed nodes” All nodes continually update tracker of their progress
TO 4-25-06 p. 72
BitTorrent - Features
Rarest first: Clients first request the fragment that fewest peers have
(rarest fragment) Ensures that peers have fragments which all their peers
want Leech resistance:
BitTorrent gives best download performance to hosts that upload the most, discouraging “leeches” (who only download)
Choking algorithm allows peer to refuse uploading to a perceived leech
TO 4-25-06 p. 73
Test #3 Review
MPLS MPLS- FEC, LSR MPLS shim header MPLS concept MPLS traffic engineering
Quality of Service Intserv Guaranteed Service, Resource Reservation, controlled service RSVP Path message Admission control Problem with Intserv
Diffserv Objectives Diffserv concepts EF and AF
TO 4-25-06 p. 74
Test #3 Review (Cont)
Transport Layer Connection Oriented or connectionless. Quality of Service Needed by Application? OSI types of Network Service Type A-1 Network service: connection setup, multiplexing, flow control Type A-2 Network service Type B Network service Type C Network Service: Retransmission Strategy, Duplicate Detection, Flow Control. Connection Setup.
UDP concept UDP header UDP Checksum
TO 4-25-06 p. 75
Test #3 Review (Cont)
TCP Part 1 TCP TCP header: checksum, sequence number, acknowledgement, header length, Flags (Urgent pointer, Push) Windows TCP Retransmissions TCP Adaptive Retransmission Algorithm TCP Duplicate Detection TCP Connection Set-Up TCP Connection Close
TCP Part 2 TCP flow control TCP Congestion control TCP Congestion Avoidance (AIMD) TCP Slow Start Slow Start and Congestion Avoidance Fast retransmit and recovery
TO 4-25-06 p. 76
Test #3 Review (Cont)
TCP Part -3
TCP Header option TCP Transaction RED
Client-Server DNS