Git Product home page Git Product logo

rajannpatel / pi-hole-on-google-compute-engine-free-tier-with-full-tunnel-and-split-tunnel-wireguard-vpn-configs Goto Github PK

View Code? Open in Web Editor NEW
760.0 34.0 76.0 1.41 MB

Run your own privacy-first ad blocking service at home, or in the cloud for free with Google Cloud Services.

License: MIT License

wireguard-vpn wireguard-vpn-setup wireguard-tunnel split-tunnel vpn vpn-server vpn-client pihole pi-hole kernel

pi-hole-on-google-compute-engine-free-tier-with-full-tunnel-and-split-tunnel-wireguard-vpn-configs's Introduction

Pi-hole + Wireguard on Ubuntu 24.04 LTS with Google Cloud's free tier, via cloud-init

The goal of this project is to enable you to safely and privately use the Internet on your phones, tablets, and computers with a self-run VPN Server on Google Cloud's free tier. This will cost $0 to use anywhere in the world, except for data egress fees when connecting to the VPN from China and Australia. This software shields you from intrusive advertisements in apps and websites on any connected device and computer. It blocks your ISP, cell phone company, public WiFi hotspot provider, and apps or websites from gaining insight into your usage activity.

Both Full Tunnel (all traffic) and Split Tunnel (DNS traffic only) VPN connections provide DNS based ad-blocking over an encrypted connection to the cloud. The differences are:

  • A Split Tunnel VPN allows direct interaction with devices on your Local Network (such as a Chromecast or Roku), but blocks DNS based discovery of local devices.
  • A Full Tunnel VPN can help bypass misconfigured proxies on corporate WiFi networks, protects you from Man-In-The-Middle SSL proxies, and obfuscates IP address based geolocation by making the device appear like it is located where the VPN server is running.
Tunnel Type Data Usage Server CPU Load Security Ad Blocking
full +10% overhead for vpn low 100% encryption yes
split just kilobytes per day very low dns encryption only yes

Install and configure the gcloud CLI

This guide assumes you are running the following commands in a Linux environment. Windows or macOS users can get an instant Linux virtual machine on their computer with Multipass.

  1. Install the gcloud CLI

    sudo snap install google-cloud-cli --classic
    
  2. Connect gcloud CLI with your Google Cloud account

    gcloud init
    
    1. Enter Y when prompted with Would you like to log in (Y/n)?
    2. Visit the authentication link which starts with https://accounts.google.com/
    3. Sign in with a Google account
    4. Click Allow to grant access to the Google Cloud SDK
    5. Click Copy to copy the verification code
    6. Paste the verification code into the terminal window where the gcloud init process is running

    If you complete the gcloud init process successfully, you will receive the following output:

    You are now logged in as [[email protected]].
    Your current project is [None].  You can change this setting by running:
    $ gcloud config set project PROJECT_ID
    

