Creating a Raspberry Pi Hotspot with AdGuard DNS using the internet connection via Ethernet
In this article, we will guide you on how to set up a Raspberry Pi Hotspot with AdGuard DNS using the internet connection via Ethernet. This process will help you to provide a WLAN network with AdGuard DNS, consuming the internet via Ethernet.
Prerequisites
- Raspberry Pi 2 (Latest Raspberry Pi OS Lite 32-bit)
- Ethernet cable
- Wi-Fi adapter (if your Raspberry Pi doesn't have built-in Wi-Fi)
Step 1: Install Raspberry Pi OS Lite
First, download the Raspberry Pi OS Lite image from the official Raspberry Pi website. After downloading, write the image to an SD card using a tool like BalenaEtcher. Insert the SD card into your Raspberry Pi and boot it up.
Step 2: Update and Upgrade
Connect your Raspberry Pi to the internet via Ethernet and run the following commands to update and upgrade the system:
sudo apt-get update
sudo apt-get upgrade
Step 3: Install DHCP Server
Install the DHCP server to provide IP addresses to the devices connected to the Raspberry Pi Hotspot:
sudo apt-get install isc-dhcp-server
Step 4: Configure DHCP Server
Edit the DHCP server configuration file using the following command:
sudo nano /etc/dhcpcd.conf
Add the following lines to the file:
denyinterfaces eth0
denyinterfaces wlan0
Save and close the file.
Step 5: Configure DHCP Server for Hotspot
Create a new file named dhcpcd.conf.5 in the /etc/dhcp directory:
sudo nano /etc/dhcp/dhcpcd.conf.5
Add the following content to the file:
interface wlan0
static ip_address=192.168.4.1/24
static routers=192.168.4.2
static domain_name_servers=127.0.0.1
Save and close the file.
Step 6: Install AdGuard DNS
Install AdGuard DNS by running the following command:
curl -s https://raw.githubusercontent.com/AdguardTeam/adguardhome/master/scripts/install.sh | sh
Step 7: Configure AdGuard DNS
Edit the AdGuard DNS configuration file using the following command:
sudo nano /etc/adguardhome/config.yaml
Add the following lines to the file:
interfaces:
- wlan0
- eth0
web:
enabled: false
dns:
enabled: true
upstream:
- 8.8.8.8
- 8.8.4.4
filtering:
enabled: true
domains:
- example.com
- another-example.com
Save and close the file.
Step 8: Start AdGuard DNS and DHCP Server
Start the AdGuard DNS and DHCP server services:
sudo systemctl start adguardhome
sudo systemctl start isc-dhcp-server
sudo systemctl enable isc-dhcp-server
Step 9: Enable Wi-Fi
If your Raspberry Pi doesn't have built-in Wi-Fi, insert the Wi-Fi adapter and enable it:
sudo raspi-config
Navigate to Interfacing Options -> Enable Wireless LAN -> Yes and follow the on-screen instructions.
Step 10: Connect to Hotspot
Reboot your Raspberry Pi and connect to the Raspberry Pi Hotspot using the network name RaspberryPi_Hotspot and the password raspberry.
Summary
In this article, we covered how to set up a Raspberry Pi Hotspot with AdGuard DNS using the internet connection via Ethernet. By following the steps outlined, you can provide a WLAN network with AdGuard DNS, consuming the internet via Ethernet on your Raspberry Pi.
References