CSE 124 Networked Services Fall 2009 B. S. Manoj, Ph.D http://cseweb.ucsd.edu/ classes/fa09/cse124 10/6/2009 1 CSE 124 Networked Services Fall 2009 slides are adapted from various sources/individuals including but n om the text books by Kurose and Ross and Tanenbaum, and Google.com. slides other than for pedagogical purpose for CSE 124, may require e rom the respective sources.
CSE 124 Networked Services Fall 2009. B. S. Manoj, Ph.D http://cseweb.ucsd.edu/classes/fa09/cse124. Some of these slides are adapted from various sources/individuals including but not limited to the slides from the text books by Kurose and Ross and Tanenbaum, and Google.com. - PowerPoint PPT Presentation
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CSE 124Networked Services
Fall 2009B. S. Manoj, Ph.D
http://cseweb.ucsd.edu/classes/fa09/cse124
10/6/2009 1CSE 124 Networked Services Fall 2009
Some of these slides are adapted from various sources/individuals including but not limited to the slides from the text books by Kurose and Ross and Tanenbaum, and Google.com. Use of these slides other than for pedagogical purpose for CSE 124, may require explicit permissions from the respective sources.
Reminders• Week1-Homework
– Due by the Thursday, 8th October
• Programming Project-1 – Due by the Thursday, 23rd October
• Programming Project-2– Start thinking now– What services you might want – Not existing or not popularly existing today– Novel variations of existing protocols, architectures,
and services10/6/2009 2CSE 124 Networked Services Fall 2009
Application Layer Services: Domain Name System
• Provides many services including the name-to-address translation
• Why DNS– Names are easy for human reading, however, IP addresses are
required for Internet routers
• In original ARPANET,– hosts.txt file contained host-to-address translation– A central server maintained and managed the changes in
Non-authoritative answer:docs.google.com canonical name = writely.l.google.com.Name: writely.l.google.comAddress: 66.102.7.139>PING google.com (74.125.67.100) 56(84) bytes of data.64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=1 ttl=46 time=88.9 ms64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=2 ttl=46 time=88.8 ms
10/6/2009 6CSE 124 Networked Services Fall 2009
Mnemonic domain name
Canonical domain name
Service Aliasing• DNS can also be used for service aliasing
– e.g., mail services aliasing– IP address aliasing– SRV extensions
• Mail services are typically not provided by the web server
• Web server is more popular than mail servers (www.microsoft.com) – It is better served when associated with the same server name for both– [email protected] is better than
– 13 of them (10 in US, 2 in Europe, and 1 in Asia), each is a collection of servers– Do not maintain A records– Maintain records for locating Top level DNS servers
• Top level domain (TLD) DNS servers– Do not maintain A records– Responsible for the top level domains such as .com, .org, .edu etc – Also responsible for the country level domains such as .us, .uk, .no, .jp, .cn, etc. – More than 258 domains exist today, (likely to grow even further)
• Authoritative DNS server– Provided by the organization which hosts the web servers and hosts– Maintains A record for many hosts (in some cases there may be hierarchy of aDNS
servers)– Either hosted within the organization or through a DNS service provider
• Local DNS server– Plays the intermediary role between client and the hierarchy of DNS servers– Not part of the hierarchy of the DNS
10/6/2009 12CSE 124 Networked Services Fall 2009
How DNS works• A client calls resolver function
– A software library that implements the DNS client in an end-user machine
– Resolver sends a DNS query message to its local DNS (LDNS) server
– LDNS replies immediately if it has a cached information available
– If LDNS does not have the IP address, then it tries• First the root DNS servers• Then the general TLD servers• Then one or more of the authoritative DNS servers
10/6/2009 13CSE 124 Networked Services Fall 2009
DNS APIs• For unix-based systems, the client calls
– struct hostent *gethostbyname(const char *name); • returns a structure of type hostent for the given host name.• Name is a character array contains the host name
– struct hostent *gethostbyaddr(const char *addr, int len, int type);
• Used for reverse lookup (IP address to hostname)
– struct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ int h_addrtype; /* host address type */ int h_length; /* length of address */ char **h_addr_list; /* list of addresses */ } 10/6/2009 14CSE 124 Networked Services Fall 2009
A client side code example……int sfd;struct sockaddr_un addr; char host_name[256]; struct hostent *host_addr;sprintf(host_name,”www.google.com”); /* copies the name to the host_name array*/
DNS resource record types• A Resource Record (RR) is a basic data element in a DNS database• DNS server stores different types of RRs• Each RR corresponds to a set of information for a particular service
DNS provides• A record consists of multiple values that contains {Name, TTL, Class,
Type, Value}
10/6/2009 17CSE 124 Networked Services Fall 2009
DNS record types• Record: {Name, Value, Class, Type, TTL}
• Type A: Name=Hostname, Value= IP address, TTL=time to live– Type A record gives hostname-to-address resolution– E.g; {cseweb.ucsd.edu, 132.239.51.6, A, 19800}
• Type NS: Name=domain (e.g., google.com), Value = address of the authoritative DNS (aDNS) server – aDNS server can help with resolution of hostnames in the domain
• Type CNAME: Name=hostname, Value=canonical host name for hostname– Provides hostname aliasing service– e.g., {docs.google.com, writely.l.google.com, CNAME}
• Type MX: Name=hostname, Value=canonical name of the mail server associated with the hostname– e.g., {ucsd.edu, mail-jsoe.ucsd.edu, MX}10/6/2009 18CSE 124 Networked Services Fall 2009
An estimate of DNS queries (2003)
• Organizations managing rDNS servers report 100s of millions of queries per day
• Traces from F-root server– San Francisco and Palo Alto– 4 root server machines– 152 million queries/24 hours
10/6/2009 19CSE 124 Networked Services Fall 2009Source: D. Wessels and M. Fomenkov, “WoW, That’s a lot of packets,” ACM PAM 2003
CSE 124 Networked Services Fall 2009 20
DNS protocol, messagesDNS protocol : query and reply messages, both with same message format
msg headeridentification: 16 bit # for
query, reply to query uses same #
flags: query or reply recursion desired recursion available reply is authoritative
10/6/2009
DNS query flags
10/6/2009 CSE 124 Networked Services Fall 2009 21
CSE 124 Networked Services Fall 2009 22
DNS protocol, messages
Name, type fields for a query
RRs in responseto query
records forauthoritative servers
additional “helpful”info that may be used
10/6/2009
CSE 124 Networked Services Fall 2009 23
Inserting records into DNS• example: new startup “Network Utopia”• register name networkuptopia.com at DNS registrar (e.g.,
Network Solutions)– provide names, IP addresses of authoritative name server (primary
and secondary)– registrar inserts two RRs into com TLD server:
(networkutopia.com, dns1.networkutopia.com, NS)(dns1.networkutopia.com, 212.212.212.1, A)
• Similarly, create authoritative server Type A record for www.networkuptopia.com; Type MX record for networkutopia.com
10/6/2009
DNS Performance optimization services
• Not originally intended • However, today it is a very important service• Main performance optimization– Load Distribution– Provisioning Reliability– Content Distribution network services• Load distribution – DNS is used to provide load balancing among multiple servers that serve
the same domain– Many popular web servers use server replication– A set of IP addresses is associated with a canonical name– When a client queries, DNS server replies with the entire set of IP
addresses– Each client makes use of the first IP address in the set– The set of IP addresses is rotated in order when subsequent request– Therefore, the load is almost equally balanced among the set of servers
10/6/2009 24CSE 124 Networked Services Fall 2009
An example >docs.google.comServer: 132.239.0.252Address:
• DNS is effectively used to provide content distribution services
• When a client queries for an address of a host, the DNS server provide the name of a CDN
• The CDN’s DNS replies with the address of the web cache nearest to the client’s location
• The client receives content from a nearby Web cache than the main web server– Quick response– Better load balancing– High server scalability10/6/2009 26CSE 124 Networked Services Fall 2009
CDN example
origin server (www.cnn.com)• distributes HTML• replaces: http://www.cnn.com/sports.ruth.gif
with
http://www.cdn.com/www.cnn.com/sports/ruth.gif
HTTP request for
www.cnn.com/sports/sports.html
DNS query for www.cdn.com
HTTP request for
www.cdn.com/www.cnn.com/sports/ruth.gif
1
2
3
origin server
CDN’s authoritative DNS server
CDN server near client
CDN company (cdn.com)• distributes gif files• uses its authoritative
DNS server to route redirect requests
client
10/6/2009 27CSE 124 Networked Services Fall 2009
Additional sources• Domain names are sold by domain name registrars
– Very competitive business models exist for domain names– Domain names are one of the most sought after real-estates in the
web today– Some simple names are worth several millions
• Important– When you register valuable names, register for longer duration
• Internet Corporation of Assigned Names and Numbers (ICANN)– Responsible for accrediting various domain name registrars
• http://www.internic.net/– For the list of accredited registrars
10/6/2009 28CSE 124 Networked Services Fall 2009
Attacks on DNS• Distributed Denial of Service
– Bandwidth flooding or resource consumption– Flooding Ping messages
• Distributed DNS query attack
• Man-in-the middle attack– Capture DNS queries and generate bogus DNS replys
• DNS poisoning– Erroneously populate the DNS caches by originating bogus replys
• Reflection attacks against hosts by – Generate spoofed DNS queries and thus create large number of replys– Targetting a host with DSN replys – Querys can be ANY? So that replys will be bigger packets
10/6/2009 29CSE 124 Networked Services Fall 2009
Summary of DNS
• DNS is an important service on Internet• Every other service depends on it• DNS is scalable, distributed, hierarchical, and
federated• Many performance optimization strategies are