Le cache DNS AIX est géré par le démon 'netcd'.

Pour afficher l'état du démon, lancer la commande 'lssrc -s netcd'.

Pour activer le cache pour les résoluation DNS, il suffit de créer le fichier /etc/netcd.conf avec la ligne suivante :

cache dns hosts 128 60

Cela indique que les requête de type DNS doivent être mise en cache avec une durée de rétention de 60 minutes jusqu'à 128 entrées.

Pour lancer le service, utiliser la commande 'startsrc -s netcd'.

A noter que le service est lancé au boot depuis le fichier '/etc/rc.tcpip'. 

Pour activer le lancement en permanence, utiliser la commande : '/usr/sbin/chrctcp -S -a netcd'.

Si vous souhaitez vérifier le contenu du cache DNS pour AIX, utiliser la commande :

netcdctrl -t dns -e hosts -a /tmp/cacheDNS.log

Cette commande remplit le fichier /tmp/cacheDNS.log avec le contenu du cache.

 

Exemple :

netcdctrl -t dns -e hosts -a /tmp/cacheDNS.log ; cat /tmp/cacheDNS.log

CACHE dns, hosts, name
>>>>>>>>>>>>>>>>>>>>>>>>>>>> ELEM #1
Expiration date : Mon Jun 2 20:05:41 2015
Ulm or resolver name : dns
Query type : 10100002
Query length : 9
Answer (0: positive; 1 : negative) : 0
Query key : 1211245064
String used in query : yahoo.com
Additional parameters in query:
query param1 : 2
query param2 : 0
Length of cached element : 35
################### hostent
Number of aliases = 0
Number of addresses = 2
Type = 2
Length = 4
Host name = yahoo.com
Alias =
Address = 68.180.206.184
Address = 206.190.60.37
#################### end of hostent
>>>>>>>>>>>>>>>>>>>>>>>>>>>> END ELEM #1

END CACHE dns, hosts, name
CACHE dns, hosts, address
END CACHE dns, hosts, address

 

Ci-dessous la documentation IBM sur le format du fichier netcd.conf:

Purpose

Defines parameters for the netcd daemon.

Description

The /etc/netcd.conf file is the default configuration file for the netcd daemon. This file is part of TCP/IP in Network Support Facilities.

To change the /etc/netcd.conf file, run the stopsrc -s netcd command and then the startsrc -s netcd command. The netcd.conf file specifies the map resolvers that are cached, and supplies parameters to the netcd daemon.

A template of the netcd.conf file is provided in the /usr/samples/tcpip directory.

AttentionFurther installations can overwrite the /usr/samples/tcpip/netcd.conf file. You can copy this file to another location and use it as a template to create your customized netcd configuration.

If you do not use any configuration files, the netcd daemon proceeds with the default values indicated later in this section.

There are 4 types of declarations (a declaration or statement being a line starting with one of the keywords followed by parameters):
  • cache description declarations (keyword - cache)
  • security declarations (keywords - ownergroup and home_dir)
  • log file declarations (keywords - log_filelog_rotate, and log_size)
  • additional declarations to control the netcd daemon (keywords - net_scan_frequencylocal_scan_frequency, and socket_queue_size)

Syntax

The general syntax is a string of characters that follows one or more spaces or tabs that follow the keyword, as shown in the following example:
cache  <space><space><tab><tab>  dns <space><space>  local  <tab><tab>  fooCopy

The syntax for each individual keyword is described in the following sections.

Cache description declarations

Syntax

cache <type_of_cache> <type_of_map> <hash_size> <cache_ttl>

0 to n cache declarations describe what is cached. If no such line is specified, the default line is cache all all 128 60.

The type_of_cache parameter can have the following values:
  • local - local resolver
  • dns - DNS resolver
  • nis - nis resolver
  • nisplus - nisplus resolver
  • yp - yellow pages services
  • ulm - other resolvers that you are using on your machine (if any)
  • all - localdnsnisnisplusulm, and yp for the type_of_cache parameter
  • a ulm name - the name of a specific resolver other than localdnsnis, and nisplus that you installed