Provision resources and deploy

  1. List the projects that are in your account:

    gcloud projects list
    

    You’ll receive output similar to:

    PROJECT_ID        NAME              PROJECT_NUMBER
    project-id        project-name      12345678910
    
  2. Set your Project ID to the PROJECT_ID environment variable. Replace project-id with your personal Project ID from the previous output:

    PROJECT_ID=project-id
    

    This step isn’t required, but it’s recommended because the PROJECT_ID variable is used often.

  3. Associate gcloud CLI to this PROJECT_ID:

    gcloud config set project $PROJECT_ID
    

    This is where the adblocker virtual machine (VM) will be launched.

  4. List the available cloud zones and cloud regions where VMs can be run:

    gcloud compute zones list
    

    You’ll receive output similar to:

    NAME                       REGION                   STATUS  NEXT_MAINTENANCE  TURNDOWN_DATE
    us-east1-b                 us-east1                 UP
    
  5. Only us-west1, us-central1, and us-east regions qualify for Google Cloud's free tier. Set the ZONE and REGION environment variables by replacing us-east1-b and us-east1 in the example commands below, with your desired zone and region:

    ZONE=us-east1-b
    REGION=us-east1
  6. Reserve a static IP address and label it "pihole-external-ip":

    gcloud compute addresses create pihole-external-ip --region=$REGION
    
  7. Use curl to download the cloud-init YAML.

    sudo apt install -y curl
    curl -s https://raw.githubusercontent.com/rajannpatel/Pi-Hole-on-Google-Compute-Engine-Free-Tier-with-Full-Tunnel-and-Split-Tunnel-Wireguard-VPN-Configs/master/cloud-init.yaml -o cloud-init.yaml
    
  8. Open the file in an editor to change configurations specified between lines 4 and 36. The default values that have been provided will work, but changing the value for WEBPASSWORD from pAs5word to another alphanumeric string is recommended. Setting TOKEN with an Ubuntu Pro token is strongly recommended, and results in Livepatch being successfully enabled.

    # SET OUR VARIABLES
    # =================
    
    # TIME TO REBOOT FOR SECURITY AND BUGFIX PATCHES IN XX:XX FORMAT
    SECURITY_REBOOT_TIME = "03:00"
    
    # TIME TO UPDATE AND UPGRADE PIHOLE IN XX:XX:XX FORMAT
    PIHOLE_UPDATE_TIME = "05:00:00"
    
    # ALPHANUMERIC PIHOLE WEB ADMIN PASSWORD
    {% set WEBPASSWORD = 'pAs5word' %}
    
    # UBUNTU PRO TOKEN FROM https://ubuntu.com/pro/dashboard
    # leave blank when using Ubuntu Pro instances on Azure, AWS, or Google Cloud
    {% set TOKEN = '' %}
    
    # WIREGUARD CONFIGURATIONS
    {% set SERVER_WG_NIC = 'wg0' %}
    {% set SERVER_WG_IPV4 = '10.66.66.1' %}
    {% set SERVER_WG_IPV6 = 'fd42:42:42::1' %}
    {% set SERVER_PORT = '51515' %}
    
    # TIMEZONE: as represented in /usr/share/zoneinfo. An empty string ('') will result in UTC time being used.
    {% set TIMEZONE = 'America/New_York' %}
    
    # HOSTNAME: subdomain of FQDN (e.g. `server` for `server.yourdomain.com`)
    {% set HOSTNAME = 'pihole' %}
    
    # DOMAIN (e.g. `yourdomain.com`)
    {% set DOMAIN = '' %}
    
    # =========================
    # END OF SETTING VARIABLES
  9. Run the following command to launch an e2-micro virtual machine named "adblocker":

    gcloud compute instances create adblocker \
        --zone=$ZONE \
        --machine-type=e2-micro \
        --address=pihole-external-ip \
        --tags=wireguard \
        --boot-disk-size=10 \
        --image-family=ubuntu-2404-lts-amd64 \
        --image-project=ubuntu-os-cloud \
        --metadata-from-file=user-data=cloud-init.yaml
  10. Allow your "adblocker" virtual machine to receive incoming UDP Wireguard VPN connections on Port 51515, as defined by SERVER_PORT in Step 8 above.

    gcloud compute firewall-rules create allow-udp-51515 \
        --direction=INGRESS \
        --action=ALLOW \
        --target-tags=wireguard \
        --source-ranges=0.0.0.0/0 \
        --rules=udp:51515 \
        --description="Allow UDP traffic on port 51515 for adblocker"
  11. Observe the progress of your installation by tailing the /var/log/cloud-init-output.log file on the virtual machine:

    gcloud compute ssh adblocker --zone $ZONE --command "tail -f /var/log/cloud-init-output.log"
    
  12. If you are a first time gcloud CLI user, you’ll be prompted for a passphrase twice. This password can be left blank, press Enter twice to proceed:

    WARNING: The private SSH key file for gcloud does not exist.
    WARNING: The public SSH key file for gcloud does not exist.
    WARNING: You do not have an SSH key for gcloud.
    WARNING: SSH keygen will be executed to generate a key.
    Generating public/private rsa key pair.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    
  13. A reboot may be required during the cloud-init process. If a reboot is required, you’ll receive the following output:

    2023-08-20 17:30:04,721 - cc_package_update_upgrade_install.py[WARNING]: Rebooting after upgrade or install per /var/run/reboot-required
    

    If the IMAGE_FAMILY specified earlier contained all the security patches, this reboot step may not occur.

  14. Repeat the following code if a reboot was necessary to continue observing the progress of the installation:

    gcloud compute ssh adblocker --zone $ZONE --command "tail -f /var/log/cloud-init-output.log"
    
  15. Wait until the cloud-init process is complete. When it's complete, you’ll receive two lines similar to this:

    Cloud-init v. 24.1.3-0ubuntu3.3 finished at Thu, 20 Jun 2024 03:53:16 +0000. Datasource DataSourceGCELocal.  Up 666.00 seconds
    
  16. Press CTRL + C to terminate the tail process in your terminal window.

