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 dns-over-tls {enable | disable | enforce} set ssl-certificate <string> 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 source-ip <class_ip> 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-over-tls
DNS over TLS (DoT) is a security protocol for encrypting and wrapping DNS queries and answers via the Transport Layer Security (TLS) protocol. It can be enabled, disabled, or enforced:
disable
: Disable DNS over TLS (default).enable
: Use TLS for DNS queries if TLS is available.enforce
: Use only TLS for DNS queries. Does not fall back to unencrypted DNS queries if TLS is unavailable.
For more information, see DNS over TLS.
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