# In this script, we will first learn about the ‹host› utility, # which does basic DNS resolution for us. For instance, we can ask # what is the IP address of ‹aisa› like this: host aisa.fi.muni.cz. # We can also use the shorthand, since we are in the same domain: host aisa # This has some interesting consequences: host www # What do you think the last query means? # Besides translating names to addresses, DNS can also go the other # way: give a hostname for a numeric address. We can simply pass the # IP address to the ‹host› utility, like this: host 4.2.2.2 # This uses some magic behind the curtain (though the magic also # leaks into the user interface some). There is a special domain # called in-addr.arpa, which has subdomains for all the possible IP # addresses -- in reverse. So when we ask ‹host› to find the name # for ‹4.2.2.2›, it is in fact looking for ‹2.2.2.4.in-addr.arpa.› # There's magic involved because the normal recursion rules don't # quite work in this domain. Nonetheless, there are DNS records (of # type ‹PTR›) and they contain the ‘canonic‘ hostname of the # computer that lives at the given IP address. You usually want the # name to resolve back to the same IP address. # In fact, let's refresh our shell scripting skills with an exercise # (in ‹1.txt›). After that, we'll look at ‹dig› which is another DNS # tool and then we'll move on to ‹nc›.