<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pmg.proxmox.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=DNS_server_on_Proxmox_Mail_Gateway</id>
	<title>DNS server on Proxmox Mail Gateway - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pmg.proxmox.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=DNS_server_on_Proxmox_Mail_Gateway"/>
	<link rel="alternate" type="text/html" href="https://pmg.proxmox.com/mediawiki/index.php?title=DNS_server_on_Proxmox_Mail_Gateway&amp;action=history"/>
	<updated>2026-04-12T00:41:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://pmg.proxmox.com/mediawiki/index.php?title=DNS_server_on_Proxmox_Mail_Gateway&amp;diff=102&amp;oldid=prev</id>
		<title>Stoiko Ivanov: /* Installing and using unbound */</title>
		<link rel="alternate" type="text/html" href="https://pmg.proxmox.com/mediawiki/index.php?title=DNS_server_on_Proxmox_Mail_Gateway&amp;diff=102&amp;oldid=prev"/>
		<updated>2023-01-05T09:25:50Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Installing and using unbound&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:25, 5 January 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 41:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 41:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; search yourdomain.example&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; search yourdomain.example&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;. You can use the GUI for setting the dns-resolver as well under Configuration -&amp;gt; Network/Time -&amp;gt; DNS - Just add &amp;lt;code&amp;gt;127.0.0.1&amp;lt;/code&amp;gt; as &amp;lt;code&amp;gt;DNS Server 1&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-added&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;When Proxmox Mail Gateway is running as a Container on Proxmox VE, then you need to edit the container&#039;s DNS Settings to use &amp;lt;code&amp;gt;127.0.0.1&amp;lt;/code&amp;gt; as DNS Server (and adapt your search domain to &amp;lt;code&amp;gt;yourdomain.example&amp;lt;/code&amp;gt;)&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;When Proxmox Mail Gateway is running as a Container on Proxmox VE, then you need to edit the container&#039;s DNS Settings to use &amp;lt;code&amp;gt;127.0.0.1&amp;lt;/code&amp;gt; as DNS Server (and adapt your search domain to &amp;lt;code&amp;gt;yourdomain.example&amp;lt;/code&amp;gt;)&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key pmg_wiki:diff:1.41:old-56:rev-102:wikidiff2=table:1.14.1:bc2a06be --&gt;
