www.realprogrammers.comhas an A record containing an IP address, say, 126.96.36.199. A web browser can look for an A record, be told an IP address and from that it can attempt to connect to it.
hostcommand. Many are familiar with
nslookuphowever this program has been deprecated in favor of
dig, which we'll see shortly.
$ host www.realprogrammers.com www.realprogrammers.com A 188.8.131.52 $Nothing too surprising there.
$ host -t mx yahoo.com yahoo.com MX 5 mx4.mail.yahoo.com yahoo.com MX 1 mx1.mail.yahoo.com yahoo.com MX 1 mx2.mail.yahoo.com $We see that yahoo.com has apparently three mail servers of which two are considered primary since they have the higher (numerically lower) priority. Now, in order to actually deliver the mail, the delivering server still needs to know the IP address of that server, in other words it has to lookup an A record.
However, upon closer inspection of one such A record we discover,
$ host mx1.mail.yahoo.com mx1.mail.yahoo.com A 184.108.40.206 mx1.mail.yahoo.com A 220.127.116.11 mx1.mail.yahoo.com A 18.104.22.168 $
mx1.mail.yahoo.comhas three IP addresses! So yahoo.com has many more than three possible destinations for its mail. How does it choose? The name server being asked for the IP addresses returns a single address for each query, one after the other. Once it has returned the last of its collection it starts at the beginning again. This is referred to as round robin DNS, and can be used as a simple way to distribute access to a number of servers. Round Robin can as equally be used for webservers as mail servers, or any job where spreading connections across multiple addresses may be useful.
$ host -t ns realprogrammers.com realprogrammers.com NS ns1.granitecanyon.com realprogrammers.com NS ns2.granitecanyon.com realprogrammers.com NS ns2.realprogrammers.com realprogrammers.com NS ns3.realprogrammers.com realprogrammers.com NS ns5.realprogrammers.com realprogrammers.com NS ns0.realprogrammers.com $Again, like an MX record, a further A record query is required to find the actual IP address, or indeed addresses. NS records are also returned to querying clients in a round robin fashion.
$ host -t soa paulm.com paulm.com SOA tantrix.realprogrammers.com hostmaster.realprogrammers.com ( 2002021203 ;serial (version) 10800 ;refresh period (3 hours) 3600 ;retry interval (1 hour) 604800 ;expire time (1 week) 86400 ;default ttl (1 day) ) $The
paulm.comdomain we learn lives on
tantrix.realprogrammers.com, the contact address is firstname.lastname@example.org, and well, a bunch of other stuff :-)