ITNuvoAkademiya
Academy homePackagesPlaylistsToolsSubnet calculatorSearchGlossary
CiscoCCNA · CCNA: networking fundamentals1. Introduction2. Network Fundamentals3. Network Access4. IP Connectivity5. IP Services6. IPv67. Security Fundamentals8. AutomationCCNP: Enterprise networks · coming soon
LinuxLinux: system administrator üçün · Linux for system administrators1. Getting to know Linux2. Working with text3. Users and permissions4. Processes and packages5. Inside the system6. Monitoring and logs7. NetworkingRed Hat Enterprise Linux · Red Hat Enterprise Linux: from beginner to advanced1. Getting started2. Packages3. Users and permissions4. SELinux5. Services6. Storage7. Networking8. Building services9. Boot and recovery10. DevOps11. Security and monitoring
FortinetFortiGate Administrator · FortiGate Administrator: from first login to ZTNA1. Getting to know FortiGate2. Routing, policy and NAT3. Security profiles4. Users and logs5. Resilience, SD-WAN and automation6. VDOM7. VPN and ZTNA8. Proxy9. DMZ
MonitoringZabbix · Zabbix: from installation to alerts1. Introduction2. Installation and the database3. Basics: groups, templates, users4. Connecting devices5. Alerts, Grafana and the API
VirtualizationProxmox VE · coming soonVMware ESXi · coming soon
My account / Sign in
AZENRU
← itnuvo.com

DNS filter: stopping a site when its name is looked up

Lesson 3.47 minIntermediateNovember 24, 2026
Open

This lesson is open to everyone. The other lessons open with a package: sign in or sign up, then choose a package.

Key points

  • The DNS filter looks at the DNS query, not the connection: for a forbidden name it returns the address of a block page instead of the real IP, or gives no answer.
  • It works even when traffic is encrypted and needs no SSL inspection, because an ordinary DNS query is plain text. It is light and covers every protocol, not only the web.
  • Its weak side: it sees only the domain name. It does not see the specific page or the downloaded file.
  • Botnet C&C blocking stops an infected computer from finding the name of its control server.
  • If a computer uses encrypted DNS (DoH, DoT) or types the IP directly, the DNS filter does not see it. That is why it is used together with the web filter.

The idea

To open a site a computer first asks: "what is the IP of www.example.com?" If it gets no answer, the connection never starts.

The DNS filter catches this query as it passes through the FortiGate, learns the category of the name from FortiGuard and decides:

  • if it is allowed, the answer passes unchanged;
  • if it is forbidden, the computer receives the address of the block portal instead of the real IP (redirect), or the answer is blocked altogether.

How it differs from the web filter

DNS filterWeb filter
What it looks atThe name in the DNS queryThe HTTP/HTTPS connection
SSL inspection neededNoAt least certificate inspection
CoverageEvery protocol (web, mail, any application)Web only
PrecisionDomain onlyDomain; the full address with deep inspection
Resource useVery lowHigher
Ways around itTyping the IP directly, encrypted DNSHard

The two are not rivals; they complement each other. The DNS filter is a cheap first layer: it cuts most malicious domains before a connection starts. The web filter is the second, more precise layer.

The profile

FGT-HQ
FGT-HQ # config dnsfilter profile
FGT-HQ (profile) # edit "DNS-OFIS"
FGT-HQ (DNS-OFIS) # set block-botnet enable
FGT-HQ (DNS-OFIS) # config ftgd-dns
FGT-HQ (ftgd-dns) # config filters
FGT-HQ (filters) # edit 1
FGT-HQ (1) # set category 26
FGT-HQ (1) # set action block
FGT-HQ (1) # next
FGT-HQ (filters) # edit 2
FGT-HQ (2) # set category 61
FGT-HQ (2) # set action block
FGT-HQ (2) # next
FGT-HQ (filters) # edit 3
FGT-HQ (3) # set category 11
FGT-HQ (3) # set action block
FGT-HQ (3) # next
FGT-HQ (filters) # end
FGT-HQ (ftgd-dns) # end
FGT-HQ (DNS-OFIS) # next
FGT-HQ (profile) # end

