Question & Answer
Question
How to configure network caching daemon (netcd) to cache DNS answers
Answer
AIX v6.1 introduced the network caching daemon (
The following example describes how to configure the "
- Review AIX documentation for
netcd
), which can be configured to cache answers from DNS, NIS, etc. queries to improve performance and also reduce network traffic to the servers. In earlier versions, the only workaround was to configure a "caching only" name server.The following example describes how to configure the "
netcd
" subsystem to cache the DNS answers. - Review AIX documentation for
netcd
daemon- AIX man page entry for
netcd
daemon: - AIX man page for
:netcd
.conf
There is helpful, sample configuration file, "/usr/samples/tcpip/netcd.conf
", which includes documentation.
- Edit the
netcd
configuration file to cache only the DNS queriesThe
netcd
daemon looks for /etc/netcd
.conf
to use as its configuration file by default. If a configuration file is not detected, netcd
uses its default values, which caches all possible data with a hash size of 128, and "time to live" (TTL) of 60 minutes.The /etc/
netcd
.conf
file does not exist initially. You must create create the /etc/netcd
.conf
file.Add this line to
netcd
.conf
to cache DNS data:cache dns hosts 128 0
The syntax for the cache option in the
netcd
.conf
file is:cache <type of cache> <type of map> <hash size> <cache ttl>
This entry caches up to 128 DNS answers. A TTL of zero for DNS means to observe the TTL in the answer from the name server, instead of overwriting it.
- Start up
netcd
daemonThe
netcd
runs under srcmstr. Use the 'startsrc' and 'stopsrc' commands to stop and restart the daemon.Start
netcd
with 'startsrc' command:# startsrc -s
netcd
Note: To start
netcd
at boot time, uncomment the netcd
entry in the /etc/rc.tcpip file.- Use the 'netcdctrl
' command to dump netcd
DNS cache data
The netcdctrl
commmand enables management of the netcd
daemon.
Below is an example on how to use netcdctrl
command to dump the DNS cache table:
Initiate a DNS query for yahoo.com:
# host yahoo.com
Dump the netcd
dns cache table:
# netcdctrl -t dns -e hosts -a /tmp/out1; cat /tmp/out1
CACHE dns, hosts, name
>>>>>>>>>>>>>>>>>>>>>>>>>>>> ELEM #1
Expiration date : Thu Jan 9 08:30:52 2025
Ulm or resolver name : dns
Query type : 10100002
Query length : 9
Answer (0: positive; otherwise : negative) : 0
Query key : 1719937974
String used in query : yahoo.com
Additional parameters in query:
query param1 : 2
query param2 : 0
Length of cached element : 51
################### hostent
Number of aliases = 0
Number of addresses = 6
Type = 2
Length = 4
Host name = yahoo.com
Alias =
Address = 74.6.231.21
Address = 98.137.11.163
Address = 98.137.11.164
Address = 74.6.143.25
Address = 74.6.143.26
Address = 74.6.231.20
#################### end of hostent
>>>>>>>>>>>>>>>>>>>>>>>>>>>> END ELEM #1
END CACHE dns, hosts, name
CACHE dns, hosts, address
END CACHE dns, hosts, address
The data reports that there is one cached DNS entry for yahoo.com in the netcd
DNS cache table.
[{"Type":"MASTER","Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"ARM Category":[{"code":"a8m0z000000cvx6AAA","label":"Communication Applications-\u003EDNS\/BIND"}],"ARM Case Number":"","Platform":[{"code":"PF002","label":"AIX"}],"Version":"All Versions"}]
Was this topic helpful?
Document Information
More support for:
AIX
Component:
Communication Applications->DNS/BIND
Software version:
All Versions
Operating system(s):
AIX
Document number:
670097
Modified date:
09 January 2025
UID
isg3T1010925
Manage My Notification Subscriptions