Fortinet white logo
Fortinet white logo

Admin Guide (Standalone)

Set up DNS database

Set up DNS database

To set up the DNS database:
config system dns-database
    edit <name>
        set status [enable|disable]
        set domain {string}
        set type [primary]
        set view [shadow|public]
        set primary-name {string}
        set contact {string}
        set ttl {integer}
        set authoritative [enable|disable]
        set forwarder {space-separated list of ipv4-address}
        set source-ip {ipv4-address}
        config dns-entry
            edit <id>
            set status [enable|disable]
            set type [A|NS|CNAME|MX|PTR]
            set ttl {integer}
            set hostname {string}
            set preference {integer}
            set ip {ipv4-address-any}
            set canonical-name {string}
            next
        end
    next
end
dns-database
Parameter Description
status

The status of the DNS zone:

  • enable (default)

  • disable

Note: This field is NOT required.

domain

Domain name.

Note: The maximum length is 225 characters. This field is required.

type

Zone type.

  • primary (default) — The primary DNS zone to manage entries directly.

Note: This field is NOT required.

view

Zone view.

  • shadow: Shadow DNS zone to serve internal clients. (default)

  • public: Public DNS zone to serve public clients.

Note: This field is NOT required

primary-name

Domain name of the default DNS server for this zone.

Note: The maximum length is 225 characters. The default is dns. This field is NOT required

contact

Email address of the zone administrator. You can specify either the username (e.g., admin) or the full email address (e.g., admin@test.com). When using a simple username, the domain of the email will be this zone.

Note: The maximum length is 225 characters. The default is host. This field is NOT required

ttl

Default time-to-live value for the entries of this DNS zone.

Note: The value ranges from 0 to 2147483647. The default is 86400. This filed is NOT required.

authoritative

(Status of) authoritative zone:

  • enable (default)

  • disable

Note: This field is NOT required.

forwarder

DNS zone forwarder IP address list.

Note: List of IPv4 address only. The maximum number of IP addresses is 12. This field is Not required.

source-ip

Source IP for forwarding to the DNS server.

Note: IPv4 address only. The default is 0.0.0.0.

dns-entry
Parameter Description
status

Resource record status:

  • enable (default)

  • disable

Note: This field is NOT required.

type

Resource record type:

  • A — Host type. (default)

  • NS — Name server type

  • CNAME — Canonical name type

  • MX — Mail exchange type

  • PTR — Pointer type

Note: This field is NOT required.

ttl

Time-to-live for this entry.

Note: The value ranges from 0 to 2147483647. The default is 0. The field is NOT required.

hostname

Hostname of the host.

Note: The maximum length is 155 characters. The field is required.

preference

DNS entry preference, 0 is the highest preference.

Note: Applicable to MX (type) only. The value ranges from 0 to 65535. The default is 10. This field is NOT required.

ip

IPv4 address of the host.

Note: Applicable to A and PTR( types) only. This field is required.

canonical-name

Canonical name of the host.

Note: Applicable to CNAME (type) only. The maximum length is 255 characters. This field is required.

Check DNS statistics

FX201E5919000046 # get dnsproxy stats          
retry_interval=500 query_timeout=1995
DNS latency info:
    server=208.91.112.53 latency=6 updated=3249
DNS_CACHE: alloc=2, hit=0
DNS query: alloc=0
DNS UDP: req=2 res=2 fwd=2 retrans=0 to=0
         cur=2 switched=1720994010 num_switched=0
DNS TCP: requests=0 responses=0 fwd=0 retransmit=0 timeout=0

Dump the DNS cache

FX201E5919000046 # execute dnsproxy cache dump 
name=gmail.google.com, ttl=300:298:1798
         142.250.189.238 (ttl=300)
name=www.google.com, ttl=300:283:1783
         142.250.189.196 (ttl=300)
CACHE num=2 

Clear the DNS cache

FX201E5919000046 # execute dnsproxy cache clear
FX201E5919000046 # execute dnsproxy cache dump  
CACHE num=0# 

Dump the DNS database

FX201E5919000046 # execute dnsproxy database dump 
name=test1 domain=example.com ttl=86400 authoritative=0 view=shadow type=primary serial=1714636915
      A: host1.example.com-->192.168.200.100(86400)
    SOA: example.com (primary: dns.example.com, contact: host@example.com, serial: 1714636915)(86400)
    PTR: 100.200.168.192.in-addr.arpa-->host1.example.com(86400)
     MX: example.com-->mail1.example.com 10 (86400)
     NS: example.com-->dns.example.com(86400)
  CNAME: cn1.example.com-->host1.example.com(86400)

