You can use wildcard FQDN addresses in firewall policies. IPv4, IPv6, ACL, local, shaping, NAT64, NAT46, and NGFW policy types support wildcard FQDN addresses.
For wildcard FQDN addresses to work, the FortiGate should allow DNS traffic to pass through.
Initially, the wildcard FQDN object is empty and contains no addresses. When the client tries to resolve a FQDN address, the FortiGate will analyze the DNS response. The IP address(es) contained in the answer section of the DNS response will be added to the corresponding wildcard FQDN object. It is therefore necessary to have the DNS session-helpers defined in the
config system session-helper setting.
Since FortiGate must analyze the DNS response, it does not work with DNS over HTTPS.
When the wildcard FQDN gets the resolved IP addresses, FortiOS loads the addresses into the firewall policy for traffic matching.
The FortiGate will keep the IP addresses in the FQDN object table as long as the DNS entry itself has not expired. Once it expires, the IP address is removed from the wildcard FQDN object until another query is made. At any given time, a single wildcard FQDN object may have up to 1000 IP addresses.
The DNS expiry TTL value is set by the authoritative name server for that DNS record. If the TTL for a specific DNS record is very short and you would like to cache the IP address longer, then you can extend it with the CLI. See To extend the TTL for a DNS record in the CLI:
For more information, see FQDN address firewall object type.
- Go to Policy & Objects > Addresses and click Create New > Address.
- Specify a Name.
- For Type, select FQDN.
- For FQDN, enter a wildcard FQDN address, for example,
- Click OK.
- Go to Policy & Objects > Firewall Policy and click Create New.
- For Destination, select the wildcard FQDN.
- Configure the rest of the policy as needed.
- Click OK.
In this example, policy ID 2 uses the wildcard FQDN:
config firewall address edit "test-wildcardfqdn-1" set type fqdn set fqdn "*.fortinet.com" next end
config firewall policy edit 2 set srcintf "port3" set dstintf "port1" set srcaddr "all" set dstaddr "test-wildcardfqdn-1" set action accept set schedule "always" set service "ALL" set auto-asic-offload disable set nat enable next end
# diagnose firewall fqdn list
List all FQDN:
*.fortinet.com: ID(48) ADDR(188.8.131.52) ADDR(192.168.100.161) ADDR(184.108.40.206)
# diagnose test application dnsproxy 6
worker idx: 0
vfid=0 name=*.fortinet.com ver=IPv4 min_ttl=3266:0, cache_ttl=0 , slot=-1, num=3, wildcard=1
220.127.116.11 (ttl=68862:68311:68311) 192.168.100.161 (ttl=3600:3146:3146) 18.104.22.168
# diagnose firewall iprope list 100004 ... destination fqdn or dynamic address (1):*.fortinet.com ID(48) uuid_idx=57 ADDR(22.214.171.124) ADDR(126.96.36.199) ADDR(188.8.131.52) ADDR(184.108.40.206) ADDR(220.127.116.11) ...
In this the example the
set cache-ttl value has been extended to 3600 seconds.
config firewall address
set type fqdn
set fqdn "www.fortinet.com”
set cache-ttl 3600