From d6ee581af8c48f47d86e419e84a868cf9327c49c Mon Sep 17 00:00:00 2001 From: vgenguita Date: Mon, 9 Aug 2021 13:57:19 +0200 Subject: [PATCH] Updated README.md with examples --- README.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e105bf6..3ae19ad 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,14 @@ A collection of config files in order to easily deploy it on a Freebsd Jail. A simple adblock dns server. Simplified version of [https://vlads.me/post/setting-up-dns-adblocker-freebsd-jail/](https://vlads.me/post/setting-up-dns-adblocker-freebsd-jail/) -**host requisites** +### **PRE INSTALL** * csh shell (Available by default in FreeBSD) * wget and diff to compare files if required ```Console - pkg install wget diffutils + root@host:/ # pkg install wget diffutils ``` * An empty or existing jail @@ -23,11 +23,65 @@ A simple adblock dns server. Simplified version of [https://vlads.me/post/settin ``` -**Use it** +### **INSTALL** Just launch .sh script passing an existing jail name as argument ```console -./dnsmasq_jail.sh jailName +user@host:/ # ./dnsmasq_jail.sh jailName +``` + +### **POST INSTALL** + +Pass port from jail to host with pf or prefered firewall. +Example for /etc/pf.conf + +```Shell +dns="{53}" +rdr on $ext_if proto udp from any to any port $dns-> $jail_ip +``` +Check config on jail + +```console +user@host:/ # jexec jail +user@jail:/ # dnsmasq --test +dnsmasq: syntax check OK. +``` +For test before launch service + +On Jail + +```console +user@jail:/ # dnsmasq -d -q +``` + +On host dns query asking to jail ip + +```console +user@host:/ # drill freebsd.org @192.168.35.4 +;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 15521 +;; flags: qr rd ra ; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 +;; QUESTION SECTION: +;; freebsd.org. IN A + +;; ANSWER SECTION: +freebsd.org. 3600 IN A 96.47.72.84 + +;; AUTHORITY SECTION: + +;; ADDITIONAL SECTION: + +;; Query time: 71 msec +;; SERVER: 192.168.35.4 +;; WHEN: Mon Aug 9 13:53:29 2021 +;; MSG SIZE rcvd: 45 +``` + +Finally, launch dnsquery service on jail + +```console +user@host:/ # jexec jail +user@jail:/ # service dnsmasq start +Starting dnsmasq. ```