Set up DNS database

Set up DNS database

To set up the DNS database:
config system dns-database
    edit <name>
        set status [enable|disable]
        set domain {string}
        set type [primary]
        set view [shadow|public]
        set primary-name {string}
        set contact {string}
        set ttl {integer}
        set authoritative [enable|disable]
        set forwarder {space-separated list of ipv4-address}
        set source-ip {ipv4-address}
        config dns-entry
            edit <id>
            set status [enable|disable]
            set type [A|NS|CNAME|MX|PTR]
            set ttl {integer}
            set hostname {string}
            set preference {integer}
            set ip {ipv4-address-any}
            set canonical-name {string}
            next
        end
    next
end
dns-database
Parameter Description
status

The status of the DNS zone:

  • enable (default)

  • disable

Note: This field is NOT required.

domain

Domain name.

Note: The maximum length is 225 characters. This field is required.

type

Zone type.

  • primary (default) — The primary DNS zone to manage entries directly.

Note: This field is NOT required.

view

Zone view.

  • shadow: Shadow DNS zone to serve internal clients. (default)

  • public: Public DNS zone to serve public clients.

Note: This field is NOT required

primary-name

Domain name of the default DNS server for this zone.

Note: The maximum length is 225 characters. The default is dns. This field is NOT required

contact

Email address of the zone administrator. You can specify either the username (e.g., admin) or the full email address (e.g., admin@test.com). When using a simple username, the domain of the email will be this zone.

Note: The maximum length is 225 characters. The default is host. This field is NOT required

ttl

Default time-to-live value for the entries of this DNS zone.

Note: The value ranges from 0 to 2147483647. The default is 86400. This filed is NOT required.

authoritative

(Status of) authoritative zone:

  • enable (default)

  • disable

Note: This field is NOT required.

forwarder

DNS zone forwarder IP address list.

Note: List of IPv4 address only. The maximum number of IP addresses is 12. This field is Not required.

source-ip

Source IP for forwarding to the DNS server.

Note: IPv4 address only. The default is 0.0.0.0.

dns-entry
Parameter Description
status

Resource record status:

  • enable (default)

  • disable

Note: This field is NOT required.

type

Resource record type:

  • A — Host type. (default)

  • NS — Name server type

  • CNAME — Canonical name type

  • MX — Mail exchange type

  • PTR — Pointer type

Note: This field is NOT required.

ttl

Time-to-live for this entry.

Note: The value ranges from 0 to 2147483647. The default is 0. The field is NOT required.

hostname

Hostname of the host.

Note: The maximum length is 155 characters. The field is required.

preference

DNS entry preference, 0 is the highest preference.

Note: Applicable to MX (type) only. The value ranges from 0 to 65535. The default is 10. This field is NOT required.

ip

IPv4 address of the host.

Note: Applicable to A and PTR( types) only. This field is required.

canonical-name

Canonical name of the host.

Note: Applicable to CNAME (type) only. The maximum length is 255 characters. This field is required.

Check DNS statistics

FX201E5919000046 # get dnsproxy stats          
retry_interval=500 query_timeout=1995
DNS latency info:
    server=208.91.112.53 latency=6 updated=3249
DNS_CACHE: alloc=2, hit=0
DNS query: alloc=0
DNS UDP: req=2 res=2 fwd=2 retrans=0 to=0
         cur=2 switched=1720994010 num_switched=0
DNS TCP: requests=0 responses=0 fwd=0 retransmit=0 timeout=0

Dump the DNS cache

FX201E5919000046 # execute dnsproxy cache dump 
name=gmail.google.com, ttl=300:298:1798
         142.250.189.238 (ttl=300)
name=www.google.com, ttl=300:283:1783
         142.250.189.196 (ttl=300)
CACHE num=2 

Clear the DNS cache

FX201E5919000046 # execute dnsproxy cache clear
FX201E5919000046 # execute dnsproxy cache dump  
CACHE num=0# 

Dump the DNS database

FX201E5919000046 # execute dnsproxy database dump 
name=test1 domain=example.com ttl=86400 authoritative=0 view=shadow type=primary serial=1714636915
      A: host1.example.com-->192.168.200.100(86400)
    SOA: example.com (primary: dns.example.com, contact: host@example.com, serial: 1714636915)(86400)
    PTR: 100.200.168.192.in-addr.arpa-->host1.example.com(86400)
     MX: example.com-->mail1.example.com 10 (86400)
     NS: example.com-->dns.example.com(86400)
  CNAME: cn1.example.com-->host1.example.com(86400)