Skip to content

Commit

Permalink
Update dns
Browse files Browse the repository at this point in the history
  • Loading branch information
omidraha committed Nov 16, 2018
1 parent 6b86f8c commit 7cfb767
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 35 deletions.
137 changes: 106 additions & 31 deletions src/linux/dns.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,43 +42,66 @@ which "can be used directly as your local resolver or as a DNS forwarder,

authenticating requests using the DNSCrypt protocol and passing them to an upstream server".


Check current local DNS service:

.. code-block:: bash
$ sudo ss -lp 'sport = :domain'
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 23040 0 127.0.0.53%lo:domain 0.0.0.0:* users:(("systemd-resolve",pid=948,fd=12))
tcp LISTEN 0 128 127.0.0.53%lo:domain 0.0.0.0:* users:(("systemd-resolve",pid=948,fd=13))
Disable `systemd-resolve` service according to the above output:


.. code-block:: bash
$ sudo systemctl stop systemd-resolved
$ sudo systemctl disable systemd-resolved
Check current local DNS service again:

.. code-block:: bash
$ sudo ss -lp 'sport = :domain'
Uninstall old version:

.. code-block:: bash
$ apt-get install dnscrypt-proxy
$ sudo apt-get purge dnscrypt-proxy
# vim /lib/systemd/system/dnscrypt-proxy.socket
[Socket]
ListenStream=
ListenDatagram=
ListenStream=127.0.0.1:40
ListenDatagram=127.0.0.1:40
# vim /etc/resolv.conf
nameserver 127.0.0.1
Install new version:

.. code-block:: bash
# no needs to run manually, currently run with system and listen on `127.0.0.1:40`
## dnscrypt-proxy -R adamas --local-address=127.0.0.1:40
$ sudo add-apt-repository ppa:shevchuk/dnscrypt-proxy
$ sudo apt update
$ sudo apt install dnscrypt-proxy
# systemctl status dnscrypt-proxy
Configs:

.. code-block:: bash
$ sudo vim /etc/default/dnscrypt-proxy
# https://github.com/dyne/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv
DNSCRYPT_PROXY_RESOLVER_NAME=4armed # cisco, cs-cfi, cloudns-syd ..
$ sudo cat /etc/resolv.conf
The ``dnsmasq`` can be used as both ``dhchp`` and ``dns server``.
# Generated by NetworkManager
nameserver 127.0.2.1
Here we configure it to use with ``dnscrypt-proxy``
.. code-block:: bash
$ dnsmasq
# vim /etc/dnsmasq.conf
no-resolv
server=127.0.0.1#40
listen-address=127.0.0.1
# systemctl restart dnsmasq
$ cat /etc/dnsmasq.d/dnscrypt-proxy
# Redirect everything to dnscrypt-proxy
no-resolv
server=127.0.2.1
proxy-dnssec
Now you can see all your dns query is secured with type ``quic`` on the filter box of ``wireshark``

Expand All @@ -87,20 +110,33 @@ And view related listening port:
.. code-block:: bash
# netstat -uanp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 127.0.0.1:40 0.0.0.0:* 1/init
udp 0 0 0.0.0.0:53 0.0.0.0:* 3089/dnsmasq
udp 0 0 0.0.0.0:68 0.0.0.0:* 2000/dhclient
udp 0 0 0.0.0.0:68 0.0.0.0:* 2221/dhclient
udp 0 0 0.0.0.0:33908 0.0.0.0:* 853/dnscrypt-proxy
udp6 0 0 :::53 :::* 3089/dnsmasq
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 127.0.0.1:40 0.0.0.0:* 1/init
udp 0 0 0.0.0.0:53 0.0.0.0:* 3089/dnsmasq
udp 0 0 0.0.0.0:68 0.0.0.0:* 2000/dhclient
udp 0 0 0.0.0.0:68 0.0.0.0:* 2221/dhclient
udp 0 0 0.0.0.0:33908 0.0.0.0:* 853/dnscrypt-proxy
udp6 0 0 :::53 :::* 3089/dnsmasq
Check service status:

.. code-block:: bash
$ sudo systemctl status dnscrypt-proxy
https://github.com/jedisct1/dnscrypt-proxy

https://wiki.archlinux.org/index.php/DNSCrypt

https://github.com/jedisct1/dnscrypt-proxy/wiki/Installation-linux

https://github.com/jedisct1/dnscrypt-proxy/wiki/Installation-Debian-Ubuntu


resolveconf
+++++++++++

Expand Down Expand Up @@ -248,3 +284,42 @@ Resolve all domain name to specific IP
$ sudo systemctl restart dnsmasq
The `192.168.1.10` is address of dns server( local host machine)




Disable systemd-resolved
------------------------

That `systemd-resolved` cannot be uninstalled, but can be disabled with the following commands:

.. code-block:: bash
$ sudo systemctl disable systemd-resolved.service
$ sudo systemctl stop systemd-resolved
Check possibly already listening to port 53
-------------------------------------------

.. code-block:: bash
$ ss -lp 'sport = :domain'
Install proxychains4
--------------------

.. code-block:: bash
$ apt-get install proxychains4
.. code-block:: bash
$ proxychains4 curl google.com
https://github.com/rofl0r/proxychains-ng
8 changes: 4 additions & 4 deletions src/vcs/git.rst
Original file line number Diff line number Diff line change
Expand Up @@ -636,14 +636,14 @@ Add tag and merge dev to mater
.. code-block:: bash
git checkout dev
proxychains git pull
git pull
git tag -a 2.0.1 -m "2.0.1"
proxychains git push --follow-tags
git push --follow-tags
git checkout master
proxychains git pull
git pull
git merge dev
proxychains git push --follow-tags
git push --follow-tags
git checkout dev
Expand Down

0 comments on commit 7cfb767

Please sign in to comment.