When configuring Fully Qualified Domain Name (FQDN) filtering in VMware vDefend Distributed Firewall (DFW), Layer 7 (L7) DNS context profiles must be applied efficiently. Broadly applying L7 DNS context profiles across large scopes or targeting DNS infrastructure directly can lead to unnecessary processing overhead.
This KB article outlines the available approaches and configurations to keep DNS L7 inspection client-focused and optimized.
VMware vDefend Distributed Firewall (Formerly NSX Distributed Firewall)
VMware vDefend Firewall with Advanced Threat Prevention.
FQDN filtering lets the DFW allow or deny traffic by domain name, such as *.example.com. It is a Layer 7 feature that relies on DNS snooping to map IP addresses to FQDNs. The firewall builds and maintains that mapping from the DNS responses returned to the workload.
For FQDN filtering to work as documented:
The product documentation shows the DNS rule with Source and Destination of "Any or specific group" and Applied To of "a group as required". How broadly you scope that rule is up to you. This article gives some available approaches.
DNS queries originate on the client workload, so the client is where FQDN learning and enforcement matter. Applying the DNS L7 context profile to DNS servers, or to a very large Any/Any scope, causes L7 inspection of traffic that does not need it. Because L7 inspections require deeper packet analysis, they are much more CPU-intensive than standard L4 rules.
1a. Create a group containing only the workloads that need FQDN enforcement, and use it as the "Applied To" value for the DNS context profile rule.
1b. Create another L4 allow rule that is applied only to the DNS Servers.
OR
If you cannot easily identify all the DNS clients(Workload VMs), use a higher-priority L4 rule to keep DNS servers out of L7 inspection:
Traffic matching this L4 rule is handled at Layer 4 and does not reach the L7 DNS rule below it.
OR
3a. Configure the DNS context profile rule with Direction = OUT so that inspection is performed on traffic leaving the client workload. This matches the DNS query flow and avoids unnecessary inspection on the DNS server side.
3b. Create another L4 rule to allow traffic with Direction = IN and apply that to DNS servers.