Dns
net_dns¶
Get the DNS server addresses for the current host. Tries a range of methods in order: scutil (macOS), resolvectl, systemd-resolve, nm-tool, nmcli, host, and finally parsing /etc/resolv.conf or /var/run/resolv.conf.
Exit codes¶
- 0: Success
- 1: Unable to determine any DNS servers
Output on stdout¶
- Comma-separated DNS server IP addresses
net_dns_resolve¶
Resolve a hostname to an IPv4 address, or reverse-resolve an IP to its hostname. Uses 'host -4' for lookups.
Arguments¶
- $1 (string): Hostname or IPv4 address to look up
Exit codes¶
- 0: Success
- 1: No argument supplied or unrecognised input
Output on stdout¶
- The resolved IP address, or the hostname from a reverse lookup