Description | This article describes how to change the behavior of a CNAME record to resolve the real public IP of a domain. |
Scope | FortiGate DNS server. |
Solution |
This article will explain how to use a CNAME record in a DNS zone to query the real server public IP of another domain instead of trying to query an A record in the same DNS zone.
CNAME Record: In this example fortinet.example.com is an alias for example.com and fortinet.com is the canonical domain. See this article for more information.
In this example, FortiGate is listening on port10 for DNS queries. The DNS zone named example.com is configured with the domain 'example.com'. The CNAME record is for host 'fortinet' and the desire is this to query the canonical domain 'fortinet.com'. The host using nslookup is configured to use the FortiGate's port10 IP 10.182.0.1 as its DNS server.
CLI configuration:
config system dns-server edit "port10" next end config system dns-database edit "example.com" set domain "example.com" config dns-entry edit 4 set type CNAME set hostname "fortinet" set canonical-name "fortinet.com" next end next end
The result is that no IP address is resolved because the system is trying to find an A record for 'fortinet.com.example.com'. Because no A record exists for 'fortinet.com.example.com' in the DNS entries, no IP address is resolved.
nslookup results:
config system dns-server edit "port10" next end config system dns-database edit "example.com" set domain "example.com" config dns-entry edit 4 set type CNAME set hostname "fortinet" set canonical-name "fortinet.com." next end next end
What adding the '.' does is tell the CNAME record to start the query with the root DNS server, not within the 'example.com' domain, causing the query to be forwarded to the system DNS of the FortiGate for a recursive query. The result is that the IP address of the real domain is resolved.
The FortiGate uses the FortiGuard DNS servers by default but different servers can be configured.
nslookup results:
For example, using the FortiGuard DNS servers, it can be discovered that the FortiGate's port1 IP address 10.9.10.28 sends a DNS query to 96.45.45.45 on port53.
diag sniff pack any '(host 96.45.45.45 or host 96.45.46.46) and port 53' 4 0 l
Related article: Technical Tip: Different options of configuring DNS server on FortiGate. |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.