Tuesday, January 1, 2019

Turn Raspberry Pi Into Network Wide DNS Server

Turn your Raspberry Pi into a network wide DNS server for security, privacy and blocking Internet Ads on your private network!

Raspberry Pi 3 Model B+

With Technitium DNS Server version 2.2 release, it is now possible to run it on Raspberry Pi (Raspbian Stretch) using .NET Core and we have a single line automatic installer ready to make it easy to get it running.

Install DNS Server

Just connect to your Raspberry Pi using SSH and run the command below to install the DNS server:

curl -sSL https://download.technitium.com/dns/install.sh | sudo bash

You can install the software manually too if you do not wish to directly run the install script. You will need to first manually install .NET Core on your Raspberry Pi and then use these steps to install the DNS Server.

Once the installation is complete, open the DNS Server web console to view the dashboard and customize the settings.

Technitium DNS Server web console on Raspberry Pi 3 Model B+

Configure Your Router

To use it as a network wide DNS server, you need to configure your network router's DHCP settings and add your Raspberry Pi's IP address as a custom DNS server. You may also need to configure the WAN settings to override the default ISP provided DNS servers with your Raspberry Pi one. Check your router's manual for the configuration details.

Do make sure that your Raspberry Pi has a static IP address so that it does not change later causing issues with failed domain resolutions on the entire network. Also make sure to install heat sinks for your Raspberry Pi to prevent overheating issues since you will be running it round the clock.

If you have any queries or feedback, do comment below to let me know. You can also email your queries to support@technitium.com.

Quick And Easy Guide To Install .NET Core On Raspberry Pi

.NET Core is a cross-platform runtime available for x64 and ARM processors that can be used to run ASP.NET Core web applications and standalone .NET Core console applications on Windows, Linux and macOS.

Installing .NET Core is straight forward for most Desktop platforms with clear instructions available on the download website. However, many would find it trickier to install it on something like Raspberry Pi which uses ARM based processor. So, here is a quick and easy guide to install .NET Core 2.2 on Raspberry Pi 3 Model B+ with the latest Raspbian that is based on Debian 9 (Stretch).

Connect to your Raspberry Pi using SSH and get started!

Raspberry Pi 3 Model B+

Installing Dependencies

First you need to install a few dependencies required by the .NET Core runtime:

sudo apt-get -y update
sudo apt-get -y install curl libunwind8 gettext apt-transport-https

Installing .NET Core

Go to the .NET Core download page and download the Linux ARM32 runtime. Or you could just copy the download URL from there to use with wget like I did and follow these steps:

wget https://download.visualstudio.microsoft.com/download/pr/860e937d-aa99-4047-b957-63b4cba047de/da5ed8a5e7c1ac3b4f3d59469789adac/aspnetcore-runtime-2.2.0-linux-arm.tar.gz
sudo mkdir -p /opt/dotnet
sudo tar -zxf aspnetcore-runtime-2.2.0-linux-arm.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/bin

Now just enter dotnet on the command line to confirm.

Its Done!

Now you are ready to run ASP.NET Core or .NET Core console apps on your Raspberry Pi!