Zack Scholl

Setting up wireguard+pihole with Ubuntu and other devices

 / #linux 

The simplest+cheapest way I found to get a personal Wireguard VPN with Pihole.

  1. Get a $4/month Droplet on DigitalOcean with the Pihole+VPN (in the Marketplace). This automatically sets up Pihole with Wireguard support.
  2. Login to the droplet and run ./ X where X is the number of keys you want to generate. This will generate QR codes that you can load into your phone/iPad via the wireguard app.
  3. Phone/iPad skips to step 4. Get it working on Ubuntu. Copy one of the interfaces to /etc/wireguard/wg0.conf. The full thing looks like:
Address = ...
DNS = ...
PrivateKey = ...

Endpoint = ...
PersistentKeepalive = ...
PublicKey = ...
PresharedKey = ...
AllowedIPs = ...

Now install wireguard:

sudo apt update
sudo apt install wireguard

Now, depending on the system you need to fix resolveconf:

sudo ln -s /usr/bin/resolvectl /usr/local/bin/resolvconf
  1. Now start wireguard! On the phone you just click a button. In Ubuntu you do:
sudo wg-quick up wg0

Get stats with

sudo wg show wg0

Turn it off with

sudo wg-quick down wg0
  1. Enjoy ad-less browsing with a VPN.