irs.conf File

Purpose

Specifies the ordering of certain name resolution services.

Description

The /etc/irs.conf file is used to control the order of mechanisms that the resolver libraries use in searching for network-related data. The following subroutines resolve host names, networks, services, protocols, and netgroups:

Network Data Subroutines
host names gethostbyname, gethostaddr, gethostent
networks getnetbyname, getnetbyaddr, getnetent
services getservbyname, getservbyaddr, getservent
protocols getprotobyname, getprotobyaddr, getprotoent
netgroups getnetgrent

Because these subroutines are commonly used in many TCP/IP applications, using the irs.conf file can control the directions of the queries made by these applications as well.

By default, the subroutines use the lookup mechanisms to resolve host names in this order:

  1. Domain Name Server (DNS)
  2. Network Information Service (NIS), if active
  3. local files

By default, the subroutines use the lookup mechanisms to resolve networks in this order:

  1. DNS
  2. NIS, if active
  3. local files

By default, the subroutines use the lookup mechanisms to resolve other maps in this order:

  1. NIS, if active
  2. local files

You can override the default order by modifying the /etc/irs.conf configuration file and specifying the desired ordering.

The settings in the /etc/netsvc.conf configuration file override the settings in the /etc/irs.conf file. The NSORDER environment variable overrides the settings in the /etc/irs.conf and the /etc/netsvc.conf files.

To use DNS to obtain information concerning netgroups, protocols, and services, you must create and use a Hesiod DNS Zone in the following format:

map mechanism [option]

The following values are available for the map parameter:

Value Description
services Lists the port numbers, transport protocols, and names of well-known services
protocols Retrieves official names and protocol numbers of protocol aliases
hosts Defines the mappings between host names and their IP addresses
networks Retrieves network names and addresses
netgroup Retrieves groups of hosts, networks, and users in this group

The following values are available for the mechanism parameter:

Value Description
local Examines local configuration files (/etc/hosts, /etc/protocols, /etc/services, /etc/netgroup, and /etc/networks files)
dns Queries DNS; the /etc/resolv.conf file must be configured for this mechanism to work.
nis Queries NIS; the NIS client must be active on the system for this mechanism to work.
nis+ Queries NIS+; The NIS+ client must be active on the system for this mechanism to work.
ldap Queries the LDAP server; the resolv.ldap file must be configured for this mechanism to work.
Note: You can only assign the value hosts to the map parameter for ldap. Although still supported, the use of the ldap mechanism is deprecated. Use of the nis_ldap mechanism is recommended.
nis_ldap Queries the LDAP server configured in the ldap.cfg file. The LDAP client should be set up on the system using mksecldap command, to use this mechanism. All map types are supported by nis_ldap.
local4 Examines local configuration files for IPv4 addresses.
local6 Examines local configuration files for IPv6 addresses.
dns4 Queries DNS for A records (IPv4 addresses); the /etc/resolv.conf file must be configured for this mechanism to work.
dns6 Queries DNS for AAAA records (IPv6 addresses); the /etc/resolv.conf file must be configured for this mechanism to work.
nis4 Queries NIS for information about IPv4 addresses; the NIS client must be active on the system to use this mechanism.
nis6 Queries NIS for information about IPv6 addresses; the NIS client must be active on the system to use this mechanism.
ldap4 Queries the LDAP server for information about IPv4 addresses.
ldap6 Queries the LDAP server for information about IPv6 addresses.

The following values are available for the option parameter:

Value Description
continue If the information is not found in the specified mechanism, then instructs the resolver to continue to the next line, which should list another mechanism for the same map
merge Merges all responses from multiple mechanism parameters into one response

Examples

  1. To use only the local /etc/hosts file for host name resolution, enter:
    hosts local
  2. To use the LDAP server to resolve a host name that cannot be found in the the /etc/hosts file, enter:
    hosts local continue
    hosts ldap
  3. To use only DNS to resolve host names and to use NIS to resolve protocols, enter:
    hosts dns
    protocols nis
  4. To use only NIS to resolve host name addresses and netgroups and to use the local files to resolve services and networks, enter:
    hosts nis
    services local
    netgroup nis
    networks local
  5. To try to resolve host names from the local /etc/hosts file and, after not finding them, try to resolve from DNS, then NIS, enter:
    hosts local continue
    hosts dns continue
    hosts nis continue
  6. To try to resolve host names from the local /etc/hosts file, merge any information found with any DNS information found, and then merge this information to any NIS information found, enter:
    hosts local merge
    hosts dns merge
    hosts nis

    If the resolver finds no information, it returns none. If it finds information from more than one source, it returns that information as a merged response from all of the available sources.

  7. To examine the local /etc/services file for port numbers before querying NIS, enter:
    services local continue
    services nis
    

    This entry in the /etc/irs.conf file could speed up the request; normally, querying NIS takes more time than querying the local file. If the resolver does not find the information in the local file, it searches NIS.

  8. To query for IPv4 network addresses only from DNS and to query IPv6 host addresses only from the local file, enter:
    networks dns4
    hosts local6
  9. In this example, assume the following presuppositions:
    • The /etc/hosts file contains the following information:
      1.2.3.4 host4
      1.2.3.5 host5
      1.2.3.6 host6
    • The information in DNS is the following:
      1.2.3.2 host2
      1.2.3.3 host3
    • The information in NIS is the following:
      1.2.3.1 host1

    To instruct the gethostbyname subroutine to look for the host name first in the local configuration files, then to continue to search in DNS if the host name is not found, and finally to continue searching in NIS if the host name is not found, create the following entry in the /etc/irs.conf file:

    hosts local continue
    hosts dns continue
    hosts nis

    In this example, the gethostbyname subroutine cannot find the host name in the /etc/hosts file and continues to search for the host name in DNS. After not finding it in DNS, it continues to search in NIS. After finding the address in NIS, it returns 1.2.3.1.

  10. In this example, assume the following presuppositions:
    • The /etc/hosts file contains the following information:
      1.1.1.1 hostname
    • The information in DNS is the following:
      1.1.1.2 hostname

    To instruct the gethostbyname subroutine to merge all the answers from the specified mechanisms into one reply, create the following entry in the /etc/irs.conf file:

    hosts local merge
    hosts dns

    The gethostbyname subroutine returns 1.1.1.1 1.1.1.2.

Files

Item Description
/etc/hosts Contains the Internet Protocol (IP) name and addresses of hosts on the local network
/etc/protocols Contains official names and protocol numbers of protocol aliases
/etc/services Contains lists of the port numbers, transport protocols, and names of well-known services
/etc/netgroup Contains a list of groups of hosts, networks, and users in these groups
/etc/networks Contains a list of network names and addresses
/etc/resolv.conf Contains Domain Name Protocol (DOMAIN) name-server information for local resolver subroutines
/etc/netsvc.conf Specifies the ordering of certain name resolution services
/etc/resolv.ldap Contains the IP address of the LDAP server