Use Raspberry PI 4 model B as Local Network Private DNS server on Ubuntu

Tested on the following Ubuntu Version

  • Ubuntu 19.10 (eoan)

There’s not much configuration change when configuring Bind 9 on an ARM architecture over an x86 or x64 this steps can be interchangeable except for different Linux distro which places default configuration files on a different folder (e.g CentOS uses /etc/named while Ubuntu uses /etc/bind) or some preset configurations has already been set and default config locations.

Step 1

Install Bind 9 DNS Server, Bind 9 Utilities and Bind 9 Docs

sudo apt install bind9 bind9utils dnsutils bind9-doc

Step 2

Make sure Bind 9 uses only IPv4, add named arguments for IPv4:

sudo vi /etc/default/bind9

Then add -4 on OPTIONS

# run resolvconf?

# startup options for the server
OPTIONS="-4 -u bind"

Step 3

After installation we’re gonna remove some preset. First, open /etc/bind/named.conf.options

sudo vi /etc/bind/named.conf.options

Then remove the following line:

listen-on-v6 { any; };

Then add the following inside options { ... };

// Allow dns query on localhost and all host within the subnet
allow-query     { localhost;; };
// Listen on port 53 with any IP or host (This is the default). 
// In case you're using DHCP for your IP 
// or there are not any statically assigned IP for you NS. 
// You can also use your subnet's CIDR.
listen-on port 53 {any;}

Step 4

Now, we’re gonna add Zone configuration and configure each zone files.

sudo vi /etc/bind/named.conf.default-zones

For CentOS/Fedora, the default file can be at /etc/named.conf.local Then add the following line:

zone "" {
    type master;
    file "/etc/bind/db.1.168.192";
    allow-update { none; };

zone "" {
    type master;
    file "/etc/bind/";
    allow-update { none; };

Step 5

After setting up the zone info, we’ll now proceed at configuring each zone. First create /etc/bind/ and add the following:

TTL    604800
@    IN    SOA (
     6        ; Serial
     604800   ; Refresh
     86400    ; Retry
     2419200  ; Expire
     604800 ) ; Negative Cache TTL
; name servers - NS records
    IN    NS
; name servers - A records
ns1      IN    A
desktop  IN    A

Next, create the reverse lookup record, /etc/bind/db.1.168.192

$TTL 604800
@ IN SOA (
          5     ; Serial
    6048000     ; Refresh
      86400     ; Retry
    2419200     ; Expire
     604800 )   ; Negative Cache TTL
@  IN NS
; PTR Records
101    IN    PTR     ;
200    IN    PTR ;

Step 6

After creating DNS record, we’ll have to test the configuration. To check the configuration files for error run named-checkconfig

sudo named-checkconfig

This will output the error and on which specific line the error occurred on your config file. It won’t output any if there are no error on your configurations. For your zone file, we’ll use named-checkzone. This requires you to input the zone name and zone file. In our case, we’ll do the following:

sudo named-checkzone
sudo named-checkzone db.1.168.192

It will output OK if no issues are found in your zone file/s.

Step 7

When all configurations are set we’ll have to start/restart the bind9 service.

sudo server bind9 start

Step 8

Make sure you have set your new server as the default or primary DNS on you client/s. To check if your client can now query from your DNS, do the following:

# use `@` to query on the specific DNS
# We're using `localhost` since we're inside the DNS
#   if you're on your client, you have to provide the DNS IP
dig @localhost
# For reverse lookup
dig -x @localhost

# Don't point to the DNS if you already have configured your
#   client's network interface's DNS, 
#   pointing at your new server
# For reverse lookup
dig -x


  1. MIT Bind Config
  2. ISC: Bind 9 Documentation
  3. ISC: Bind 9.14 named.conf Docs

Written with StackEdit.

Install PlatformIO Binaries in Ubuntu Linux

Step 1 (Optional)

Before doing this step, make sure you already have installed Python’s distutils . To do this, run the command below:

sudo apt-get install python3-distutils

Step 2

Get and run the installer:

python3 -c "$(curl -fsSL"

Step 3

Create symbolic links to /usr/local/bin

sudo ln -s ~/.platformio/penv/bin/platformio /usr/local/bin/platformio
sudo ln -s ~/.platformio/penv/bin/pio /usr/local/bin/pio
sudo ln -s ~/.platformio/penv/bin/piodebuggdb /usr/local/bin/piodebuggdb

Note: After this, you can now use PlatformIO plugin in Clion without hiccups


  1. PlatformIO Utility Installation

Written with StackEdit.