Review of Networking Basics Yao Wang Polytechnic University, Brooklyn, NY11201 yao@vision.poly.edu
These slides are extracted from the slides made by authors of the book (J. F. Kurose and K. Ross), available from the publisher site for instructors. We would like to thank the authors for the excellent book and the slides. Slides based on Computer Networking: A Top Down Approach Featuring the Internet, 2 nd edition. Jim Kurose, Keith Ross Addison-Wesley, July 2002. Chapters 1-2 From [Kurose/Ross] Networking Basics 2
Overview of Telecommunication Networks and Internet Based on Chapter I -- Computer Networks and the Internet From [Kurose/Ross] Networking Basics 3
Roadmap What is the Internet? Network edge Network core Internet structure and ISPs Protocol layers, service models From [Kurose/Ross] Networking Basics 4
What s the Internet: nuts and bolts view millions of connected computing devices: hosts, end-systems PCs workstations, servers PDAs phones, toasters running network apps communication links fiber, copper, radio, satellite transmission rate = bandwidth routers: forward packets (chunks of data) router local ISP company network server workstation mobile regional ISP From [Kurose/Ross] Networking Basics 5
What s the Internet: nuts and bolts view protocols control sending, receiving of msgs e.g., TCP, IP, HTTP, FTP, PPP Internet: network of networks loosely hierarchical public Internet versus private intranet Internet standards RFC: Request for comments IETF: Internet Engineering Task Force router local ISP company network server workstation mobile regional ISP From [Kurose/Ross] Networking Basics 6
A closer look at network structure: network edge: applications and hosts network core: routers network of networks access networks, physical media: communication links From [Kurose/Ross] Networking Basics 7
Network edge: connection-oriented service Goal: data transfer between end systems handshaking: setup (prepare for) data transfer ahead of time Hello, hello back human protocol set up state in two communicating hosts TCP - Transmission Control Protocol Internet s connectionoriented service TCP service [RFC 793] reliable, in-order bytestream data transfer loss: acknowledgements and retransmissions flow control: sender won t overwhelm receiver congestion control: senders slow down sending rate when network congested From [Kurose/Ross] Networking Basics 8
Network edge: connectionless service Goal: data transfer between end systems same as before! UDP - User Datagram Protocol [RFC 768]: Internet s connectionless service unreliable data transfer no flow control no congestion control App s using TCP: HTTP (Web), FTP (file transfer), Telnet (remote login), SMTP (email) App s using UDP: streaming media, teleconferencing, DNS, Internet telephony From [Kurose/Ross] Networking Basics 9
The Network Core mesh of interconnected routers the fundamental question: how is data transferred through net? circuit switching: dedicated circuit per call: telephone net packet-switching: data sent thru net in discrete chunks From [Kurose/Ross] Networking Basics 10
Network Core: Circuit Switching End-end resources reserved for call link bandwidth, switch capacity dedicated resources: no sharing circuit-like (guaranteed) performance call setup required From [Kurose/Ross] Networking Basics 11
Network Core: Circuit Switching network resources (e.g., bandwidth) divided into pieces pieces allocated to calls resource piece idle if not used by owning call (no sharing) dividing link bandwidth into pieces frequency division time division From [Kurose/Ross] Networking Basics 12
Circuit Switching: TDMA and TDMA FDMA Example: 4 users frequency TDMA time frequency time From [Kurose/Ross] Networking Basics 13
Network Core: Packet Switching each end-end data stream divided into packets user A, B packets share network resources each packet uses full link bandwidth resources used as needed Bandwidth division into pieces Dedicated allocation Resource reservation resource contention: aggregate resource demand can exceed amount available congestion: packets queue, wait for link use store and forward: packets move one hop at a time transmit over link wait turn at next link From [Kurose/Ross] Networking Basics 14
Packet Switching: Statistical Multiplexing A 10 Mbs Ethernet statistical multiplexing C B queue of packets waiting for output link 1.5 Mbs D E Sequence of A & B packets does not have fixed pattern statistical multiplexing. In TDM each host gets same slot in revolving TDM frame. From [Kurose/Ross] Networking Basics 15
Packet switching versus circuit switching Packet switching allows more users to use network! 1 Mbit link each user: 100 kbps when active active 10% of time circuit-switching: 10 users packet switching: with 35 users, probability > 10 active less than.0004 N users 1 Mbps link From [Kurose/Ross] Networking Basics 16
Packet switching versus circuit switching Is packet switching a slam dunk winner? Great for bursty data resource sharing simpler, no call setup Excessive congestion: packet delay and loss protocols needed for reliable data transfer, congestion control Q: How to provide circuit-like behavior? bandwidth guarantees needed for audio/video apps still an unsolved problem (chapter 6) From [Kurose/Ross] Networking Basics 17
Packet-switched networks: forwarding Goal: move packets through routers from source to destination we ll study several path selection (i.e. routing)algorithms (chapter 4) datagram network: destination address in packet determines next hop routes may change during session analogy: driving, asking directions virtual circuit network: each packet carries tag (virtual circuit ID), tag determines next hop fixed path determined at call setup time, remains fixed thru call routers maintain per-call state From [Kurose/Ross] Networking Basics 18
Network Taxonomy Telecommunication networks Circuit-switched networks Packet-switched networks FDM TDM Networks with VCs Datagram Networks Datagram network is not either connection-oriented or connectionless. Internet provides both connection-oriented (TCP) and connectionless services (UDP) to apps. Internet From [Kurose/Ross] Networking Basics 19
Internet structure: network of networks roughly hierarchical at center: tier-1 ISPs (e.g., UUNet, BBN/Genuity, Sprint, AT&T), national/international coverage treat each other as equals Tier-1 providers interconnect (peer) privately Tier 1 ISP NAP Tier 1 ISP Tier 1 ISP Tier-1 providers also interconnect at public network access points (NAPs) From [Kurose/Ross] Networking Basics 20
Tier-1 ISP: e.g., Sprint Sprint US backbone network From [Kurose/Ross] Networking Basics 21
Internet structure: network of networks Tier-2 ISPs: smaller (often regional) ISPs Connect to one or more tier-1 ISPs, possibly other tier-2 ISPs Tier-2 ISP pays tier-1 ISP for connectivity to rest of Internet tier-2 ISP is customer of tier-1 provider Tier-2 ISP Tier-2 ISP Tier 1 ISP NAP Tier 1 ISP Tier 1 ISP Tier-2 ISPs also peer privately with each other, interconnect at NAP Tier-2 ISP Tier-2 ISP Tier-2 ISP From [Kurose/Ross] Networking Basics 22
Internet structure: network of networks Tier-3 ISPs and local ISPs last hop ( access ) network (closest to end systems) Local and tier- 3 ISPs are customers of higher tier ISPs connecting them to rest of Internet local ISP Tier 3 ISP Tier-2 ISP Tier 1 ISP Tier-2 ISP local local ISP ISP local ISP Tier 1 ISP local ISP Tier-2 ISP NAP Tier 1 ISP Tier-2 ISP local ISP local ISP Tier-2 ISP local ISP From [Kurose/Ross] Networking Basics 23
Internet structure: network of networks a packet passes through many networks! local ISP Tier 3 ISP Tier-2 ISP local ISP Tier 1 ISP local ISP Tier-2 ISP NAP local ISP Tier 1 ISP Tier-2 ISP local local ISP ISP Tier 1 ISP Tier-2 ISP local ISP Tier-2 ISP local ISP From [Kurose/Ross] Networking Basics 24
Internet protocol stack application: supporting network applications FTP, SMTP, STTP transport: host-host data transfer TCP, UDP network: routing of datagrams from source to destination IP, routing protocols link: data transfer between neighboring network elements PPP, Ethernet physical: bits on the wire application transport network link physical From [Kurose/Ross] Networking Basics 25
Layering: logical communication Each layer: distributed entities implement layer functions at each node entities perform actions, exchange messages with peers application transport network link physical application transport network link physical application transport network link physical network link physical application transport network link physical From [Kurose/Ross] Networking Basics 26
Layering: logical communication E.g.: transport take data from app add addressing, reliability check info to form datagram send datagram to peer wait for peer to ack receipt analogy: post office data application transport network link physical application transport network link physical data ack application transport network link physical network link physical data application transport network link physical From [Kurose/Ross] Networking Basics 27
Layering: physical communication data application transport network link physical application transport network link physical application transport network link physical network link physical data application transport network link physical From [Kurose/Ross] Networking Basics 28
Protocol layering and data Each layer takes data from above adds header information to create new data unit passes new data unit to layer below source destination Hl Ht HnHt HnHt M M M M application transport network link physical application transport network link physical Hl Ht HnHt HnHt M M M M message segment datagram frame From [Kurose/Ross] Networking Basics 29
Application Layer Functions and Protocols with focus on Content Distribution/Retrieval on the Web Based on Chapter II --- Application Layer From [Kurose/Ross] Networking Basics 30
Roadmap Principles of app layer protocols Client-server paradigm Transport service requirements of common app. DNS Web and HTTP Content distribution Network Web caching Content distribution networks From [Kurose/Ross] Networking Basics 31
Applications and application-layer protocols Application: communicating, distributed processes e.g., e-mail, Web, P2P file sharing, instant messaging running in end systems (hosts) exchange messages to implement application Application-layer protocols one piece of an app define messages exchanged by apps and actions taken use communication services provided by lower layer protocols (TCP, UDP) application transport network data link physical application transport network data link physical application transport network data link physical From [Kurose/Ross] Networking Basics 32
App-layer protocol defines Types of messages exchanged, e.g., request & response messages Syntax of message types: what fields in messages & how fields are delineated Semantics of the fields, i.e., meaning of information in fields Rules for when and how processes send & respond to messages Public-domain protocols: defined in RFCs allows for interoperability eg, HTTP, SMTP Proprietary protocols: eg, KaZaA From [Kurose/Ross] Networking Basics 33
Client-server paradigm Typical network app has two pieces: client and server Client: initiates contact with server ( speaks first ) typically requests service from server, Web: client implemented in browser; e-mail: in mail reader Server: application transport network data link physical provides requested service to client e.g., Web server sends requested Web page, mail server delivers e-mail request reply application transport network data link physical From [Kurose/Ross] Networking Basics 34
What transport service does an app need? Data loss some apps (e.g., audio) can tolerate some loss other apps (e.g., file transfer, telnet) require 100% reliable data transfer Timing some apps (e.g., Internet telephony, interactive games) require low delay to be effective Bandwidth some apps (e.g., multimedia) require minimum amount of bandwidth to be effective other apps ( elastic apps ) make use of whatever bandwidth they get From [Kurose/Ross] Networking Basics 35
Transport service requirements of common apps Application Data loss Bandwidth Time Sensitive file transfer e-mail Web documents real-time audio/video stored audio/video interactive games instant messaging no loss no loss no loss loss-tolerant loss-tolerant loss-tolerant no loss elastic elastic elastic audio: 5kbps-1Mbps video:10kbps-5mbps same as above few kbps up elastic no no no yes, 100 s msec yes, few secs yes, 100 s msec yes and no From [Kurose/Ross] Networking Basics 36
How do loss and delay occur? packets queue in router buffers packet arrival rate to link exceeds output link capacity packets queue, wait for turn packet being transmitted (delay) A B packets queueing (delay) free (available) buffers: arriving packets dropped (loss) if no free buffers From [Kurose/Ross] Networking Basics 37
Packet loss queue (aka buffer) preceding link in buffer has finite capacity when packet arrives to full queue, packet is dropped (aka lost) lost packet may be retransmitted by previous node, by source end system, or not retransmitted at all From [Kurose/Ross] Networking Basics 38
Internet transport protocols services TCP service: connection-oriented: setup required between client and server processes reliable transport between sending and receiving process flow control: sender won t overwhelm receiver congestion control: throttle sender when network overloaded does not providing: timing, minimum bandwidth guarantees UDP service: unreliable data transfer between sending and receiving process does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee Q: why bother? Why is there a UDP? From [Kurose/Ross] Networking Basics 39
Internet apps: application, transport protocols Application e-mail remote terminal access Web file transfer streaming multimedia Internet telephony Application layer protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] proprietary (e.g. RealNetworks) proprietary (e.g., Dialpad) Underlying transport protocol TCP TCP TCP TCP TCP or UDP typically UDP From [Kurose/Ross] Networking Basics 40
DNS: Domain Name System People: many identifiers: SSN, name, passport # Internet hosts, routers: IP address (32 bit) - used for addressing datagrams name, e.g., gaia.cs.umass.edu - used by humans Q: map between IP addresses and name? Domain Name System: distributed database implemented in hierarchy of many name servers application-layer protocol host, routers, name servers to communicate to resolve names (address/name translation) note: core Internet function, implemented as application-layer protocol complexity at network s edge From [Kurose/Ross] Networking Basics 41
DNS name servers Why not centralize DNS? single point of failure traffic volume distant centralized database maintenance doesn t scale! no server has all nameto-ip address mappings local name servers: each ISP, company has local (default) name server host DNS query first goes to local name server authoritative name server: for a host: stores that host s IP address, name can perform name/address translation for that host s name From [Kurose/Ross] Networking Basics 42
DNS: Root name servers contacted by local name server that can not resolve name root name server: contacts authoritative name server if name mapping not known gets mapping returns mapping to local name server a NSI Herndon, VA c PSInet Herndon, VA d U Maryland College Park, MD g DISA Vienna, VA h ARL Aberdeen, MD j NSI (TBD) Herndon, VA k RIPE London i NORDUnet Stockholm m WIDE Tokyo e NASA Mt View, CA f Internet Software C. Palo Alto, CA b USC-ISI Marina del Rey, CA l ICANN Marina del Rey, CA 13 root name servers worldwide From [Kurose/Ross] Networking Basics 43
Simple DNS example root name server host surf.eurecom.fr wants IP address of gaia.cs.umass.edu 2 5 3 4 1. contacts its local DNS server, dns.eurecom.fr 2. dns.eurecom.fr contacts root name server, if necessary 3. root name server contacts authoritative name server, dns.umass.edu, if necessary local name server dns.eurecom.fr 1 6 requesting host surf.eurecom.fr authorititive name server dns.umass.edu gaia.cs.umass.edu From [Kurose/Ross] Networking Basics 44
DNS example root name server Root name server: may not know authoritative name server may know intermediate name server: who to contact to find authoritative name server local name server dns.eurecom.fr 1 2 8 requesting host surf.eurecom.fr 7 3 6 intermediate name server dns.umass.edu 4 5 authoritative name server dns.cs.umass.edu gaia.cs.umass.edu From [Kurose/Ross] Networking Basics 45
HTTP overview HTTP: hypertext transfer protocol Web s application layer protocol client/server model client: browser that requests, receives, displays Web objects server: Web server sends objects in response to requests HTTP 1.0: RFC 1945 HTTP 1.1: RFC 2068 PC running Explorer Mac running Navigator HTTP request HTTP response HTTP request HTTP response Server running Apache Web server From [Kurose/Ross] Networking Basics 46
HTTP overview (continued) Uses TCP: client initiates TCP connection (creates socket) to server, port 80 server accepts TCP connection from client HTTP messages (applicationlayer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server) TCP connection closed HTTP is stateless server maintains no information about past client requests aside Protocols that maintain state are complex! past history (state) must be maintained if server/client crashes, their views of state may be inconsistent, must be reconciled From [Kurose/Ross] Networking Basics 47
HTTP connections Nonpersistent HTTP At most one object is sent over a TCP connection. HTTP/1.0 uses nonpersistent HTTP Persistent HTTP Multiple objects can be sent over single TCP connection between client and server. HTTP/1.1 uses persistent connections in default mode From [Kurose/Ross] Networking Basics 48
HTTP request message two types of HTTP messages: request, response HTTP request message: ASCII (human-readable format) request line (GET, POST, HEAD commands) header lines GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu User-agent: Mozilla/4.0 Connection: close Accept-language:fr Carriage return, line feed indicates end of message (extra carriage return, line feed) From [Kurose/Ross] Networking Basics 49
HTTP request message: general format From [Kurose/Ross] Networking Basics 50
HTTP response message status line (protocol status code status phrase) data, e.g., requested HTML file header lines HTTP/1.1 200 OK Connection close Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998... Content-Length: 6821 Content-Type: text/html data data data data data... From [Kurose/Ross] Networking Basics 51
HTTP response status codes In first line in server->client response message. A few sample codes: 200 OK request succeeded, requested object later in this message 301 Moved Permanently requested object moved, new location specified later in this message (Location:) 400 Bad Request request message not understood by server 404 Not Found requested document not found on this server 505 HTTP Version Not Supported From [Kurose/Ross] Networking Basics 52
Cookies: keeping state Many major Web sites use cookies Four components: 1) cookie header line in the HTTP response message 2) cookie header line in HTTP request message 3) cookie file kept on user s host and managed by user s browser 4) back-end database at Web site Example: Susan access Internet always from same PC She visits a specific e- commerce site for first time When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for ID From [Kurose/Ross] Networking Basics 53
Cookies: keeping state (cont.) Cookie file ebay: 8734 client usual http request msg usual http response + Set-cookie: 1678 server server creates ID 1678 for user entry in backend database Cookie file amazon: 1678 ebay: 8734 one week later: usual http request msg cookie: 1678 usual http response msg cookiespecific action access access Cookie file amazon: 1678 ebay: 8734 usual http request msg cookie: 1678 usual http response msg cookiespectific action From [Kurose/Ross] Networking Basics 54
Cookies (continued) What cookies can bring: authorization shopping carts recommendations user session state (Web e-mail) aside Cookies and privacy: cookies permit sites to learn a lot about you you may supply name and e-mail to sites search engines use redirection & cookies to learn yet more advertising companies obtain info across sites From [Kurose/Ross] Networking Basics 55
Conditional GET: client-side caching Goal: don t send object if client has up-to-date cached version client: specify date of cached copy in HTTP request If-modified-since: <date> server: response contains no object if cached copy is upto-date: HTTP/1.0 304 Not Modified client HTTP request msg If-modified-since: <date> HTTP response HTTP/1.0 304 Not Modified HTTP request msg If-modified-since: <date> HTTP response HTTP/1.0 200 OK <data> server object not modified object modified From [Kurose/Ross] Networking Basics 56
Web caches (proxy server) Goal: satisfy client request without involving origin server user sets browser: Web accesses via cache browser sends all HTTP requests to cache object in cache: cache returns object else cache requests object from origin server, then returns object to client client HTTP request HTTP response HTTP request HTTP response Proxy server HTTP request HTTP response origin server client origin server From [Kurose/Ross] Networking Basics 57
More about Web caching Cache acts as both client and server Cache can do up-to-date check using If-modifiedsince HTTP header Issue: should cache take risk and deliver cached object without checking? Heuristics are used. Typically cache is installed by ISP (university, company, residential ISP) Why Web caching? Reduce response time for client request. Reduce traffic on an institution s access link. Internet dense with caches enables poor content providers to effectively deliver content From [Kurose/Ross] Networking Basics 58
More about Web caching Cache acts as both client and server Cache can do up-to-date check using If-modifiedsince HTTP header Issue: should cache take risk and deliver cached object without checking? Heuristics are used. Typically cache is installed by ISP (university, company, residential ISP) Why Web caching? Reduce response time for client request. Reduce traffic on an institution s access link. Internet dense with caches enables poor content providers to effectively deliver content From [Kurose/Ross] Networking Basics 59
Caching example (1) Assumptions average object size = 100,000 bits avg. request rate from institution s browser to origin serves = 15/sec delay from institutional router to any origin server and back to router = 2 sec Consequences utilization on LAN = 15% Traffic=100K*15 /sec=1.5mbps utilization on access link = 100% Very long delay (minutes) total delay = Internet delay + access delay + LAN delay = 2 sec + minutes + milliseconds institutional network public Internet 1.5 Mbps access link 10 Mbps LAN origin servers institutional cache From [Kurose/Ross] Networking Basics 60
Caching example (2) Possible solution increase bandwidth of access link to, say, 10 Mbps Consequences utilization on LAN = 15% utilization on access link = 15% Total delay = Internet delay + access delay + LAN delay = 2 sec + msecs + msecs but a costly upgrade institutional network public Internet 10 Mbps access link 10 Mbps LAN origin servers institutional cache From [Kurose/Ross] Networking Basics 61
Caching example (3) Install cache suppose hit rate is.4 Consequence 40% requests will be satisfied almost immediately 60% requests satisfied by origin server utilization of access link reduced to 60%, resulting in negligible delays (say 10 msec) total delay = Internet delay + access delay + LAN delay =.6*(2 sec +.01 secs + ms) + 0.4*ms) < 1.3 secs institutional network public Internet 1.5 Mbps access link 10 Mbps LAN origin servers institutional cache From [Kurose/Ross] Networking Basics 62
Content distribution networks (CDNs) The content providers are the CDN customers. Content replication CDN company installs hundreds of CDN servers throughout Internet in lower-tier ISPs, close to users CDN replicates its customers content in CDN servers. When provider updates content, CDN updates servers origin server in North America CDN distribution node CDN server CDN server in S. America CDN server in Asia in Europe From [Kurose/Ross] Networking Basics 63
CDN example 1 2 3 Origin server CDNs authoritative DNS server HTTP request for www.foo.com/sports/sports.html DNS query for www.cdn.com origin server www.foo.com distributes HTML Replaces: Nearby CDN server http://www.foo.com/sports.ruth.gif with http://www.cdn.com/www.foo.com/sports/ruth.gif HTTP request for www.cdn.com/www.foo.com/sports/ruth.gif CDN company cdn.com distributes gif files uses its authoritative DNS server to route redirect requests From [Kurose/Ross] Networking Basics 64
More about CDNs routing requests CDN creates a map, indicating distances from leaf ISPs and CDN nodes when query arrives at authoritative DNS server: server determines ISP from which query originates uses map to determine best CDN server not just Web pages streaming stored audio/video streaming real-time audio/video CDN nodes create application-layer overlay network From [Kurose/Ross] Networking Basics 65
What you should know Generic networks Two types of services: connection-oriented and connectionless Two types of switching (routing) Circuit switching and packet switching (datagram and VC) Internet uses datagram packet switching Internet structure and protocol layers Edges (workstations, servers), core (routers), physical links, coordinated by protocols Protocol layers of the Internet Application (HTTP, email), transport (TCP,UDP), network (IP), link, physical Networking Basics 66
What you should know Application layer functionalities and protocols Client-server model Makes use of underlying transport protocol How does DNS works? (how does your computer find the IP address of a desired destination?) Web applications Web browser and server in the client-server model HTTP (uses TCP, stateless, request and response) Pros and cons of using cookies Why using client-side caching? What are the trade-offs when determining the cache size? Why using a Proxy server? Why would a content provider use a CDN? Networking Basics 67