Configure and test your Wireguard tunnels

  1. SSH into the adblocker instance, and run the wireguard command. Press 1 to create a VPN tunnel for a new user, and accept the default values for the wizard's prompts.

    sudo wireguard
    
  2. The generated .conf file will create a Split Tunnel VPN connection by default. This configuration will be reflected in the generated QR code, which can be scanned in the Wireguard mobile apps. The tunnel configuration can be edited from within the Wireguard mobile app, if you wish to have a full tunnel connection. Replace the contents of Allowed IPs with 0.0.0.0/0 to route all traffic through Google Cloud. If you edit the .conf file on the server, you will need to regenerate the QR code to reflect this configuration change. The command to regenerate the QR code is:

    qrencode -t ansiutf8 -l L <"~/wg0-client-name.conf"
    
  3. You can verify if your Full Tunnel VPN configuration is working by visting http://checkip.amazonaws.com from your device. If it shows the IP address of your Google Cloud virtual machine, then all traffic is routing through there.

  4. You can verify if your Pi-hole DNS settings are working visiting dnsleaktest.com and performing an Extended Test. It should only query DNS servers configured in your Pi-hole. It will use the closest Google DNS servers to your Google Cloud virtual machine, by default.

Configure Pi-hole

  1. Connect to your adblocker virtual machine with a newly created Wireguard tunnel. To configure your Pi-hole, visit http://10.66.66.1/admin from the VPN connected device.

How to delete everything, if you wish to start over

THE FOLLOWING STEPS WILL DELETE WHAT YOU HAVE CREATED, ABOVE

This is how to remove the "adblocker" VM, its static IP address, and its firewall rules.

  1. List all the addresses you’ve created:

    gcloud compute addresses list
    
  2. To delete the address named "pihole-external-ip" we created earlier:

    gcloud compute addresses delete pihole-external-ip --region=$REGION
    
  3. List all VMs in this project:

    gcloud compute instances list
    
  4. To delete the "adblocker" VM we created earlier:

    gcloud compute instances delete INSTANCE_NAME --zone $ZONE
    
  5. List all firewall rules in this project:

    gcloud compute firewall-rules list
    
  6. To delete the "allow-udp-51515" firewall rules we created earlier:

    gcloud compute firewall-rules delete allow-udp-51515
    

Contributions Welcome

If there is something that can be done better, or if this documentation can be improved in any way, please submit a Pull Request with your fixes or edits.

Contributors should be aware of REASONS.md, which explain the factors behind choices made throughout this guide.

Please review the Issues if you are in a position to help others, or participate in improving this project.

pi-hole-on-google-compute-engine-free-tier-with-full-tunnel-and-split-tunnel-wireguard-vpn-configs's People

Contributors

cwmoriarty avatar dalcon007 avatar gmngeoffrey avatar kwbmm avatar leggiero avatar rajannpatel avatar simmeh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pi-hole-on-google-compute-engine-free-tier-with-full-tunnel-and-split-tunnel-wireguard-vpn-configs's Issues

Change country

Is there anyway to get an IP from another country without paying? I'm from Spain and a lot of websites are blocks, for example football webs. I would like to change my location to France and get access to those webs.
The only that I have found is to hire a VPN server but I would like to know if it is possible to setup a VPN server in another country from Spain for free.

Localhost querying google.internal addresses dozens of times a second

Hi there,
Great project thanks!
I've noticed when the pi-hole admin page is open in browser, there is a spike in localhost requests for the hostnames of the VM instance on google cloud.

See the hostnames in attached screenshot. Mostly "pi-hole.google.internal". The requests are being served by the cache, but come back as NXDOMAIN.
The total queries starts to go up about a dozen request per second, with no other devices performing lookups.

