HOSTS statement
Use the HOSTS statement in the Name Service Switch (NSSwitch) configuration file to specify the
order in which the DNS or local files are to be used for host name resolution for IBM®
z/OS® Container Platform environments.
Note: The
z/OS UNIX file /etc/nsswitch.conf in the container’s filesystem namespace (if it exists), is used as
the NSSwitch configuration file.
Syntax
Parameters
- DNS
-
The domain name servers specified by the NAMESERVER statement is used for name resolution. The NAMESERVER statement can be specified in the z/OS UNIX file /etc/resolv.conf in the container’s filesystem namespace. For more information, see NAMESERVER statement.
- FILES
-
The local host file, /etc/hosts in the container’s filesystem namespace (if it exists), is used for name resolution.
Steps for modifying
You can refresh this statement using the MODIFY RESOLVER,REFRESH command. For more information about parameters used with the MODIFY command, see z/OS Communications Server: IP System Administrator's Commands.
Examples
In the following example, only the name servers are queried directly:
hosts: DNSIn the following example, only the local host tables are used:
hosts: FILESIn the following example, the local host tables are used first. If there is no resolution, then
the name servers are queried directly.
hosts: FILES DNSIn the following example, the name servers are queried directly. If there is no resolution, then
the local host tables are used next.
hosts: DNS FILES Usage notes
- If a HOSTS statement is not specified, the domain name servers are queried first, and if the resolution request is not successful, the local host file, if it exists, is used.
- If an incorrect parameter value is specified, the entire HOSTS statement is ignored.
- The last syntactically correct HOSTS statement is used.

