ECE 4321 Computer Networks Network Programming
Name Space System.Net
Domain Name System (DNS) To resolve computer naming Host database is split up and distributed among multiple systems on the Internet Uses a hierarchical database approach Provides means for clients to query the database in real time
DNS Hierarchy (Root) Stay Nameless.com.edu.org.uk.cnn.umn.smallorg.tpcs.acc
Who controls DNS? In the past, the Internic Corporation controlled all US domain names in the.com,.net, and.org Today, a nonprofit organization, the Internet Corporation for Assigned Names and Numbers (ICANN) is responsible Domain names can be purchased from multiple vendors, but all domain names must be cleared by the ICANN for use in the US domain
Finding a Hostname in DNS Search a host within the local domain Search a remote host whose name is not on the local server Search a remote host whose name is on the local DNS server cache root Remote host Local
DNS Database Each DNS server is responsible for keeping track of the hostnames in its zone Each DNS server must store host information in a database that can be queried by remote machines DNS database is a text file that consists of resource records(rrs) for host and network functions in the zone DNS server communicates the DNS information with the root and remote DNS servers
DNS Server s Database Local domain definition Each registered host in the domain Common nicknames for hosts in the domain Special services, such as DNS servers and mail servers
Core DNS Database Records Record Type SOA A NS CNAME HINFO MX PTR Description Start of Authority Internet address Name server Canonical name (nickname) Host information Mail server Pointer (IP address)
SOA Each database starts with a SOA record that defines the zone in which the database resides domain name [TTL] [class] SOA origin person ( serial number refresh retry expire minimum)
DNS database records (1) Internet Address Record (A) Each host in the zone host [TTL] [class] A address Canonical Name Record (CNAME) Nickname of the host nickname [TTL] [class] CNAME hostname Name Server Record (NS) Each zone must have at least two DNS which are defined by NS domain [TTL] [class] NS server
DNS database records (2) Host Information Record (HINFO) Additional host information host [TTL] [class] HINFO hardware software Pointer Record (PTR) Used for reverse queries from IP address IN-ADDR name [TTL] [class] PTR hostname Mail Exchange Record (MX) Instructs remote mail servers where to forward mail for the domain name [TTL] [class] MX preference host
Sample DNS Database Entries smallorg.org IN SOA master.isp.net. Postmaster.master.isp.net postmaster.master.isp.net ( 1999080501 ;unique serial number 8H ; refresh rate 2H ; retry period 1W ; expiration period 1D ) ; minimum NS ns1.isp.net. ;defines primary nameserver NS ns2.isp.net. ; defines secondary nameserver MX 10 mail1.isp.net ;defines primary mailsever MX 20 mail2.isp.net ; defines secondary mail server www CNAME host1.isp.net ;defines a www server at the ISP ftp CNAME host1.isp.net ;defines a ftp server at the ISP host1.isp.net A 10.0.0.1 1.0.0.10.IN-ADDR.ARPA PTR host1.isp.net ;pointer for reverse DNS
DNS test > ping ub.d.umn.edu When you get a response without timeout, it means the IP address was successfully resolved > nslookup www.microsoft.com
DNS Clients UNIX: /etc/hosts WINDOWS C:\WINDOWS\SYSTEM32\DRIVERS\ETC Hosts networks Protocol Services If DHCP is used, dns data is in registry. RegistryKey start = Registry.LocalMachine; String DNSservers = @ SYSTEM\CurrentControlSet\Services\Tcpip\Parameters ; RegistryKey DNSserverKey = start.opensubkey(dnsservers); String serverlist = (string) DNSserverKey.GetValue( NameServer )
DNS Classes System.net contains DNS classes Synchronous methods GetHostName() ;to lookup hostname of local system GetHostByName() ;to lookup Ip by hostname GetHostByAddress() ;to lookup host by address Resolve() ;lookup either by ip or hostname Asynchronous methods BeginGetHostByName() BeginResolve() EndGetHostByName() EndResolve()
Required Reading Rfc on dns