GUI: Security Profiles > DNS Filter. The categories are the same as in the web filter (26 Malicious Websites, 61 Phishing, 11 Gambling).

The main settings:

SettingWhat it does
FortiGuard category filterallow / monitor / block (redirect to block portal) by category
block-botnetBlocks queries for known botnet control (C&C) domains
Static domain filterYour own list: block / allow / monitor for specific domains
DNS translationReplaces the IP in an answer with another one
Safe searchSteers search engines into safe mode

Attaching it to a policy

The DNS filter is attached to the policy through which DNS traffic passes. If computers use an external DNS server (for example 9.9.9.9), that is the LAN → internet policy, and its services must include DNS.

FGT-HQ
FGT-HQ # config firewall policy
FGT-HQ (policy) # edit 1
FGT-HQ (1) # set utm-status enable
FGT-HQ (1) # set dnsfilter-profile "DNS-OFIS"
FGT-HQ (1) # next
FGT-HQ (policy) # end

If computers use the FortiGate itself as their DNS server (dns-service local in DHCP, lesson 5), the profile is attached not to a policy but to the FortiGate's DNS server service: Network > DNS Servers, select the interface and name the DNS filter profile.

What is botnet C&C?

An infected computer does not act on its own: it connects to the attacker's command and control (C&C) server and waits for orders. Because the server address changes often, malware usually finds it by domain name.

With block-botnet enable the FortiGate blocks DNS queries for known C&C domains. This has two benefits: the malware cannot receive orders, and in the log you see which computer is infected. An internal IP that appears in the botnet log is a computer to check at once.

Limitations

  • Direct access by IP. With no DNS query the DNS filter does nothing.
  • Encrypted DNS. If a browser uses DNS over HTTPS (DoH), the query travels inside ordinary HTTPS traffic. To prevent this, known DoH servers are blocked with application control or the web filter so that the browser falls back to ordinary DNS.
  • Precision. One domain can hold both useful and harmful pages; the DNS filter cannot tell them apart.

Watch out on a real device: if the FortiGuard DNS rating service cannot be reached, queries may be blocked by default and to staff it looks like "the internet is down". The Allow DNS requests when a rating error occurs option in the profile changes this. Keep an eye on the licence expiry date: the DNS filter also depends on the web filter licence.

Verifying

Look up a blocked domain on a computer:

PC1
C:\> nslookup gambling.example.com

If the answer is not the site's real IP but the address of the FortiGuard block portal, the filter works. Logs in the GUI: Log & Report > Security Events > DNS Query.

🧪 Hands-on lab · Device: FortiGate-VM

DNS filter profile

Create a DNS filter profile called DNS-OFIS: block botnet C&C domains (set block-botnet enable) and under config ftgd-dns → config filters write block for category 26 (Malicious Websites). Attach the profile to policy 1.

Checked:

  • block-botnet enable
  • Category 26: block
  • Policy 1: DNS-OFIS

▶ Start the lab

Check yourself

5 questions · answers are shown instantly · 3 correct answers complete the lesson

1What does the DNS filter look at?

The DNS filter checks the name query and changes the answer for a forbidden name.

2Is SSL inspection needed for the DNS filter?

Ordinary DNS is not encrypted, so the FortiGate sees the name directly.

3A user types the IP address of a site straight into the browser. What does the DNS filter do?

Without a DNS query the DNS filter has nothing to look at; the web filter closes this gap.

4What does the block-botnet option block?

The query for a C&C domain is blocked and the log keeps the address of the infected computer.

5What is the right relationship between the DNS filter and the web filter?

The DNS filter cuts a lot early, and the web filter sees what it cannot.
Was this lesson useful?

Comments

Sign in to comment.