&lt;/table&gt;</summary>
		<author><name>Stoiko Ivanov</name></author>
	</entry>
	<entry>
		<id>https://pmg.proxmox.com/mediawiki/index.php?title=DNS_server_on_Proxmox_Mail_Gateway&amp;diff=56&amp;oldid=prev</id>
		<title>Stoiko Ivanov: /* Optional: Using the local unbound only for DNS Blocklist requests */</title>
		<link rel="alternate" type="text/html" href="https://pmg.proxmox.com/mediawiki/index.php?title=DNS_server_on_Proxmox_Mail_Gateway&amp;diff=56&amp;oldid=prev"/>
		<updated>2020-08-26T16:20:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Optional: Using the local unbound only for DNS Blocklist requests&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:20, 26 August 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Should your environment require you to use an internal DNS server for all requests, because you have a very modified setup or are employing some other blocking for regulatory reasons you can also try to forward all other requests to your internal DNS Server and only ask the DNS Blocklist zones recursively.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Should your environment require you to use an internal DNS server for all requests, because you have a very modified setup or are employing some other blocking for regulatory reasons you can also try to forward all other requests to your internal DNS Server and only ask the DNS Blocklist zones recursively.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This setup is &#039;&#039;&#039;not recommended for general use&#039;&#039;&#039;, since it increases the complexity &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;and&lt;/del&gt; makes debugging harder.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This setup is &#039;&#039;&#039;not recommended for general use&#039;&#039;&#039;, since it increases the complexity &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;which&lt;/ins&gt; makes debugging harder.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the example we will use recursive queries for the following domains and forward all other requests to 192.0.2.53:&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In the example we will use recursive queries for the following domains and forward all other requests to 192.0.2.53:&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Stoiko Ivanov</name></author>
	</entry>
	<entry>
		<id>https://pmg.proxmox.com/mediawiki/index.php?title=DNS_server_on_Proxmox_Mail_Gateway&amp;diff=39&amp;oldid=prev</id>
		<title>Martin: page created</title>
		<link rel="alternate" type="text/html" href="https://pmg.proxmox.com/mediawiki/index.php?title=DNS_server_on_Proxmox_Mail_Gateway&amp;diff=39&amp;oldid=prev"/>
		<updated>2020-01-14T15:07:50Z</updated>

		<summary type="html">&lt;p&gt;page created&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most effective means to detecting spam currently is the use of [https://cwiki.apache.org/confluence/display/SPAMASSASSIN/DnsBlocklists DnsBlocklists].&lt;br /&gt;
These lists are used to query the IP of the connecting SMTP server, or IPs and hostnames occurring in the mail body.&lt;br /&gt;
&lt;br /&gt;
Some of the DNS Blocklists used by SpamAssassin (and thus also Proxmox Mail Gateway) allow only a certain number of requests per DNS server and don&amp;#039;t respond once your DNS server has reached it&amp;#039;s quota.&lt;br /&gt;
This is reflected in the mail logs and SpamAssassin hits of a mail. If you see &amp;#039;URIBL_BLOCKED&amp;#039;, &amp;#039;RCVD_IN_DNSWL_BLOCKED&amp;#039; or &amp;#039;SURBL_BLOCKED&amp;#039; in your mail logs or the mail headers, this is an indication that your system has reached the quota.&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re using a shared DNS server (e.g. your ISPs, or a publicly available one like 9.9.9.9, 1.1.1.1, 8.8.8.8) it is quite likely that the Mail Gateway&amp;#039;s requests will be blocked.&lt;br /&gt;
&lt;br /&gt;
Installing a dedicated DNS server on the Proxmox Mail Gateway can help in such situations.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that the DNS Blocklists can only count the requests per public IP, i.e. if you have both your internal DNS and Proxmox Mail Gateway natted to the same public IP setting up a recursive DNS server will not help.&lt;br /&gt;
&lt;br /&gt;
If you keep reaching the limit despite having a dedicated recursive server for your Proxmox Mail Gateway you should consider getting a dedicated feed, which is provided by most DNS Blocklist providers for a fee. This also helps keeping this important infrastructure up and running.&lt;br /&gt;
&lt;br /&gt;
We will use the [https://nlnetlabs.nl/projects/unbound/about/ Unbound] recursive DNS server.&lt;br /&gt;
&lt;br /&gt;
== Installing and using unbound ==&lt;br /&gt;
&lt;br /&gt;
Simply run&lt;br /&gt;
 apt install unbound dnsutils&lt;br /&gt;
&lt;br /&gt;
to install the &amp;lt;code&amp;gt;unbound&amp;lt;/code&amp;gt; server - the &amp;lt;code&amp;gt;dnsutils&amp;lt;/code&amp;gt; package contains &amp;lt;code&amp;gt;dig&amp;lt;/code&amp;gt;, which can be used for testing.&lt;br /&gt;
&lt;br /&gt;
Check that unbound is indeed listening on port 53:&lt;br /&gt;
 # ss -tulnp | grep :53&lt;br /&gt;
 udp     UNCONN   0        0              127.0.0.1:53             0.0.0.0:*      users:((&amp;quot;unbound&amp;quot;,pid=137,fd=5))&lt;br /&gt;
 udp     UNCONN   0        0                  [::1]:53                [::]:*      users:((&amp;quot;unbound&amp;quot;,pid=137,fd=3))&lt;br /&gt;
 tcp     LISTEN   0        128            127.0.0.1:53             0.0.0.0:*      users:((&amp;quot;unbound&amp;quot;,pid=137,fd=6))&lt;br /&gt;
 tcp     LISTEN   0        128                [::1]:53                [::]:*      users:((&amp;quot;unbound&amp;quot;,pid=137,fd=4))&lt;br /&gt;
&lt;br /&gt;
You can verify that DNS resolution works by using the &amp;lt;code&amp;gt;dig&amp;lt;/code&amp;gt; utility&lt;br /&gt;
 # dig a proxmox.com @127.0.0.1 +short &lt;br /&gt;
 79.133.36.244&lt;br /&gt;
&lt;br /&gt;
Afterwards you need to configure your Proxmox Mail Gateway installation to use the local dns-server listening on &amp;lt;code&amp;gt;127.0.0.1&amp;lt;/code&amp;gt; (or optionally &amp;lt;code&amp;gt;::1&amp;lt;/code&amp;gt;) as resolver.&lt;br /&gt;
In the following article we assume that your domain is &amp;lt;code&amp;gt;yourdomain.example&amp;lt;/code&amp;gt; - you need to adapt the posted configuration.&lt;br /&gt;
On a standard installation this is done by simply placing:&lt;br /&gt;
 nameserver 127.0.0.1&lt;br /&gt;
 search yourdomain.example&lt;br /&gt;
&lt;br /&gt;
in &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When Proxmox Mail Gateway is running as a Container on Proxmox VE, then you need to edit the container&amp;#039;s DNS Settings to use &amp;lt;code&amp;gt;127.0.0.1&amp;lt;/code&amp;gt; as DNS Server (and adapt your search domain to &amp;lt;code&amp;gt;yourdomain.example&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
If you have installed the resolvconf package you should not need to change everything, since the unbound package in Debian brings integration with &amp;lt;code&amp;gt;resolvconf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Should your system use &amp;lt;code&amp;gt;systemd-resolved&amp;lt;/code&amp;gt; make sure that&lt;br /&gt;
 resolvectl status&lt;br /&gt;
&lt;br /&gt;
indicates that &amp;lt;code&amp;gt;127.0.0.1&amp;lt;/code&amp;gt; is listed as &amp;lt;code&amp;gt;Current DNS Server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively you can simply disable and stop the service&lt;br /&gt;
 systemctl disable systemd-resolved&lt;br /&gt;
 systemctl stop systemd-resolved&lt;br /&gt;
&lt;br /&gt;
After installing you can either reboot you Proxmox Mail Gateway, or restart the services relevant for mail-processing:&lt;br /&gt;
 systemctl restart pmg-smtp-filter pmgpolicy postfix&lt;br /&gt;
&lt;br /&gt;
== Forwarding requests for your internal zone to your internal DNS ==&lt;br /&gt;
&lt;br /&gt;
In some environments the internally used DNS has all knowledge about your domain, and should be consulted for it, instead of unbound getting the publicly available data via DNS delegation from the root-servers.&lt;br /&gt;
&lt;br /&gt;
You can configure unbound to ask your internal DNS-server (for this example the internal DNS-server has the IP 192.0.2.53) for your internal domains (yourdomain.example and yourseconddomain.example).&lt;br /&gt;
Create a dedicated config-snippet &amp;lt;code&amp;gt;/etc/unbound/unbound.conf.d/local-stub.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 stub-zone:&lt;br /&gt;
   name: &amp;quot;yourdomain.example&amp;quot;&lt;br /&gt;
   stub-addr: 192.0.2.53&lt;br /&gt;
&lt;br /&gt;
 stub-zone:&lt;br /&gt;
   name: &amp;quot;yourseconddomain.example&amp;quot;&lt;br /&gt;
   stub-addr: 192.0.2.53&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Afterwards restart unbound and verify that DNS-requests for yourdomain.example are delegated to 192.0.2.53 (by checking the DNS logs there):&lt;br /&gt;
 systemctl restart unbound&lt;br /&gt;
 dig test.yourdomain.example @127.0.0.1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Optional: Using the local unbound only for DNS Blocklist requests ==&lt;br /&gt;
&lt;br /&gt;
Should your environment require you to use an internal DNS server for all requests, because you have a very modified setup or are employing some other blocking for regulatory reasons you can also try to forward all other requests to your internal DNS Server and only ask the DNS Blocklist zones recursively.&lt;br /&gt;
 &lt;br /&gt;
This setup is &amp;#039;&amp;#039;&amp;#039;not recommended for general use&amp;#039;&amp;#039;&amp;#039;, since it increases the complexity and makes debugging harder.&lt;br /&gt;
&lt;br /&gt;
In the example we will use recursive queries for the following domains and forward all other requests to 192.0.2.53:&lt;br /&gt;
* mailspike.net&lt;br /&gt;
* dnsbl.sorbs.net&lt;br /&gt;
* rhsbl.sorbs.net&lt;br /&gt;
* bl.spamcop.net&lt;br /&gt;
* spamhaus.org&lt;br /&gt;
* surbl.org&lt;br /&gt;
* uribl.com&lt;br /&gt;
* dnswl.org&lt;br /&gt;
&lt;br /&gt;
The list is taken from the [https://cwiki.apache.org/confluence/display/SPAMASSASSIN/DnsBlocklists Spam Assassin Entry on DNS Blocklists].&lt;br /&gt;
You should enhance the list by all domains you are using in your setup (especially the one&amp;#039;s configured for &amp;lt;code&amp;gt;postscreen&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Since unbound cannot do recursive lookups for specific zones if it is forwarding all other requests we will configure 2 unbound instances:&lt;br /&gt;
* one listening on port &amp;lt;code&amp;gt;5003&amp;lt;/code&amp;gt; for recursive lookups - the DNSBL instance&lt;br /&gt;
* one forwarding requests for the DNSBL domains to port 5003, and all other requests to your internal DNS Server.&lt;br /&gt;
&lt;br /&gt;
For the DNSBL instance - create a config-file which does only include the necessary config-options &amp;lt;code&amp;gt;/etc/unbound/unbound-dnsbl.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
 #unbound instance listening on port 5003 for DNSBL lookups&lt;br /&gt;
 include: &amp;quot;/etc/unbound/unbound.conf.d/qname-minimisation.conf&amp;quot;&lt;br /&gt;
 include: &amp;quot;/etc/unbound/unbound.conf.d/root-auto-trust-anchor-file.conf&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 port: 5003&lt;br /&gt;
 remote-control:&lt;br /&gt;
      control-port: 8954&lt;br /&gt;
&lt;br /&gt;
Additionally you need to create a systemd-unit (&amp;lt;code&amp;gt;/etc/systemd/system/unbound-rbl.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 [Unit]&lt;br /&gt;
 Description=Unbound DNS server for DNSBL lookups&lt;br /&gt;
 Documentation=man:unbound(8)&lt;br /&gt;
 After=network.target&lt;br /&gt;
 Before=nss-lookup.target&lt;br /&gt;
 Wants=nss-lookup.target&lt;br /&gt;
&lt;br /&gt;
 [Service]&lt;br /&gt;
 Type=simple&lt;br /&gt;
 Restart=on-failure&lt;br /&gt;
 EnvironmentFile=-/etc/default/unbound&lt;br /&gt;
 EnvironmentFile=-/etc/default/unbound-rbl&lt;br /&gt;
 ExecStartPre=-/usr/lib/unbound/package-helper chroot_setup&lt;br /&gt;
 ExecStartPre=-/usr/lib/unbound/package-helper root_trust_anchor_update&lt;br /&gt;
 ExecStart=/usr/sbin/unbound -c /etc/unbound/unbound-rbl.conf -d $DAEMON_OPTS&lt;br /&gt;
 ExecReload=/usr/sbin/unbound-control -c /etc/unbound/unbound-rbl.conf reload&lt;br /&gt;
&lt;br /&gt;
 [Install]&lt;br /&gt;
 WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and enable it with&lt;br /&gt;
 systemctl enable unbound-rbl&lt;br /&gt;
 systemctl start unbound-rbl&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the instance listening on port 53 you need to create a config-snippet in &amp;lt;code&amp;gt;/etc/unbound/unbound.conf.d/pmg-dnsbl.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
 server:&lt;br /&gt;
       do-not-query-localhost: no&lt;br /&gt;
       # depending on your internal DNS-servers capabilities these options might be necessary&lt;br /&gt;
       # harden-dnssec-stripped: no &lt;br /&gt;
       # module-config: &amp;quot;iterator&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 forward-zone:&lt;br /&gt;
        name: &amp;quot;uceprotect.net&amp;quot;&lt;br /&gt;
        forward-addr: 127.0.0.1@5003&lt;br /&gt;
 &lt;br /&gt;
 forward-zone:&lt;br /&gt;
        name: &amp;quot;mailspike.net&amp;quot;&lt;br /&gt;
        forward-addr: 127.0.0.1@5003&lt;br /&gt;
 &lt;br /&gt;
 forward-zone:&lt;br /&gt;
        name: &amp;quot;sorbs.net&amp;quot;&lt;br /&gt;
        forward-addr: 127.0.0.1@5003&lt;br /&gt;
 &lt;br /&gt;
 forward-zone:&lt;br /&gt;
        name: &amp;quot;bl.spamcop.net&amp;quot;&lt;br /&gt;
        forward-addr: 127.0.0.1@5003&lt;br /&gt;
 &lt;br /&gt;
 forward-zone:&lt;br /&gt;
        name: &amp;quot;spamhaus.org&amp;quot;&lt;br /&gt;
        forward-addr: 127.0.0.1@5003&lt;br /&gt;
 &lt;br /&gt;
 forward-zone:&lt;br /&gt;
        name: &amp;quot;surbl.org&amp;quot;&lt;br /&gt;
        forward-addr: 127.0.0.1@5003&lt;br /&gt;
 &lt;br /&gt;
 forward-zone:&lt;br /&gt;
        name: &amp;quot;uribl.com&amp;quot;&lt;br /&gt;
        forward-addr: 127.0.0.1@5003&lt;br /&gt;
 &lt;br /&gt;
 forward-zone:&lt;br /&gt;
        name: &amp;quot;dnswl.org&amp;quot;&lt;br /&gt;
        forward-addr: 127.0.0.1@5003&lt;br /&gt;
 &lt;br /&gt;
 forward-zone:&lt;br /&gt;
        name: &amp;quot;.&amp;quot;&lt;br /&gt;
        forward-addr: 192.0.2.53&lt;br /&gt;
&lt;br /&gt;
Test the setup by doing lookups to:&lt;br /&gt;
* a testpoint of a DNSBL and verify that the query does not arrive at your internal server&lt;br /&gt;
* a testpoint of an arbitrary address (which should arrive at your internal server):&lt;br /&gt;
&lt;br /&gt;
 # dig any test.uribl.com.multi.uribl.com @127.0.0.1 +short # should not show up as query on 192.0.2.53&lt;br /&gt;
 127.0.0.14&lt;br /&gt;
 &amp;quot;permanent testpoint&amp;quot;&lt;br /&gt;
 # dig a proxmox.com @127.0.0.1 +short  #should show up as query on 192.0.2.53&lt;br /&gt;
 79.133.36.244&lt;/div&gt;</summary>
		<author><name>Martin</name></author>
	</entry>
</feed>