{"id":690,"date":"2020-05-14T17:17:27","date_gmt":"2020-05-14T17:17:27","guid":{"rendered":"https:\/\/server-help.org\/?p=690"},"modified":"2021-10-06T22:51:57","modified_gmt":"2021-10-06T22:51:57","slug":"pi-hole-using-an-ionos-centos-8-cloud-server","status":"publish","type":"post","link":"https:\/\/server-help.org\/index.php\/2020\/05\/14\/pi-hole-using-an-ionos-centos-8-cloud-server\/","title":{"rendered":"Pi-Hole using DoT (DNS over TLS) &#038; DoH (DNS over HTTPS) on an IONOS CentOS 8 Cloud Server"},"content":{"rendered":"\n<p>In this guide we will show you how to properly setup and configure a VM running pi-hole for use as an ad filter on your home connection.<\/p>\n\n\n\n<p>While traditionally Pi-Hole is ran on a device hosted in your LAN it can also be ran remotely if proper precautions are taken.<\/p>\n\n\n\n<p>One of the benefits of setting it up this way is that it can be ran from a very small server (1CPU &#8211; 512MB ram) or ran on an existing web server with little impact to performance. An additional benefit is that you can allow multiple locations or users to use your Pi-Hole server as well so that they won&#8217;t need to setup their own. <\/p>\n\n\n\n<p>One concern is Security and the risk of DDOS and DNS amplification attacks. To prevent this we will only be allowing connections from IPs that we specify.<\/p>\n\n\n\n<p>At the end of this guide you will have a secured Pi-Hole server running DoT (DNS over TLS) and DOH (DNS over HTTPS).<\/p>\n\n\n\n<p>To do this we will be using CentOS 8, PiHole 5, lighttpd, stunnel,  cloudflared, and firewalld.<\/p>\n\n\n\n<p>Before we get started we will assume that you have already performed the following steps:<\/p>\n\n\n\n<p>1). Already have a domain or subdomain pointing to your Pi-Hole Server<\/p>\n\n\n\n<p>2). Apache\/Nginx already installed and listening on ports 80\/443 with a certbot (Let&#8217;s encrypt) SSL already setup. (When setting up the cert, use the following flag &#8211;preferred-chain &#8220;ISRG Root X1&#8221;)<\/p>\n\n\n\n<p>3). You have Dynamic DNS configured on your Home router.<\/p>\n\n\n\n<p>Once these steps have been completed you can proceed below:<\/p>\n\n\n\n<p>1). curl -sSL https:\/\/install.pi-hole.net | bash<\/p>\n\n\n\n<p>2). yum install php-json<\/p>\n\n\n\n<p>3). vi \/etc\/lighttpd\/lighttpd.conf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Pi-hole: A black hole for Internet advertisements\n# (c) 2017 Pi-hole, LLC (https:\/\/pi-hole.net)\n# Network-wide ad blocking via your own hardware.\n#\n# lighttpd config for Pi-hole\n#\n# This file is copyright under the latest version of the EUPL.\n# Please see LICENSE file for your rights under this license.\n\n###############################################################################\n#     FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL\/UPDATE PROCEDURE.     #\n# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #\n#                                                                             #\n#              CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE:              #\n#                         \/etc\/lighttpd\/external.conf                         #\n###############################################################################\n\nserver.modules = (\n        \"mod_access\",\n        \"mod_auth\",\n        \"mod_fastcgi\",\n        \"mod_accesslog\",\n        \"mod_expire\",\n        \"mod_compress\",\n        \"mod_redirect\",\n        \"mod_setenv\",\n        \"mod_rewrite\"\n)\n\nserver.document-root        = \"\/var\/www\/html\/admin\"\nserver.error-handler-404    = \"\/pihole\/index.php\"\nserver.upload-dirs          = ( \"\/var\/cache\/lighttpd\/uploads\" )\nserver.errorlog             = \"\/var\/log\/lighttpd\/error.log\"\nserver.pid-file             = \"\/var\/run\/lighttpd.pid\"\nserver.username             = \"lighttpd\"\nserver.groupname            = \"lighttpd\"\nserver.port                 = 8080\naccesslog.filename          = \"\/var\/log\/lighttpd\/access.log\"\naccesslog.format            = \"%{%s}t|%V|%r|%s|%b\"\n\n\nindex-file.names            = ( \"index.php\", \"index.html\", \"index.lighttpd.html\" )\nurl.access-deny             = ( \"~\", \".inc\", \".md\", \".yml\", \".ini\" )\nstatic-file.exclude-extensions = ( \".php\", \".pl\", \".fcgi\" )\n\ncompress.cache-dir          = \"\/var\/cache\/lighttpd\/compress\/\"\ncompress.filetype           = ( \"application\/javascript\", \"text\/css\", \"text\/html\", \"text\/plain\" )\n\nmimetype.assign   = ( \".png\"  =&gt; \"image\/png\",\n                      \".jpg\"  =&gt; \"image\/jpeg\",\n                      \".jpeg\" =&gt; \"image\/jpeg\",\n                      \".html\" =&gt; \"text\/html\",\n                      \".css\" =&gt; \"text\/css; charset=utf-8\",\n                      \".js\" =&gt; \"application\/javascript\",\n                      \".json\" =&gt; \"application\/json\",\n                      \".txt\"  =&gt; \"text\/plain\",\n                      \".svg\"  =&gt; \"image\/svg+xml\" )\n\n# default listening port for IPv6 falls back to the IPv4 port\n#include_shell \"\/usr\/share\/lighttpd\/use-ipv6.pl \" + server.port\n#include_shell \"\/usr\/share\/lighttpd\/create-mime.assign.pl\"\n#include_shell \"\/usr\/share\/lighttpd\/include-conf-enabled.pl\"\n\nfastcgi.server = ( \".php\" =&gt;\n                   ( \"localhost\" =&gt;\n                     (\n                       \"socket\" =&gt; \"\/tmp\/php-fastcgi.socket\",\n                       \"bin-path\" =&gt; \"\/usr\/bin\/php-cgi\"\n                     )\n                   )\n                 )\n\n# If the URL starts with \/admin, it is the Web interface\n$HTTP&#91;\"url\"] =~ \"^\/admin\/\" {\n          # Create a response header for debugging using curl -I\n    setenv.add-response-header = (\n        \"X-Pi-hole\" =&gt; \"The Pi-hole Web interface is working!\",\n        \"X-Frame-Options\" =&gt; \"DENY\"\n    )\n\n    $HTTP&#91;\"url\"] =~ \".ttf$\" {\n        # Allow Block Page access to local fonts\n        setenv.add-response-header = ( \"Access-Control-Allow-Origin\" =&gt; \"*\" )\n    }\n}\n\n# Block . files from being served, such as .git, .github, .gitignore\n$HTTP&#91;\"url\"] =~ \"^\/admin\/\\.(.*)\" {\n     url.access-deny = (\"\")\n}\n\n# Add user chosen options held in external file\n# This uses include_shell instead of an include wildcard for compatibility\ninclude_shell \"cat external.conf 2&gt;\/dev\/null\"<\/code><\/pre>\n\n\n\n<p>4). service lighttpd restart<\/p>\n\n\n\n<p>5). pihole -a -p (Sets a password for the Pi-Hole interface)<\/p>\n\n\n\n<p>6). dnf install firewalld<\/p>\n\n\n\n<p>7). systemctl enable firewalld<\/p>\n\n\n\n<p>8). systemctl start firewalld<\/p>\n\n\n\n<p>9). firewall-cmd &#8211;zone=public &#8211;add-port=80\/tcp &#8211;permanent<br>     firewall-cmd &#8211;zone=public &#8211;add-port=443\/tcp &#8211;permanent<br>     firewall-cmd &#8211;zone=public &#8211;add-port=22\/tcp &#8211;permanent<br>     firewall-cmd &#8211;zone=public &#8211;add-port=8080\/tcp &#8211;permanent<br>     firewall-cmd &#8211;zone=public &#8211;add-port=444\/tcp &#8211;permanent<\/p>\n\n\n\n<p>10). firewall-cmd &#8211;permanent &#8211;add-rich-rule=&#8217;rule family=&#8221;ipv4&#8243; source address=&#8221;My IP&#8221; port protocol=&#8221;tcp&#8221; port=&#8221;53&#8243; accept&#8217;<br>\n firewall-cmd &#8211;permanent &#8211;add-rich-rule=&#8217;rule family=&#8221;ipv4&#8243; source address=&#8221;My IP&#8221; port protocol=&#8221;tcp&#8221; port=&#8221;853&#8243; accept&#8217;<br>\nfirewall-cmd &#8211;permanent &#8211;add-rich-rule=&#8217;rule family=&#8221;ipv4&#8243; source address=&#8221;My IP&#8221; port protocol=&#8221;udp&#8221; port=&#8221;53&#8243; accept&#8217;<\/p>\n\n\n\n<p>11). vi  \/etc\/firewalld\/zones\/public.xml<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;zone&gt;\n  &lt;short&gt;Public&lt;\/short&gt;\n  &lt;description&gt;For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.&lt;\/description&gt;\n  &lt;service name=\"ssh\"\/&gt;\n  &lt;service name=\"dhcpv6-client\"\/&gt;\n  &lt;service name=\"cockpit\"\/&gt;\n  &lt;service name=\"http\"\/&gt;\n  &lt;port port=\"80\" protocol=\"tcp\"\/&gt;\n  &lt;port port=\"8080\" protocol=\"tcp\"\/&gt;\n  &lt;port port=\"22\" protocol=\"tcp\"\/&gt;\n  &lt;port port=\"443\" protocol=\"tcp\"\/&gt;\n  &lt;port port=\"444\" protocol=\"tcp\"\/&gt;\n  &lt;rule family=\"ipv4\"&gt;\n&lt;source address=\"67.x.x.x\"\/&gt;\"\n    &lt;port port=\"53\" protocol=\"tcp\"\/&gt;\n    &lt;accept\/&gt;\n  &lt;\/rule&gt;\n  &lt;rule family=\"ipv4\"&gt;\n&lt;source address=\"67.x.x.x\"\/&gt;\"\n    &lt;port port=\"853\" protocol=\"tcp\"\/&gt;\n    &lt;accept\/&gt;\n  &lt;\/rule&gt;\n  &lt;rule family=\"ipv4\"&gt;\n&lt;source address=\"67.x.x.x\"\/&gt;\"\n    &lt;port port=\"53\" protocol=\"udp\"\/&gt;\n    &lt;accept\/&gt;\n  &lt;\/rule&gt;\n&lt;\/zone&gt;<\/code><\/pre>\n\n\n\n<p>You will now want to make a note of the lines that begin with &#8220;&lt;source address=&#8221;. In this example they are lines 15, 20, and 25.<\/p>\n\n\n\n<p>12). mkdir \/scripts<\/p>\n\n\n\n<p>13). vi \/scripts\/dns.sh<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>myhost=$(dig +short myhome.tplinkdns.com)\n\nstart='&lt;source address=\"'\nend='\"\/&gt;\"'\ncomplete=\"${start}${myhost}${end}\"\n\ncp \/etc\/firewalld\/zones\/public.xml \/etc\/firewalld\/zones\/public2.xml\nsed -i '15d' \/etc\/firewalld\/zones\/public2.xml\nsed -i \"15i $complete\" \/etc\/firewalld\/zones\/public2.xml\n\nsed -i '20d' \/etc\/firewalld\/zones\/public2.xml\nsed -i \"20i $complete\" \/etc\/firewalld\/zones\/public2.xml\n\nsed -i '25d' \/etc\/firewalld\/zones\/public2.xml\nsed -i \"25i $complete\" \/etc\/firewalld\/zones\/public2.xml\n\nrm \/etc\/firewalld\/zones\/public.xml\nmv \/etc\/firewalld\/zones\/public2.xml \/etc\/firewalld\/zones\/public.xml\n\nfirewall-cmd --reload<\/code><\/pre>\n\n\n\n<p>Make sure to replace myhome.tplinkdns.com with the Dynamic DNS domain\/subdomain you have setup on your home router. In this example I am using a router provided by TP-Link.<\/p>\n\n\n\n<p>Also make sure to replace the 6 lines of sed with the line numbers for your source address. If for example my 1st line was 12 instead of 15 the command would be: sed -i &#8217;12d&#8217; \/etc\/firewalld\/zones\/public2.xml and sed -i &#8220;12i $complete&#8221; \/etc\/firewalld\/zones\/public2.xml<\/p>\n\n\n\n<p>14). chmod +x \/scripts\/dns.sh<\/p>\n\n\n\n<p>15). crontab -e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>*\/5 * * * * \/scripts\/dns.sh<\/code><\/pre>\n\n\n\n<p>This runs our check script every 5 minutes. If your Home IP were to change this script will update your firewall so that you still have access to the DNS Server.<\/p>\n\n\n\n<p>16). yum install stunnel<\/p>\n\n\n\n<p>17). vi \/etc\/stunnel\/dnstls.conf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;dnstls]\ncert = \/etc\/letsencrypt\/live\/dns.mydomain.com\/fullchain.pem\nkey = \/etc\/letsencrypt\/live\/dns.mydomain.com\/privkey.pem\n\naccept = 853\nconnect = 127.0.0.1:53<\/code><\/pre>\n\n\n\n<p>18). systemctl enable stunnel<\/p>\n\n\n\n<p>19). stunnel \/etc\/stunnel\/dnstls.conf<\/p>\n\n\n\n<p>20). chmod +x \/etc\/rc.local<\/p>\n\n\n\n<p>21). vi \/etc\/rc.local<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES\n#\n# It is highly advisable to create own systemd services or udev rules\n# to run scripts during boot instead of using this file.\n#\n# In contrast to previous versions due to parallel execution during boot\n# this script will NOT be run after all other services.\n#\n# Please note that you must run 'chmod +x \/etc\/rc.d\/rc.local' to ensure\n# that this script will be executed during boot.\n\ntouch \/var\/lock\/subsys\/local\nstunnel \/etc\/stunnel\/dnstls.conf<\/code><\/pre>\n\n\n\n<p>22). vi \/etc\/lighttpd\/external.conf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$HTTP&#91;\"host\"] == \"dns.mydomain.com\" {\n  # Ensure the Pi-hole Block Page knows that this is not a blocked domain\n  setenv.add-environment = (\"fqdn\" =&gt; \"true\")\n\n  # Enable the SSL engine with a LE cert, only for this specific host\n  $SERVER&#91;\"socket\"] == \":444\" {\n    ssl.engine = \"enable\"\n    ssl.pemfile = \"\/etc\/letsencrypt\/live\/dns.mydomain.com\/cert.pem\"\n    ssl.privkey = \"\/etc\/letsencrypt\/live\/dns.mydomain.com\/privkey.pem\"\n    ssl.ca-file =  \"\/etc\/letsencrypt\/live\/dns.mydomain.com\/fullchain.pem\"\n    ssl.honor-cipher-order = \"enable\"\n    ssl.cipher-list = \"EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH\"\n    ssl.use-sslv2 = \"disable\"\n    ssl.use-sslv3 = \"disable\"\n  }\n\n  # Redirect HTTP to HTTPS\n  $HTTP&#91;\"scheme\"] == \"http\" {\n    $HTTP&#91;\"host\"] =~ \".*\" {\n      url.redirect = (\".*\" =&gt; \"https:\/\/%0$0\")\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p>23). service lighttpd restart<\/p>\n\n\n\n<p>24). Login to the Cloud Panel and edit your firewall rules to allow the following TCP ports: 22, 53, 80, 443, 444, 853, and 8080 as well as UDP port: 53<\/p>\n\n\n\n<p>You have now setup and fully protected your PiHole Server.<\/p>\n\n\n\n<p>You can then set your router or any device on your home connection to use the IP of your server as your DNS Server. <\/p>\n\n\n\n<p>You can also use any device or OS that supports DoT to use your domain name for additional protection (Ex: dns.mydomain.com). On Android Phones this is called Private DNS but be aware that as you are only allowing it from the Home IP if you were to go to 4G you would lose the connection to the DNS Server. A workaround for this would be to use a App such as &#8220;Tasker&#8221; to automatically change your DNS Server when connecting to 4G to use a Publicly available option such as 1dot1dot1dot1.cloudflare-dns.com. More details about this can be read <a href=\"https:\/\/www.reddit.com\/r\/tasker\/comments\/9yvo2h\/android_p_private_dns_setting_access_in_tasker\/\">HERE<\/a>.<\/p>\n\n\n\n<p>DoT is not currently natively supported by Windows 10 but support may come in the future. In the meantime you can either use normal DNS or look for 3rd-party apps to add support for DoT to Windows.<\/p>\n\n\n\n<p>Currently we would recommend Stubby on Windows 10:<\/p>\n\n\n\n<p><a href=\"https:\/\/dnsprivacy.org\/wiki\/display\/DP\/Windows+installer+for+Stubby\">https:\/\/dnsprivacy.org\/wiki\/display\/DP\/Windows+installer+for+Stubby<\/a><\/p>\n\n\n\n<p>All you need to do with Stubby to use your pi-hole is to edit stubby.yml and remove all of the current Upstream servers and replace it with this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  - address_data: 74.208.X.X\n    tls_auth_name: \"dns.mydomain.com\"<\/code><\/pre>\n\n\n\n<p>We would also recommend editing stubby.yml with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>round_robin_upstreams: 0<\/code><\/pre>\n\n\n\n<p>To manage and check on your PiHole Server you can now go to https:\/\/dns.mydomain.com:444<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/scxreen.png\" alt=\"\" class=\"wp-image-693\" width=\"1154\" height=\"614\" srcset=\"https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/scxreen.png 2474w, https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/scxreen-300x160.png 300w, https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/scxreen-768x409.png 768w, https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/scxreen-1024x545.png 1024w\" sizes=\"(max-width: 1154px) 100vw, 1154px\" \/><\/figure>\n\n\n\n<p>Optional: Enable DoH (DNS over HTTPS)<\/p>\n\n\n\n<p>1). wget https:\/\/bin.equinox.io\/c\/VdrWdbjqyF\/cloudflared-stable-linux-amd64.rpm<\/p>\n\n\n\n<p>2). yum install .\/cloudflared-stable-linux-amd64.rpm<\/p>\n\n\n\n<p>3). mkdir \/etc\/cloudflared\/<\/p>\n\n\n\n<p>4). vi \/etc\/cloudflared\/config.yml<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>proxy-dns: true\nproxy-dns-port: 5053\nproxy-dns-upstream:\n  - https:\/\/1.1.1.1\/dns-query\n  - https:\/\/dns.google\/dns-query<\/code><\/pre>\n\n\n\n<p>5). cloudflared service install<\/p>\n\n\n\n<p>6). After performing these steps login to your pi-hole at:  https:\/\/dns.mydomain.com:444 <\/p>\n\n\n\n<p>7). Go to Settings &gt; DNS<\/p>\n\n\n\n<p>8). Uncheck all currently selected Upstream DNS Servers<\/p>\n\n\n\n<p>9). Hit the checkbox next to Custom 1 (IPv4) and use: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>127.0.0.1#5053<\/code><\/pre>\n\n\n\n<p>10). Hit save<\/p>\n\n\n\n<p>You can now enable it on any OS or program that supports it.<\/p>\n\n\n\n<p>After enabling this you can go to the link below to check your status:<\/p>\n\n\n\n<p><a href=\"https:\/\/1.1.1.1\/help\">https:\/\/1.1.1.1\/help<\/a><\/p>\n\n\n\n<p>To note it will only show DoH active even if DoT is also used. This is because Cloudflare is sending Pi-Hole DoH traffic and is unaware of your DoT connection from your client to Pi-Hole. The 2nd line in our config.yml has us connect to Google using DoH instead. This will only be used if CloudFlare&#8217;s DNS were to go offline.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/sc-754x1024.png\" alt=\"\" class=\"wp-image-703\" width=\"505\" height=\"685\" srcset=\"https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/sc-754x1024.png 754w, https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/sc-221x300.png 221w, https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/sc-768x1043.png 768w, https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/sc.png 809w\" sizes=\"(max-width: 505px) 100vw, 505px\" \/><\/figure>\n\n\n\n<p>In the end if DoT and DoH are used together the connection will be fully secured from end-to-end. DoT will secure the connection from your Home to Pi-Hole, and DoH will secure the connection between your server and the Upstream DNS provider (Cloudflare or Google).<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/complete-1-1024x310.png\" alt=\"\" class=\"wp-image-716\" width=\"930\" height=\"281\" srcset=\"https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/complete-1-1024x310.png 1024w, https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/complete-1-300x91.png 300w, https:\/\/server-help.org\/wp-content\/uploads\/2020\/05\/complete-1-768x232.png 768w\" sizes=\"(max-width: 930px) 100vw, 930px\" \/><\/figure>\n\n\n\n<p>Optional: Configure rotating Upstream DNS Providers.<\/p>\n\n\n\n<p>By default cloudflared will only use the secondary DoH DNS Server if the first is unavailable. If you would prefer to Rotate through your provider list continuously you can script this instead.<\/p>\n\n\n\n<p>In the example below we will rotate between Cloudflare, Google, and OpenDNS:<\/p>\n\n\n\n<p>1). Make a copy of your current config to create 3 in total:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cp \/etc\/cloudflared\/config.yml  \/etc\/cloudflared\/config-1.yml\ncp \/etc\/cloudflared\/config.yml  \/etc\/cloudflared\/config-2.yml\ncp \/etc\/cloudflared\/config.yml  \/etc\/cloudflared\/config-3.yml<\/code><\/pre>\n\n\n\n<p>2). vi \/etc\/cloudflared\/config-1.yml<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>proxy-dns: true\nproxy-dns-port: 5053\nproxy-dns-upstream:\n  - https:\/\/146.112.41.2\/dns-query\n  - https:\/\/dns.google\/dns-query\n  - https:\/\/1.1.1.1\/dns-query<\/code><\/pre>\n\n\n\n<p>3).  vi \/etc\/cloudflared\/config-2.yml <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>proxy-dns: true\nproxy-dns-port: 5053\nproxy-dns-upstream:\n  - https:\/\/1.1.1.1\/dns-query\n  - https:\/\/146.112.41.2\/dns-query\n  - https:\/\/dns.google\/dns-query<\/code><\/pre>\n\n\n\n<p>4).  vi \/etc\/cloudflared\/config-3.yml <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>proxy-dns: true\nproxy-dns-port: 5053\nproxy-dns-upstream:\n  - https:\/\/dns.google\/dns-query\n  - https:\/\/1.1.1.1\/dns-query\n  - https:\/\/146.112.41.2\/dns-query<\/code><\/pre>\n\n\n\n<p>5). Next create 3 new scripts<\/p>\n\n\n\n<p>vi \/scripts\/dns-change1.sh<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm \/etc\/cloudflared\/config.yml\ncp \/etc\/cloudflared\/config-1.yml \/etc\/cloudflared\/config.yml\ncloudflared service install --legacy\nsystemctl restart cloudflared<\/code><\/pre>\n\n\n\n<p>6).  vi \/scripts\/dns-change2.sh <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm \/etc\/cloudflared\/config.yml\ncp \/etc\/cloudflared\/config-2.yml \/etc\/cloudflared\/config.yml\ncloudflared service install --legacy\nsystemctl restart cloudflared<\/code><\/pre>\n\n\n\n<p>7).  vi \/scripts\/dns-change3.sh <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm \/etc\/cloudflared\/config.yml\ncp \/etc\/cloudflared\/config-3.yml \/etc\/cloudflared\/config.yml\ncloudflared service install --legacy\nsystemctl restart cloudflared<\/code><\/pre>\n\n\n\n<p>8). chmod +x \/scripts\/dns-change*<\/p>\n\n\n\n<p>9). Lastly add these entries into your crontab.<\/p>\n\n\n\n<p>crontab -e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>0 0 * * * \/scripts\/dns-change1.sh\n0 1 * * * \/scripts\/dns-change2.sh\n0 2 * * * \/scripts\/dns-change3.sh\n0 3 * * * \/scripts\/dns-change1.sh\n0 4 * * * \/scripts\/dns-change2.sh\n0 5 * * * \/scripts\/dns-change3.sh\n0 6 * * * \/scripts\/dns-change1.sh\n0 7 * * * \/scripts\/dns-change2.sh\n0 8 * * * \/scripts\/dns-change3.sh\n0 9 * * * \/scripts\/dns-change1.sh\n0 10 * * * \/scripts\/dns-change2.sh\n0 11 * * * \/scripts\/dns-change3.sh\n0 12 * * * \/scripts\/dns-change1.sh\n0 13 * * * \/scripts\/dns-change2.sh\n0 14 * * * \/scripts\/dns-change3.sh\n0 15 * * * \/scripts\/dns-change1.sh\n0 16 * * * \/scripts\/dns-change2.sh\n0 17 * * * \/scripts\/dns-change3.sh\n0 18 * * * \/scripts\/dns-change1.sh\n0 19 * * * \/scripts\/dns-change2.sh\n0 20 * * * \/scripts\/dns-change3.sh\n0 21 * * * \/scripts\/dns-change1.sh\n0 22 * * * \/scripts\/dns-change2.sh\n0 23 * * * \/scripts\/dns-change3.sh<\/code><\/pre>\n\n\n\n<p>Now your upstream DNS provider will change once every hour.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide we will show you how to properly setup and configure a VM running pi-hole for use as an ad filter on your home connection. While traditionally Pi-Hole is ran on a device hosted in your LAN it can also be ran remotely if proper precautions are taken. One of the benefits of&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/690"}],"collection":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/comments?post=690"}],"version-history":[{"count":28,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/690\/revisions"}],"predecessor-version":[{"id":840,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/posts\/690\/revisions\/840"}],"wp:attachment":[{"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/media?parent=690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/categories?post=690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server-help.org\/index.php\/wp-json\/wp\/v2\/tags?post=690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}