correctly.

trim options accumulate; you can consider your host as being local to several domains.

A sample file for vlager is shown in Example 6.1.

Example 6.1: Sample host.conf File

# /etc/host.conf

# We have named running, but no NIS (yet)

order bind,hosts

# Allow multiple addrs

multi on

# Guard against spoof attempts

nospoof on

# Trim local domain (not really necessary).

trim vbrew.com.

Resolver environment variables

The settings from host.conf may be overridden using a number of environment variables:

RESOLV_HOST_CONF

This variable specifies a file to be read instead of /etc/host.conf.

RESOLV_SERV_ORDER

This variable overrides the order option given in host.conf. Services are given as hosts, bind, and nis, separated by a space, comma, colon, or semicolon.

RESOLV_SPOOF_CHECK

This variable determines the measures taken against spoofing. It is completely disabled by off. The values warn and warn off enable spoof checking by turning logging on and off, respectively. A value of * turns on spoof checks, but leaves the logging facility as defined in host.conf.

RESOLV_MULTI

This variable uses a value of on or off to override the multi options from host.conf.

RESOLV_OVERRIDE_TRIM_DOMAINS

This variable specifies a list of trim domains that override those given in host.conf. Trim domains were explained earlier when we discussed the trim keyword.

RESOLV_ADD_TRIM_DOMAINS

This variable specifies a list of trim domains that are added to those given in host.conf.

The nsswitch.conf File

Version 2 of the GNU standard library includes a more powerful and flexible replacement for the older host.conf mechanism. The concept of the name service has been extended to include a variety of different types of information. Configuration options for all of the different functions that query these databases have been brought back into a single configuration file; the nsswitch.conf file.

The nsswitch.conf file allows the system administrator to configure a wide variety of different databases. We'll limit our discussion to options that relate to host and network IP address resolution. You can easily find more information about the other features by reading the GNU standard library documentation.

Options in nsswitch.conf must appear on separate lines. Fields may be separated by whitespace (spaces or tabs). A hash sign (#) introduces a comment that extends to the next newline. Each line describes a particular service; hostname resolution is one of these. The first field in each line is the name of the database, ending with a colon. The database name associated with host address resolution is hosts. A related database is networks, which is used for resolution of network names into network addresses. The remainder of each line stores options that determine the way lookups for that database are performed.

The following options are available:

dns

Use the Domain Name System (DNS) service to resolve the address. This makes sense only for host address resolution, not network address resolution. This mechanism uses the /etc/resolv.conf file that we'll describe later in the chapter.

files

Search a local file for the host or network name and its corresponding address. This option uses the traditional /etc/hosts and /etc/network files.

nis or nisplus

Use the Network Information System (NIS) to resolve the host or network address. NIS and NIS+ are discussed in detail in Chapter 13, The Network Information System.

The order in which the services to be queried are listed determines the order in which they are queried when attempting to resolve a name. The query-order list is in the service description in the /etc/nsswitch.conf file. The services are queried from left to right and by default searching stops when a resolution is successful.

A simple example of host and network database specification that would mimic our configuration using the older libc standard library is shown in Example 6.2.

Example 6.2: Sample nsswitch.conf File

# /etc/nsswitch.conf

#

# Example configuration of GNU Name Service Switch functionality.

# Information about this file is available in the `libc6-doc' package.

hosts: dns files

networks: files

This example causes the system to look up hosts first in the Domain Name System, and the /etc/hosts file, if that can't find them. Network name lookups would be attempted using only the /etc/networks file.

You are able to control the lookup behavior more precisely using 'action items' that describe what action to take given the result of the previous lookup attempt. Action items appear between service specifications, and are enclosed within square brackets, []. The general syntax of the action statement is:

[[!] status = action…]

There are two possible actions:

return

Controls returns to the program that attempted the name resolution. If a lookup attempt was successful,

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату