Fortinet white logo
Fortinet white logo

CLI Reference

system dns

system dns

Use this command to configure the DNS servers that the FortiMail system will query.

FortiMail systems require DNS servers for many features such as resolving fully qualified domain names (FQDN) into IP addresses, MX lookups, PTR lookups (reverse-dns-type {ldap-query | regexp | wildcard} and forged-ip-check {any | fail | pass}), FortiGuard connectivity, DKIM sender authentication, and more.

Note

For improved FortiMail performance, use DNS servers on your local network.

Syntax

config system dns

set primary {<dns1_ipv4> | <dns1_ipv6>}

set secondary {<dns2_ipv4> | <dns2_ipv6>}

set protected-domain-dns-state {enable | disable}

set protected-domain-dns-servers {{<dns_ipv4> | <dns_ipv6>} ...}

set cache {enable | disable}

set cache-min-ttl <seconds_int>

set ptr-query-option {enable | disable | public-ip-only}

set truncate-handling {disable | tcp-retry}

end

Variable

Description

Default

cache {enable | disable}

Enable to cache DNS query results to improve performance.

Disable the DNS cache to free memory if the FortiMail system has high RAM usage.

enable

cache-min-ttl <seconds_int>

Enter the time-to-live (TTL) until expiry of cached DNS records.

Whether the TTL is applied to existing cache depends on the length of the existing TTL:

  • New TTL is longer — Apply the new TTL to existing cache entries, extending their TTL.

  • New TTL is shorter — Keep the old TTL on existing cache entries. Later, when the record is cached again, apply the new TTL to the new cache.

300

primary {<dns1_ipv4> | <dns1_ipv6>}

Enter the IP address of the primary DNS server.

Tooltip

This setting is ignored if dns-override-status {enable | disable} is enabled.

0.0.0.0

protected-domain-dns-servers {{<dns_ipv4> | <dns_ipv6>} ...}

Enter the IP address of a DNS server that you want to use to resolve protected domain and sub-domain names and the MX record (alternative domain). You can enter up to three addresses.

0.0.0.0

protected-domain-dns-state {enable | disable}

Enable or disable DNS servers that are specifically used for protected domains and their sub-domains. This is useful if the protected domains’ MX record, A record, or AAAA record are resolved differently on internal DNS servers.

This setting applies only if operating in gateway mode and transparent mode, and if relay-type {host | ip-pool | ldap-domain-routing | mx-lookup | mx-lookup-alt-domain} is mx-lookup or mx-lookup-alt-domain.

Tooltip

If you configure DNS servers for protected domains (such as example.com), FortiMail will also use the same DNS server for all queries that are in the form of sub.example.com, so that the recursive queries for the returned MX record or other records can be directed to the same server.

disable

ptr-query-option {enable | disable | public-ip-only}

Enable to perform reverse DNS lookups on both private network IP addresses and public IP addresses.

Tooltip

DNS pointer record (PTR) queries may cause delays when the DNS server has no response. In this situation, you can disable the query.

Note

In some cases, the DNS server may not have PTR records for your private network’s IP addresses. Failure to contain records for those IP addresses may increase DNS query time. In this situation, you can query on public IP addresses only.

public-ip-only

secondary {<dns2_ipv4> | <dns2_ipv6>}

Enter the IP address of the secondary DNS server.

Tooltip

This setting is ignored if dns-override-status {enable | disable} is enabled.

0.0.0.0

truncate-handling {disable | tcp-retry}

Select how to handle truncated UDP replies of DNS queries, either:

  • disable — Do not retry.

  • tcp-try — Retry over TCP instead of UDP.

tcp-retry

Related topics

domain

system interface

system ddns

system dns

system dns

Use this command to configure the DNS servers that the FortiMail system will query.

FortiMail systems require DNS servers for many features such as resolving fully qualified domain names (FQDN) into IP addresses, MX lookups, PTR lookups (reverse-dns-type {ldap-query | regexp | wildcard} and forged-ip-check {any | fail | pass}), FortiGuard connectivity, DKIM sender authentication, and more.

Note

For improved FortiMail performance, use DNS servers on your local network.

Syntax

config system dns

set primary {<dns1_ipv4> | <dns1_ipv6>}

set secondary {<dns2_ipv4> | <dns2_ipv6>}

set protected-domain-dns-state {enable | disable}

set protected-domain-dns-servers {{<dns_ipv4> | <dns_ipv6>} ...}

set cache {enable | disable}

set cache-min-ttl <seconds_int>

set ptr-query-option {enable | disable | public-ip-only}

set truncate-handling {disable | tcp-retry}

end

Variable

Description

Default

cache {enable | disable}

Enable to cache DNS query results to improve performance.

Disable the DNS cache to free memory if the FortiMail system has high RAM usage.

enable

cache-min-ttl <seconds_int>

Enter the time-to-live (TTL) until expiry of cached DNS records.

Whether the TTL is applied to existing cache depends on the length of the existing TTL:

  • New TTL is longer — Apply the new TTL to existing cache entries, extending their TTL.

  • New TTL is shorter — Keep the old TTL on existing cache entries. Later, when the record is cached again, apply the new TTL to the new cache.

300

primary {<dns1_ipv4> | <dns1_ipv6>}

Enter the IP address of the primary DNS server.

Tooltip

This setting is ignored if dns-override-status {enable | disable} is enabled.

0.0.0.0

protected-domain-dns-servers {{<dns_ipv4> | <dns_ipv6>} ...}

Enter the IP address of a DNS server that you want to use to resolve protected domain and sub-domain names and the MX record (alternative domain). You can enter up to three addresses.

0.0.0.0

protected-domain-dns-state {enable | disable}

Enable or disable DNS servers that are specifically used for protected domains and their sub-domains. This is useful if the protected domains’ MX record, A record, or AAAA record are resolved differently on internal DNS servers.

This setting applies only if operating in gateway mode and transparent mode, and if relay-type {host | ip-pool | ldap-domain-routing | mx-lookup | mx-lookup-alt-domain} is mx-lookup or mx-lookup-alt-domain.

Tooltip

If you configure DNS servers for protected domains (such as example.com), FortiMail will also use the same DNS server for all queries that are in the form of sub.example.com, so that the recursive queries for the returned MX record or other records can be directed to the same server.

disable

ptr-query-option {enable | disable | public-ip-only}

Enable to perform reverse DNS lookups on both private network IP addresses and public IP addresses.

Tooltip

DNS pointer record (PTR) queries may cause delays when the DNS server has no response. In this situation, you can disable the query.

Note

In some cases, the DNS server may not have PTR records for your private network’s IP addresses. Failure to contain records for those IP addresses may increase DNS query time. In this situation, you can query on public IP addresses only.

public-ip-only

secondary {<dns2_ipv4> | <dns2_ipv6>}

Enter the IP address of the secondary DNS server.

Tooltip

This setting is ignored if dns-override-status {enable | disable} is enabled.

0.0.0.0

truncate-handling {disable | tcp-retry}

Select how to handle truncated UDP replies of DNS queries, either:

  • disable — Do not retry.

  • tcp-try — Retry over TCP instead of UDP.

tcp-retry

Related topics

domain

system interface

system ddns