Using wildcard FQDN addresses in firewall policies
You can use wildcard FQDN addresses in firewall policies.
The firewall policy types that support wildcard FQDN addresses include IPv4, IPv6, ACL, local, shaping, NAT64, NAT46, and NGFW.
For wildcard FQDN addresses to work, the FortiGate should allow DNS traffic to pass through. Clients behind the FortiGate should use the same DNS server(s) as the FortiGate to ensure the FortiGate and the clients are resolving to the same addresses.
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.
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.
To create a wildcard FQDN using the GUI:
- 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.
To use a wildcard FQDN in a firewall policy using the GUI:
- Go to Policy & Objects > IPv4 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:
To create a wildcard FQDN using the CLI:
config firewall address edit "test-wildcardfqdn-1" set uuid 7288ba26-ce92-51e9-04c0-39c707eb4519 set type fqdn set fqdn "*.fortinet.com" next end
To use wildcard FQDN in a firewall policy using the CLI:
config firewall policy edit 2 set uuid 2f5ffcc0-cddc-51e9-0642-ab9966b202dd 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
To use the diagnose command to list resolved IP addresses of wildcard FQDN objects:
# 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
To use the diagnose command for firewall policies which use wildcard FQDN:
# diagnose firewall iprope list 100004 policy index=2 uuid_idx=46 action=accept flag (8050108): redir nat master use_src pol_stats flag2 (4200): no_asic resolve_sso flag3 (20): schedule(always) cos_fwd=255 cos_rev=255 group=00100004 av=00004e20 au=00000000 split=00000000 host=3 chk_client_info=0x0 app_list=0 ips_view=0 misc=0 dd_type=0 dd_mode=0 zone(1): 11 -> zone(1): 9 source(1): 0.0.0.0-255.255.255.255, uuid_idx=0, 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) service(1): [0:0x0:0/(0,0)->(0,0)] helper:auto
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