Important DNS CLI commands
DNS settings can be configured with the following CLI command:
config system dns set primary <ip_address> set secondary <ip_address> set protocol {cleartext dot doh} set ssl-certificate <string> set server-hostname <hostname> set domain <domains> set ip6-primary <ip6_address> set ip6-secondary <ip6_address> set timeout <integer> set retry <integer> set dns-cache-limit <integer> set dns-cache-ttl <integer> set cache-notfound-responses {enable | disable} set interface-select-method {auto | sdwan | specify} set interface <interface> set source-ip <class_ip> set server-select-method {least-rtt | failover} set alt-primary <ip_address> set alt-secondary <ip_address> set log {disable |error | all} set fqdn-cache-ttl <integer> set fqdn-min-refresh <integer> end
For a FortiGate with multiple logical CPUs, you can set the DNS process number from 1 to the number of logical CPUs. The default DNS process number is 1.
config system global set dnsproxy-worker-count <integer> end
DNS protocols
The following DNS protocols can be enabled:
cleartext
: Enable clear text DNS over port 53 (default).dot
: Enable DNS over TLS.doh
: Enable DNS over HTTPS.
For more information, see DNS over TLS and HTTPS.
cache-notfound-responses
When enabled, any DNS requests that are returned with NOT FOUND
can be stored in the cache. The DNS server is not asked to resolve the host name for NOT FOUND
entries. By default, this option is disabled.
dns-cache-limit
Set the number of DNS entries that are stored in the cache (0 to 4294967295, default = 5000). Entries that remain in the cache provide a quicker response to requests than going out to the Internet to get the same information.
dns-cache-ttl
The duration that the DNS cache retains information, in seconds (60 to 86400 (1 day), default = 1800).
VDOM DNS
When the FortiGate is in multi-vdom mode, DNS is handled by the management VDOM. However in some cases, administrators may want to configure custom DNS settings on a non-management VDOM. For example, in a multi-tenant scenario, each VDOM might be occupied by a different tenant, and each tenant might require its own DNS server.
To configure a custom VDOM within a non-management VDOM:
config vdom edit <vdom> config system vdom-dns set vdom-dns enable set primary <primary DNS> set secondary <secondary_DNS> set protocol {cleartext dot doh} set ip6-primary <primary_IPv6_DNS> set ip6-secondary <secondary_IPv6_DNS> set source-ip <IP_address> set interface-select-method {auto | sdwan | specify} end