s6-dns: the s6-dnsname program
Keywords: s6-dns client s6-dnsname dnsname domain name ip address ipv4 ipv6

s6-dns
Software
skarnet.org

# The s6-dnsname program

s6-dnsname finds the name associated to an IPv4 or IPv6 address.

## Interface

         s6-dnsname [ -4 | -6 ] [ -H | -h ] [ -r ] [ -t timeout ] ip

- s6-dnsname converts the IP address ip to a name ending in `in-addr.arpa.` or `ip6.arpa.` then makes a PTR query for this name. It waits for the result and prints the obtained names, one per line, then exits 0.
- If the domain exists but no relevant field has been found, it exits 1.
- If the DNS answered but no answer is available, it prints a relevant error message and exits 2.
- By default, s6-dnsname looks for DNS cache addresses in the `/etc/resolv.conf` file. If the DNSCACHEIP environment variable is set and contains a list of IP (v4 or v6) addresses, separated by commas, semicolons, spaces, tabs, newlines or carriage returns, then this list is used instead.

## Options

- `-4` : interpret ip as an IPv4 address.
- `-6` : interpret ip as an IPv6 address. If neither of the `-4` and `-6` is given, or if both are given, then ip will be interpreted as v4 or v6 depending on its syntax.
- `-H` : do not use data from `/etc/hosts`. This is the default.
- `-h` : use data from `/etc/hosts`, if available. If there's a compiled `/etc/hosts.cdb` file that is newer than `/etc/hosts`, it will be used instead. (See s6-dns-hosts-compile for details.) If the lookup in the hosts database returns at least one result, then no DNS lookup is performed.
- `-r` : random. By default, the program does not sort the result, but prints them in the order received from the DNS. With this option, it performs a random permutation on the results before printing them.
- `-t` timeout : if the resolution takes more than timeout milliseconds, then it exits 99 right away with an error message. By default, timeout is 0, which means no timeout.

## Notes

- If the underlying skalibs has been compiled with IPv6 support disabled, s6-dnsname will not be able to use IPv6 transport for its resolution, but it will still accept and resolve IPv6 addresses.