To limit the amount of memory a name server uses, use the max-cache-size options statement:
root# cat /etc/named.conf
options {
directory "/var/named";
max-cache-size 10m; // maximum cache size of 10MB
};
root#
This tells the name server to remove old, cached records early (i.e., before they’re stale) if the size of the cache reaches the limit.
Once this is set, you may also want to reduce the cleaning interval (the period at which the name server checks for stale records):
root# cat /etc/named.conf
options {
directory "/var/named";
max-cache-size 10m; // maximum cache size of 10MB
cleaning-interval 10; // clean cache every 10 minutes
};
root#
Also the following can be used the max-cache-ttl and max-ncache-ttl. These limit the time-to-live values of cached records and cached negative responses, respectively.
root# cat /etc/named.conf
options {
directory "/var/named";
max-cache-size 10m; // maximum cache size of 10MB
cleaning-interval 10; // clean cache every 10 minutes
max-cache-ttl 60; // limit cached record to a 60s TTL
max-ncache-ttl 60; // limit cache negative responses to a 60s TTL
};
root#
To disable caching, see this: Bind – disable caching