How to Install personalDNSfilter in Linux

How to Install personalDNSfilter in Linux

@pDNSf

To support the excellent work of Ize

and help spread the use of pDNSf I offer the following:


❗❗(UPDATE:2020/07/18): Fixing Error 53 has become easier

- updated sections: "ERROR 53 fix" and "Step 6".

- new section: " 9. Temporarily Stopping pDNSf "


📌HOW TO INSTALL PERSONAL DNS FILTER (pDNSf) IN LINUX

===================================================


Note:

This following example worked on an 

 Acer Aspire A135 with 

 xubuntu 19.04


1. Install Java Runtime


(version openjdk-11-jre-headless Java Runtime 11.0.4 works)
- verify it's correctly installed in terminal :
 java -version


2. Download Full pDNSf Package

From here:

https://www.zenz-solutions.de/personaldnsfilter/


3. Extract this zip

In this directory:

 /home/YOURNAME/


4. To test - in a terminal - run pdnsf - by


sudo java -cp ./personalDNSfilter.jar dnsfilter.DNSFilterProxy


If there is no error skip to step 5. below ...


===⚠️ERROR 53 fix⚠️===


If you get the "port 53" error ...

"Exception:Cannot open DNS port 53!Address already in use (Bind failed)"


a) ❗ First, make sure you have pDNSf version "1.50.41.0" or later.


b) Edit dnsfilter.conf at the /home/YOURNAME/personalDNSfilter/ and find the following line and change the number "53" to any other free port in your system (between 1024 and 65535) and save the changes. here, we are going to use port 5300 for example.

before:

dnsProxyPortNonAndroid = 53

after:

dnsProxyPortNonAndroid = 5300


c) Done! 🔴 Make sure you have re-read the updated "Step 6" 👁‍👁‍


d) Finally RE-START pDNSf


 sudo java -cp ./personalDNSfilter.jar dnsfilter.DNSFilterProxy



If all is well you will see something like ...


Initializing PersonalDNSFilter Version 1504100!

Using Directory: 

DNS detection not supported for this device

DNS detection not supported - Using fallback!

DNS:8.8.8.8

DNS:8.8.4.4

DNSFilterProxy running on port 5300!

... .... ..... etc ...


:)


==============================


5. Time to config and manage pDNSf ...

Here are 2 methods to apply your desired configs:

- DIRECT METHODS:

a) edit dnsfilter.conf at the /home/YOURNAME/personalDNSfilter/

OR

b) Copy the personalDNSfilter folder from your phone or tablet etc to laptop /home/YOURNAME/

- REMOTE METHOD:

Remotely control and manage your pDNSf settings with your Android phone or tablet, while connected to same network. for this purpose, you need a one-time configuring of your PC and phone client:

⚙ In your PC:

  • open /home/YOURNAME/personalDNSfilter/dnsfilter.conf with editor
  • find the line "server_remote_ctrl_keyphrase = " and remove "Change This Default Keyphrase!" and set your desired password to be used when connecting phone (the client) to your PC (the server).
  • change the line "server_remote_ctrl_port = " from "-1" to an (unsed) desired port (for example 3333 or 8080 etc.)

⚙ Then, in your phone:

  • open personalDNSfilter/dnsfilter.conf with a text editor
  • change "client_remote_ctrl_host = " from 0.0.0.0 to the network IP of your PC.
  • change "client_remote_ctrl_keyphrase = " to the password you have set in your PC (in the above steps).
  • change "client_remote_ctrl_port = " to the port you have set in your PC.
  • open pDNSf app and select the following icon to connect to the app in your PC:
  • Done! From now on, you can manage the PC version with your Android phone! :)


6. To set things up to run pDNSf on the PC at START UP 

you need to create 2 small files.


1️⃣ Create a BASH shell script file called


 /home/YOURNAME/start.sh


This file will do 2 things 

 - Forward the port 53 to port 5300 to redirect dns requests to pDNSf
 - execute pDNSf


edit start.sh to contain these 8 lines


#!/bin/bash
# cleanup previous runs
sudo iptables -t nat -D PREROUTING -p udp --dport 53 -j REDIRECT --to-port 5300
sudo iptables -t nat -D OUTPUT -p udp --dport 53 -j DNAT --to-destination 127.0.0.1:5300
# add the new forwarding
sudo iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-port 5300
sudo iptables -t nat -I OUTPUT -p udp --dport 53 -j DNAT --to-destination 127.0.0.1:5300
sudo java -cp ./personalDNSfilter.jar dnsfilter.DNSFilterProxy



2️⃣ Create a DESKTOP ENTRY FILE called - pdnsf.desktop


containing these 11 lines


[Desktop Entry]
Name=pDNSf
Comment=personal dns filter
Exec=/home/YOURNAME/start.sh
Icon=/home/YOURNAME/pdnsf.logo.svg
MimeType=
Terminal=true
Type=Application
StartupNotify=true
Categories=
Keywords=pdnsf


7. Get an ICON for pDNSf


Copy the pdnsf icon found on the github website here ...

https://github.com/IngoZenz/personaldnsfilter/blob/master/personalDNSfilter_icon.zip


Download the icon, unzip and copy it to ...


 /home/YOURNAME/ 


Rename the icon ...


 pdnsf.logo.svg


8. LAST STEP


Copy the DESKTOP ENTRY FILE you created above

called - pdnsf.desktop - to 2 locations


 /home/YOURNAME/Desktop/

and

 /home/YOURNAME/.config/autostart/



Upon re-starting your laptop, pDNSf will ask for a password and then run


In addition you can re-run pDNDf from your desktop by clicking on the icon.


You're done!



============================

9. Temporarily Stopping pDNSf :

⚠⚠❗ Note: if you want to temporarily stop using pDNSf for any reason, close the terminal in which pDNSf is running, then run the following 2 commands in a terminal:

sudo iptables -t nat -D PREROUTING -p udp --dport 53 -j REDIRECT --to-port 5300
sudo iptables -t nat -D OUTPUT -p udp --dport 53 -j DNAT --to-destination 127.0.0.1:5300

Report Page