Any string other than localdnsnisnisplus, yp, ulm, and all is taken as a ulm name. You can declare up to 16 ulms.
The type_of_map parameter can have the following values:
  • hosts - hosts map type of the resolver
  • protocols - protocols map type of the resolver
  • services - services map type of the resolver
  • networks - networks map type of the resolver
  • netgroup - netgroup map type of the resolver
  • all - all map types applicable for the type_of_map parameter that you specified
  • a yp map name - the name of a yellow page service from the list passwd.byname, passwd.byuid, group.byname, group.bygid, netid.byname, and passwd.adjunct.byname
The map types supported for localnisnisplus and ulm resolutions are hostsservicesnetworksprotocols and netgroup. For the dns cache, hosts is the only map supported.

The maps supported for yp are passwd.bynamepasswd.byuidgroup.bynamegroup.bygidnetid.byname, and passwd.adjunct.byname.

The hash_size parameter specifies the number of lines for the cache (a cache is a hash table). The default value is 128.

The cache_ttl parameter specifies the length of time during which an entry is kept in the cache. Its unit is minute. The value of 0 is infinite; the default value is 60. The cache_ttl parameter is not taken into account for local caches. For dns, it is not suggested to specify a non-null value, because if you specify a non-null value, it overwrites the DNS time-to-live (TTL) sent back when DNS finds the entry. Otherwise, each entry is kept in the cache for the duration of the TTL that the DNS specifies.

Security declarations

The three following declarations allow the netcd daemon to run in the secure mode (for example, security against code execution because of stack overflow):

ItemDescription
owner <value> Specifies the owner of the netcd daemon during its execution. The default value is root.
group <value> Specifies the group owner of the netcd daemon during its execution. The default value is system.
home_dir <value> Specifies the working directory for the netcd daemon during its execution. The default value is /.

Log file declarations

ItemDescription
log_file <file> Specifies the name of the log file for the netcd daemon. The default value is /var/tmp/netcd.log.
log_rotate<number> Specifies the number of rotations for the log file. The default is no rotation, which is specified by not including a log_rotatedeclaration.
log_size <number> Specifies the size of the log file, in case of rotation, in KB.

Additional declarations

ItemDescription
net_scan_frequency<value> Specifies the scan frequency, in minutes, of the network cache for expired entries because of TTL. The default value is 1.
local_scan_frequency<value> Specifies the scan frequency, in minutes, of the local files for modified dates. When a local file (for example, /etc/hosts) is detected as modified, the corresponding local cache is reloaded with the content of the file. The default value is 1.
socket_queue_size<value> Specifies the size of the message queue for the socket that the netcd daemon uses to communicate with the requesting applications. This value indicates how many waiting requests the netcd daemon will accept. The default value is 256.

Examples

  1. To cache only local host resolutions with a hash table of 1024 lines, use the following cache declaration:
    cache   local   hosts   1024Copy
  2. To cache all of the local resolutions with caches of 512 lines, use the following cache declaration:
    cache  local  all  512Copy
  3. For all protocol resolutions with a hash table of 600 lines and with an expiration of 1 day, use the following cache declaration:
    cache  all  protocols   600  1440Copy
  4. For a david ulm for all maps with a hash table of 128 lines and with an expiration of 1 hour by default, use the following cache declaration:
    cache david   all 128Copy

Netcd dns configuration for negative response

Netcd dns configuration for negative response is supported for AIX 7.1 TL 5 and AIX 7.2 TL 2.

Netcd can be configured to use a local TTL value for negative queries. This TTL value may be an entry in the netcd configuration file. This will ensure that negative responses cached by netcd daemon will be erased after this time interval expires.

cache <type_of_cache> <type_of_map> <hash_size> <cache_ttl>:<negative cache_ttl> Copy
  1. Cache dns hosts 128 obey the TTL from dns server for positive and negative responses
  2. Cache dns hosts 128 20 overwrite the TTL from dns server for positive and negative responses
  3. Cache dns hosts 128 20:30 overwrite the TTL from dns server for positive and negative responses with different TTL values
  4. Cache dns hosts 128 0:20 overwrite the TTL from dns server for negative response only
  5. Cache dns hosts 128 20:0 overwrite the TTL from dns server for positive response only
  6. Cache dns hosts 128: ERROR
  7. Cache dns hosts 128 20: ERROR
  8. Cache dns hosts 128: 20 ERROR

 

icon phone
Téléphone/Whatsapp : +33 (0)6 83 84 85 74
icon phone