When I close the browser admin page window , you can see the requests stop.
[I'm using an iOS App called Pi-hole remote to see a live-log of requests as they come in]

Its like there's an element on the pi-hole admin page itself that is trying to resolve these addresses.

I've set this up fresh as per instructions. Is this known, or even a problem?

cheers

Screen Shot 2022-03-30 at 13 01 23

Question - ubuntu autoupdate and clean

How do you ensure that Ubuntu stays up to date on the cloud server?

I like to run the below command manually. Would it be worth putting this on a schedule, similar to how you update pihole?


sudo apt update -y && sudo apt full-upgrade -y && sudo apt autoremove -y && sudo apt clean -y && sudo apt autoclean -y

Upgrade F1-micro to E2-Micro by Aug. 31, 2021

I received an email from GCP instructing me to change my F1-micro instance to E2-micro by August 31, 2021 to continue using the free tier. The E2-micro free tier becomes available on August 1, 2021.

I will attempt to change over on August 1st. I opened this issue to track documentation updates in GOOGLE-CLOUD.md where there are references to the F1-micro VM.

Email excerpt below:

What do I need to know?
The Free Tier F1-micro VM is changing to the E2-micro VM as the VM to use for free. On August 1, 2021, E2-micro Free Tier will be introduced. Follow these steps to change your machine type to E2-micro to avoid incurring charges for continuing to use F1-micro after August 31, 2021.

What do I need to do?
Starting August 1, 2021, change the machine type from F1-micro, or stop your existing F1-micro instance and begin using a E2-micro instance. VMs created with either method will automatically have the Free Tier discount applied to them. The supported regions will remain the same.

IP not VPN IP but ISP IP

I think this has to do with the initial setup of the PiVPN wherein by default Pihole routes everything through the default ethernet address instead of wg0, but whenever I'm connected to the PiVPN wireguard VPN client, the IP address I'm getting back is my ISP's IP and not the VPN IP like I would expect.

How do I go back and re-run the setup to change the default network address it routes everything through, or the config file itself, so that I can get everything to route through the VPN's IP instead?

Pihole client names

thanks for this guide. How do i get pihole to show various client names in the query log? i followed option A and every query is showing as from localhost. thanks!

Deleting client leaves unwanted residues

When I use the command you provided sudo wg set wg0 peer publicid remove it does something to the VM instance, I can't connect the removed client. But when I terminate the connection to ssh and reconnect to it, and run the command sudo wg show I'm still able to see the so called "removed client", however I can't to the server from the client as it should because I ran the remove command. And when I delete it the peer info directly from the /etc/wireguard/wg0.conf after the command, it completely destroy the script when I want to add new client to my server. When I run the bash ./setup.sh after running the remove command and manually deleting the client info from the /etc/wireguard/wg0.conf it still can generate new clients but the newly generated clients won't work and the existing clients will run as if nothing happened. So what removing the peer info directly from the /etc/wireguard/wg0.conf after running the command does to the script and what I should do to completely destroy the every remnant of deleted client? I'm new to this things by the way.

Update to Option A Step 1

Change suggestion 1:
Current:
"Name your Virtual Machine pi-hole.
To qualify for the Free Tier, your Region selection should be any US region only (excluding Northern Virginia [us-east4]). I have used us-east1 and the us-east1-b zone because it is closest to me.
Choose the f1-micro Machine Type in the dropdown."

Suggested Change:
"Name your Virtual Machine pi-hole.
To qualify for the Free Tier, your Region selection should be any US region only (excluding Northern Virginia [us-east4]). I have used us-east1 and the us-east1-b zone because it is closest to me.
Change the Series to "N1"
Choose the f1-micro Machine Type in the dropdown."


Change Suggestion 2:
Current:
"The External IP Address should not be Ephemeral. Choose Create IP Address to Reserve a New Static IP Address"

Suggested Change:
"In the External IP Address section, change from "Ephemeral " to "Create IP Address" to reserve a new Static IP Address.
Click "Reserve".

Configuration imported through Network Manager GUI doesn't work with IPv6 DNS

Hello!
After some testing with Network Manager, I have found out that if the wireguard configuration contains a primary DNS in IPv6 format, the VPN won't work. You will be able to connect to PiHole dashboard, but you won't be able to browse the internet, because the DNS, for some reason, is not handled properly.

I am quite confident this is an issue with NM-Wireguard-Plugin. The reason why I am saying this is because if the connection to the VPN is imported manually through nmcli connection import type wireguard file <wg-config-file> the VPN works fine. However, if the connection is imported through the command line, it won't be visible through NetworkManager GUI: no managing of the connection will be possible.


Given that NM-Wireguard-Plugin has not been updated in 7 months, it's unlikely to see an update now. So, I see only 2 solutions possible

Solution 1: Switch to IPv4 DNS in Wireguard config. That will do the trick and can even be done when creating the WG configuration on GCP. Basically, do not use IPv6 DNS.

Solution 2: Live with the problem. The plugin to handle Wireguard configuration graphically is not 100% reliable and can't handle IPv6 DNS. So, instead of importing WG config through NM GUI, just use nmcli . Be aware that, by default, the VPN connection will be activated automatically regardless of which WiFi network you are connected to. Also, unless you go specifically look for the VPN connection, it will be completely transparent to you and won't notice it.

implement local firewall rules directly on the server

@rajannpatel - currently, you are allowing access from anywhere to port 51515 on the VM. Do you think it also makes sense to implement the iptables rules as recommended at [https://docs.pi-hole.net/guides/vpn/firewall/]? Or is that overkill? Thank you again for this wonderful script.

Wireguard works, Pi-Hole works, but cannot access the admin panel for Pi-Hole (iOS)

Hi!

So I started all over and went start to finish on the tutorial. The Google Cloud account is up and running, Pi-hole is installed and working, and so is Wireguard (iOS). It works but I cannot access the Pi Hole admin panel from either the external IP or from the 10.66.66.2 address. I also tried 10.66.66.1 just to make sure. Thanks in advance!

Doesn't work with DNS IP in the router.

Hi, Thank you for the nice guide. Works fine with the VPN client in iPhones.
Updating the GCP instances IP as DNS server in the wifi router doesn't seem to pick up and dont see it being routed via pi-hole.

Question - Configure automated Pi-Hole updates and scheduled reboots

I followed the instructions to 'Configure automated Pi-Hole updates and scheduled reboots'.

My question is how can I manually update pihole within the google Cloud SSH? How do I execute the script manually to ensure it's working? I'm unable to run any command like 'pihole -up' from the root as it says "command not found".

How do we enable DoT or DoH?

How do we enable DNS over TLS or DNS over HTTPS?

Currently I'm able to sniff what websites are being attempted to access with packet capture software.

This is maybe preventable with DoT or DoH?
https://blog.cloudflare.com/encrypted-sni/

Below you can see where I tested access to explicit site as I have it blocked on my setup.
Wireshark_2020-06-06_11-34-39

Here you can see my VPN is working, and explicit site is blocked.
2020-06-06_11-41-35

I am using Cloudflare as my upstream DNS, so ideally something that works with that would be great.

Also one last thing to note, but not directly related to this project...

iOS 13.5.1 currently has a vulnerability where applications are able to bypass VPNs.

You can read about that here:
https://www.forbes.com/sites/zakdoffman/2020/06/04/new-apple-security-blow-ios-1351-hides-a-surprising-problem-for-iphone-users/#3538f8cb2533

comment in client's config file and custom path to store config files , maybe ?

now the script will generate the first client's config file like wg0-client-2.conf in root's home.
in my sceranio , I would like to rename the file to match user's name and devices
like wg0-client-eric-iphone8.conf
but if I do the rename , then next time when I generate another client , the script will not be able to determine client's ip address and then create wg0-client-2.conf again.
so if I want to use the script to keep generating config without modify client's ip address , then I will not be able to rename the config file.
then , how about add a "comment" in script's interactive process , and just add the comment into config file , so at least I can use grep to find out user's config ?

and also I think that is not proper to store config files in root's home directory , maybe it should be a customize variable ?

pi.hole domain routed to incorrect IP

Thanks for the great guide. I followed it a while ago to set up my pi-hole, which has been working great since. When recently switching to an e2-micro instance (see #45) I noticed that it is not possible to access the pi-hole admin page via http://pi.hole/admin. Notably, the docs for this guide only say it will be accessible at the IP address, but especially coming back to pi-hole after a while of not touching it, it was surprising that it didn't work as it does in the pihole documentation. I think the issue is that the IP address in /etc/pihole/local.list is the internal IP of the vm instance, not of wireguard, which is what is needed. I was able to work around this by adding a local DNS record in the pihole admin console pointing pi.hole to 10.66.66.1. I wonder if there's a better solution or if this workaround should be documented in the guide.

Automating Wanguard installation with Docker, Terraform and Cloud Run

Similarly on what it was done for AWS, I was wondering if there's a way to do the same for GCP: automating the deployment of Wanguard on serverless environment using Terraform, Cloud Run, Cloud Build and Docker

Theorically it should be possible I guess, but I saw that the included setup.sh file is not meant to be run headless so I was just wondering on what could this be overcome (if possible)

Actually, if CPU throttling of CloudRun is not a good deal, GCE would be still ok. But the headless setup issue remains I guess.

any suggestion appreciated!

Update the excellent guide

Hi. Firstly thank you for writing up this excellent guide. I have setup my pi-hole server on GCP and its running.
I have few questions which I think you can answer/add to your guide to make it more noob friendly..

  1. How can I connect to web-interface of pi-hole to see stats and update block list? Is it only possible from connected clients other machines which are not connected to this VPN?
  2. How do I add this VPN to Ubuntu/Kubuntu client machine for ad blocking?
  3. Is it possible to connect my TV to this VPN? I would like to detect which servers it connects to for calling home feature and if possible block youtube ads

Autoupdating PiHole

I believe the information about autoupdating PiHole that were specified in the OpenVPN version of this guide are still valid. @rajannpatel isn't that so?
If so, I can make a PR to add them here.

dns leak on android 9 devices

Hi, I wanted to congratulate you for this guide, it was very useful and it is really simple to follow. I'm having a problem though: I followed your step-by-step guide, created the account, the virtual machine, the firewall rules and started your script that installs the pi hole service and creates the various accounts for the vpn. I then imported them into various devices, such as my computer, my smartphone and other smartphones of various friends. Herein lies the problem, I did the test on 7 android smartphones, an iPhone and a pc. Everything works on PC, iPhone and 2 Android smartphones, on others it doesn't. The ads are not blocked, and I can't understand why. Do you have any suggestions for me? I specify that from all the devices I can reach the pi hole via ip address, so I think both the pi hole and the vpn are working correctly, but I could be wrong.

Updating Pi-Hole

I just noticed a notification that there was an update to my Pi-Hole install, and was wondering how we would go about updating after using your script, if it is even recommended.

I also want to say thank you for going through the work of setting this all up, I used the old way you had of doing this and switched to this as soon as you put it up. Great work!

Question - Managing peer to peer communications

Wondering if anyone has any instructions or link/guide detailing how to set up and manage peer to peer communications with wireguard? After we have this all up and running in google cloud... Also would IP forwarding have to be enabled? As an example use; say I set up a raspberry pi4 as a client, and I want to be able to access it from my mobile phone. Or say I want to be able to access this https://www.kickstarter.com/projects/mdevaev/pikvm-v3-hat

As background - I've set up the wireguard server with these instructions and it is running perfectly. I also set up separate keys for each of my clients.

Question on split tunnel and port forwarding

Hello and thanks for this excellent guide, which I recently used to set up a split tunnel in the cloud.

One question I have is that you say to forward port 51515 on the router. I don’t understand how this works, because I’m only able to forward ports to a device that is connected to my router (which is a google nest by the way). How can I forward it to a cloud device, and what purpose does it serve? I have my iPhone set as a client and pihole is working. However, there’s no protection in in masking my IP address.

Can you confirm what protection I have with just a split tunnel DNS? What safety does that provide outside my LAN, what does it encrypt? Just visiting websites?

appreciate any insite you can offer as I’m new to this and trying to learn. I’m also trying to decide if I should set this up on my local lab for a full tunnel, perhaps that’s more beneficial especially if I want to do file sharing as well.

mtu set too high

ISSUE

some times the wireguard client sets mtu=8920 which is too high and as a result some devices does not load sites and other data properly,

i manually changed the mtu by going to following directory

cd /sys/class/net/wg0
nano mtu
and changing the value to 1380

can this be made the default value ?

it took me hours the catch the issue on one of my networks.

Full Tunnel doesnt work but Split is fine

All of a sudden the full tunnel doesnt work, i cant access the internet. Split tunnel still works fine without any issue.

Tested it by changing the allowed ip on the profile, also on different devices.

wireguard protocol obfuscation with shadowsocks

Came across some interesting information courtesy of Yegor Ievlev:

Recently there was discussion about obfuscation to avoid restrictive firewalls. The conclusion apparently was that WG devs should add support for pluggable transports. This is a good idea, but for now you can just use shadowsocks-libev:

On server:

ss-server -s 0.0.0.0 -s ::0 -p 443 -k shadowsocks-password -m aes-128-gcm -U # change to lowercase u if you want to be able to connect to the server over TCP too.

On client:

ss-tunnel -s shadowsocks-server -p 443 -l 51820 -L wireguard-server:51820 -k shadowsocks-password -m aes-128-gcm -U

Connect WireGuard to 127.0.0.1:51820. Done.

It's worth experimenting with Shadowsocks to bypass restrictive firewalls that block Wireguard traffic, and improving this guide/bash script to include these enhancements.

Would it make sense to use a dynamic DNS service?

As of now, when creating the VM instance on GCP, we are setting up the VM to have a fixed IP address, so it can always be reached. This IP address has a cost.
If you are not making use of the free tier (for whatever reason), I believe you could save some money by using a dynamic DNS service rather than a fixed IP address.

Only a small doubt: The traffic generated by the instance to keep the IP address up to date might go over the price for a fixed IP address, however I believe the traffic generated is very very low.

What do you think?

Price Estimate

I understand it is an estimate but does anyone know is this estimating based on if I go over limits and what not? Or is this a new thing where you do have to rent a virtual server?
image

Second run of setup.sh breaks everything

Thanks for the guide! Running through it once and generating the first key is very smooth. Using a phone with the first QR code works, and modding to go full tunnel works fine.

As soon as I run setup for a second time to generate another key, the first client dies. It appears to connect, but can't reach either the pi hole admin console or the internet.

What am I doing wrong? I notice during the second setup run that its trying to assign the same client IP again (10.66.66.2) which seems like a problem.

Is there a way to blank the wg config so that I don't have to spin up a new VM every time I start over?

Thanks again for the help, enjoyed learning through your guide!

VPN connecting, but can't access Pi-Hole admin panel and not blocking ads

Hello,

I come from your other GitHub (PiVPN and PiHole) that worked flawlessly for quite a while, but had to remove the VM.

I configured the Wireguard through GCloud today. I've done it 2 or 3 times following every step, but I always end up the same.

I created two config files, one for Mac and another for iOS. I've installed both, and both VPNs are connecting fine and traffic flows fine.

But ads are note being blocked, nor I can access Pi Hole admin panel either by http://[fd42:42:42::1]/admin, http://10.66.66.1/admin or http://pi.hole/admin. It doesn't respond to ping either.

I'm using the split configuration. If I try the full tunnel with 0.0.0.0/0, ::/0 then it won't connect.

Where should I look at?

Thanks

Misinformation about GCP's free tier in this guide?

Be aware of the limitations of the Free Usage Tier:

1 vCPU + 3.75GB RAM f1-micro virtual machine instance per month in one of the following US regions

https://github.com/rajannpatel/Pi-Hole-on-Google-Compute-Engine-Free-Tier-with-Full-Tunnel-and-Split-Tunnel-Wireguard-VPN-Configs/blob/master/GOOGLE-CLOUD.md

Unless the RAM limit has changed, I think we are still limited to 640 MB of RAM. Correct me if I'm wrong... but when I made my server I only got 640 MB RAM as part of the free tier.

Network limitations on f1-micro VM free tier

After looking through the google cloud free tier, under the Always Free section, on the Compute Engine entry in the table, you can read the following:

- 1 non-preemptible f1-micro VM instance per month in one of the following US regions:
    - Oregon: us-west1
    - Iowa: us-central1
    - South Carolina: us-east1
- 30 GB-months HDD
- 5 GB-month snapshot storage in the following regions:
    - Oregon: us-west1
    - Iowa: us-central1
    - South Carolina: us-east1
    - Taiwan: asia-east1
    - Belgium: europe-west1
- 1 GB network egress from North America to all region destinations (excluding China and Australia) per month

If I understand correctly for each region you only have 1 GB of outbound traffic for free, is that correct?

Are there any plans to make this work with AWS free tier?

Since the Google Cloud free tier only allows US servers, it can potentially slow things down for other users. As far as I know, the AWS free tier is available in every region. Is there anything preventing this from working with AWS?

Is it possible to allow wireguard only for some IPS

Hi,
I want to enable VPN of wireguard only for certain IP address.
Eg: I want all data for google.co.in to go through vpn and in normal case all should go outside vpn
to reduce data. Certain services need country based Ip's . In Openvpn we have that option (Atleast for OpenVpn) But cannot find such option for Windows .Is it possible somehow

How to make this work with my Roku Smart TV?

I have the server up and running. I have wireguard on my phone and it's performing well, just as intended. But as for the smart TV in my house, I would like to set that up to use pihole with Google Cloud as well. The Roku software doesn't allow for custom DNS. Is there something I can do in my router firmware to point my Smart TV at the Google Cloud pihole? I have a Netgear Nighthawk R6900 with stock firmware.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.