Chapter 2: Application layer 2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications 2.7 Socket programming with TCP 2.8 Socket programming with UDP 2.9 Building a Web server 2: Application Layer 1 DNS: Domain Name System People: many identifiers: SSN, name, passport # Internet hosts, routers: IP address (32 bit) used for addressing datagrams “name”, e.g., ww.yahoo.com - 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” 2: Application Layer 2 DNS DNS services hostname to IP address translation host aliasing Canonical, alias names mail server aliasing load distribution replicated Web servers: set of IP addresses for one canonical name Why not centralize DNS? single point of failure traffic volume distant centralized database maintenance doesn’t scale! 2: Application Layer 3 Distributed, Hierarchical Database Root DNS Servers com DNS servers yahoo.com amazon.com DNS servers DNS servers org DNS servers pbs.org DNS servers edu DNS servers poly.edu umass.edu DNS serversDNS servers Client wants IP for www.amazon.com; 1st approx: client queries a root server to find com DNS server client queries com DNS server to get amazon.com DNS server client queries amazon.com DNS server to get IP address for www.amazon.com 2: Application Layer 4 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 Verisign, Dulles, VA c Cogent, Herndon, VA (also LA) d U Maryland College Park, MD g US DoD Vienna, VA h ARL Aberdeen, MD j Verisign, ( 21 locations) e NASA Mt View, CA f Internet Software C. Palo Alto, k RIPE London (also 16 other locations) i Autonomica, Stockholm (plus 28 other locations) m WIDE Tokyo (also Seoul, Paris, SF) CA (and 36 other locations) 13 root name servers worldwide b USC-ISI Marina del Rey, CA l ICANN Los Angeles, CA 2: Application Layer 5 TLD and Authoritative Servers Top-level domain (TLD) servers: responsible for com, org, net, edu, etc, and all top-level country domains uk, fr, ca, jp. Network Solutions maintains servers for com TLD Educause for edu TLD Authoritative DNS servers: organization’s DNS servers, providing authoritative hostname to IP mappings for organization’s servers (e.g., Web, mail). can be maintained by organization or service provider 2: Application Layer 6 Local Name Server does not strictly belong to hierarchy each ISP (residential ISP, company, university) has one. also called “default name server” when host makes DNS query, query is sent to its local DNS server acts as proxy, forwards query into hierarchy 2: Application Layer 7 DNS name resolution example root DNS server 2 Host at cis.poly.edu 3 wants IP address for gaia.cs.umass.edu iterated query: contacted server replies with name of server to contact “I don’t know this name, but ask this server” TLD DNS server 4 5 local DNS server dns.poly.edu 1 8 requesting host 7 6 authoritative DNS server dns.cs.umass.edu cis.poly.edu gaia.cs.umass.edu 2: Application Layer 8 DNS name resolution example recursive query: root DNS server 2 puts burden of name resolution on contacted name server heavy load? 3 7 6 TLD DNS server local DNS server dns.poly.edu 1 5 4 8 requesting host authoritative DNS server dns.cs.umass.edu cis.poly.edu gaia.cs.umass.edu 2: Application Layer 9 DNS: caching and updating records once (any) name server learns mapping, it caches mapping cache entries timeout (disappear) after some time TLD servers typically cached in local name servers • Thus root name servers not often visited update/notify mechanisms under design by IETF RFC 2136 http://www.ietf.org/html.charters/dnsind-charter.html 2: Application Layer 10 DNS records DNS: distributed db storing resource records (RR) RR format: (name, Type=A name is hostname value is IP address Type=NS name is domain (e.g. foo.com) value is hostname of authoritative name server for this domain value, type, ttl) Type=CNAME name is alias name for some “canonical” (the real) name www.ibm.com is really servereast.backup2.ibm.com value is canonical name Type=MX value is name of mailserver associated with name 2: Application Layer 11 DNS protocol, messages DNS protocol : query and reply messages, both with same message format msg header identification: 16 bit # for query, reply to query uses same # flags: query or reply recursion desired recursion available reply is authoritative 2: Application Layer 12 DNS protocol, messages Name, type fields for a query RRs in response to query records for authoritative servers additional “helpful” info that may be used 2: Application Layer 13 SIP: Session Initiation Protocol [RFC 3261] SIP long-term vision: all telephone calls, video conference calls take place over Internet people are identified by names or e-mail addresses, rather than by phone numbers you can reach callee, no matter where callee roams, no matter what IP device callee is currently using Multimedia Networking 7-14 SIP Services Setting up a call, SIP provides mechanisms .. for caller to let callee know she wants to establish a call so caller, callee can agree on media type, encoding to end call Multimedia Networking determine current IP address of callee: maps mnemonic identifier to current IP address call management: add new media streams during call change encoding during call invite others transfer, hold calls 7-15 Alice Setting up a call to known IP address Alice’s SIP invite Bob 167.180.112.24 INVITE bob @193.64.2 10.89 c=IN IP4 16 7.180.112.2 4 m=audio 38 060 RTP/A VP 0 193.64.210.89 port 5060 port 5060 Bob's terminal rings 200 OK .210.89 c=IN IP4 193.64 RTP/AVP 3 3 m=audio 4875 ACK message indicates her port number, IP address, encoding she prefers to receive (PCM ulaw) Bob’s 200 OK message indicates his port number, IP address, preferred encoding (GSM) port 5060 SIP messages can be sent over TCP or UDP; here sent over RTP/UDP. m Law audio port 38060 GSM port 48753 default is 5060. Multimedia time Networking time SIP port number 7-16 Setting up a call (more) codec negotiation: suppose Bob doesn’t have PCM ulaw encoder. Bob will instead reply with 606 Not Acceptable Reply, listing his encoders Alice can then send new INVITE message, advertising different encoder Multimedia Networking rejecting a call Bob can reject with replies “busy,” “gone,” “payment required,” “forbidden” media can be sent over RTP or some other protocol 7-17 Example of SIP message INVITE sip:bob@domain.com SIP/2.0 Via: SIP/2.0/UDP 167.180.112.24 From: sip:alice@hereway.com To: sip:bob@domain.com Call-ID: a2e3a@pigeon.hereway.com Content-Type: application/sdp Content-Length: 885 c=IN IP4 167.180.112.24 m=audio 38060 RTP/AVP 0 Notes: HTTP message syntax sdp = session description protocol Call-ID is unique for every call. Multimedia Networking Here we don’t know Bob’s IP address. intermediate SIP servers needed. Alice sends, receives SIP messages using SIP default port 506 Alice specifies in header that SIP client sends, receives SIP messages over UDP 7-18 Name translation and user location caller wants to call callee, but only has callee’s name or e-mail address. need to get IP address of callee’s current host: user moves around DHCP protocol user has different IP devices (PC, PDA, car device) Multimedia Networking result can be based on: time of day (work, home) caller (don’t want boss to call you at home) status of callee (calls sent to voicemail when callee is already talking to someone) Service provided by SIP servers: SIP registrar server SIP proxy server 7-19 SIP Registrar when Bob starts SIP client, client sends SIP REGISTER message to Bob’s registrar server (similar function needed by Instant Messaging) Register Message: REGISTER sip:domain.com SIP/2.0 Via: SIP/2.0/UDP 193.64.210.89 From: sip:bob@domain.com To: sip:bob@domain.com Expires: 3600 Multimedia Networking 7-20 SIP Proxy Alice sends invite message to her proxy server contains address sip:bob@domain.com proxy responsible for routing SIP messages to callee possibly through multiple proxies. callee sends response back through the same set of proxies. proxy returns SIP response message to Alice contains Bob’s IP address Multimedia Networking 7-21 Example Caller jim@umass.edu with places a call to keith@upenn.edu SIP registrar upenn.edu 2 SIP proxy umass.edu SIP registrar eurecom.fr 3 4 (1) Jim sends INVITE message to umass SIP 1 5 7 proxy. (2) Proxy forwards 8 request to upenn 6 registrar server. 9 (3) upenn server returns SIP client 197.87.54.21 SIP client redirect response, indicating that it should 217.123.56.89 try keith@eurecom.fr (4) umass proxy sends INVITE to eurecom registrar. (5) eurecom registrar forwards INVITE to 197.87.54.21, which is running keith’s SIP client. (6-8) SIP response sent back (9) media sent directly between clients. Note: also a SIP ack message, which is not shown. Multimedia Networking 7-22