{"id":15653435,"url":"https://github.com/xei/wireguard-setup-scripts","last_synced_at":"2025-04-30T21:41:40.551Z","repository":{"id":187552351,"uuid":"296691074","full_name":"xei/wireguard-setup-scripts","owner":"xei","description":"A set of shell scripts for setting up WireGuard VPN and Pi-hole ad blocker on a Linux server.","archived":false,"fork":false,"pushed_at":"2021-01-19T14:27:48.000Z","size":56,"stargazers_count":38,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-25T11:39:39.950Z","etag":null,"topics":["ad-blocker","pi-hole","vpn","wireguard"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-09-18T17:44:01.000Z","updated_at":"2025-02-12T02:32:26.000Z","dependencies_parsed_at":"2023-08-11T03:28:27.265Z","dependency_job_id":"b7130c68-1d86-4e28-ae68-0ba7dfe80afe","html_url":"https://github.com/xei/wireguard-setup-scripts","commit_stats":null,"previous_names":["xei/wireguard-setup-scripts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xei%2Fwireguard-setup-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xei%2Fwireguard-setup-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xei%2Fwireguard-setup-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xei%2Fwireguard-setup-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xei","download_url":"https://codeload.github.com/xei/wireguard-setup-scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242711057,"owners_count":20173268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ad-blocker","pi-hole","vpn","wireguard"],"created_at":"2024-10-03T12:45:41.609Z","updated_at":"2025-03-09T15:30:48.895Z","avatar_url":"https://github.com/xei.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Setup WireGuard VPN and Pi-hole ad blocker like a piece of cake 🍰\nHere you can find some useful shell scripts in order to setup WireGuard VPN server and Pi-hole network-wide ad blocker on a Linux server as easily as possible.\n\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\n## What is a VPN\nA [VPN (Virtual private network)](https://en.wikipedia.org/wiki/Virtual_private_network) extends your private network (e.g. the LAN in your office) across a public network (usually the Internet) so that the remote or mobile users and branch offices can connect to the private network remotely through the Internet in a secure way and access to corporate applications and private resources such as IP cameras, fax machines, private servers, etc.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"460\" height=\"300\" src=\"https://upload.wikimedia.org/wikipedia/commons/e/e8/VPN_overview-en.svg\"\u003e\n\u003c/p\u003e\n\nThe major applications of VPNs are:\n1. Remote access to corporate resources such as shared documents in a private network, printers, fax machines, IP cameras, private servers etc.\n3. Encrypt your transfering data and make your internet surfing more secure in a public unsecure Internet connection. (e.g. WIFI connection in hotels)\n4. Stay anonymous on the Internet.\n5. Get around Internet censorship, [geo-blocking](https://en.wikipedia.org/wiki/Geo-blocking) and sanctions in some countries.\n\n## WireGuard\nThere are a bunch of tunneling protocols in order to make a VPN. For example ~~[PPTP](https://www.bgocloud.com/knowledgebase/32/mikrotik-chr-how-to-setup-pptp-vpn-server.html)~~, ~~[L2TP](https://blog.johannfenech.com/mikrotik-l2tp-ipsec-vpn-server/)~~, [IKEv2/IPSec](https://github.com/jawj/IKEv2-setup), [OpenVPN](https://github.com/angristan/openvpn-install) and of course [WireGuard](https://www.wireguard.com/).\n\nAmong these all, WireGuard seems to be the most interesting. It is lite (about 4,000 lines of code), fast and secure. So in 2020, WireGuard was officially added to the Linux kernel 5.6 release (so also Android kernels) by Linus Torvalds.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"460\" height=\"300\" src=\"https://cdn.shortpixel.ai/client/to_webp,q_glossy,ret_img,w_758/https://www.the-digital-life.com/wp-content/uploads/2020/04/image.png\"\u003e\n\u003c/p\u003e\n\n## Pi-hole\n[Pi-hole](https://pi-hole.net) is a Linux network-level advertisement and Internet tracker blocking application which acts as a [DNS sinkhole](https://en.wikipedia.org/wiki/DNS_sinkhole), intended for use on a private network.\n\nThe application acts as a DNS server for a private network (replacing any pre-existing DNS server provided by another device or the ISP), with the ability to block advertisements and tracking domains for users' devices without installing any client-side software.\n\nBecause Pi-hole blocks domains at the network level, it is able to block advertisements, such as banner advertisements on a webpage, but it can also block advertisements in unconventional locations, such as on Android, iOS and smart TVs.\n\nUsing VPN services, Pi-Hole can block domains without using a DNS filter setup in a router. Any device that supports VPN can use Pi-Hole on a cellular network or a home network without a DNS server configured.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"460\" height=\"300\" src=\"https://upload.wikimedia.org/wikipedia/commons/5/5e/Pi-hole_Screenshot.png\"\u003e\n\u003c/p\u003e\n\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\n## Setup the server\nHere you can follow the instructions step by step to setup a VPN/AdBlocker server using WireGuard and Pi-hole.\n### Buy a linux server\nWireGuard and Pi-hole are really lite softwares so that you can run them on a lite Linux instance with 1 vCore and 1GB of RAM without any problem.\n\nThe scripts are tested on Ubuntu 20.04 but you can run them on Debian, Fedora, CentOS and Arch Linux.\n\n\nYou can buy a cheap Linux IaaS from these cloud providers for the VPN server:\nCloud Provider | Location | Price (starting at) | Traffic |\n|--|--|--|--|\nVultr | Worldwide (USA is recommended because of sanctions!) | $3.50/month | - |\nDigital Ocean | Worldwide (USA is recommended because of sanctions!) | $5/month | -\nHetzner | Germany (Finland did not work as VPN server for me!) | €3/month | 20 TB |\n\n### Clone the repository\nRun the following commands to download the scripts:\n```\nwget -O - https://github.com/xei/wireguard-setup-scripts/archive/master.tar.gz | tar xz\ncd wireguard-setup-scripts-master\n```\n\n### Setup WireGuard server\nRun the following command to setup the WireGuard server:\n```\nsudo ./setup-wireguard-server.sh\n```\nYou have to answer some questions in order to configure the server. However you can leave the default values.\n```\nEnter a private IPv4 for WireGuard server: 10.0.0.1\nEnter a private IPv6 for WireGuard server: fd42:42:42::1\nEnter a port [1-65535] for WireGuard to listen: 51820\nEnter a name for WireGuard network interface: wg0\n```\n\nWhen you see the message `WireGuard is setup successfully.` you can go on.\n\n### Setup Pi-hole DNS sinkhole\nRun the following command to start Pi-hole installer:\n```\nsudo ./setup-pihole.sh\n```\nFor more information about installer wizard vistit the [official documentation](https://docs.pi-hole.net).\n\n### Create a new peer (client)\nRun the following command to create a new client (here named `xei-pc`):\n```\nsudo ./create-new-peer.sh xei-mobile\n```\nThis command will generate a QR code that can be scanned by Wireguard client mobile application. It also generate a config file in `/etc/wireguard/peers/xei-mobile/` directory that can be used instead of the QR code.\n\nNote that you can not connect to the VPN as one client with more than one devices at the same time. You have to create different clients for different devices. for example `xei-pc` and `xei-mobile`.\n\n\u003e You have to modify the client's config file and change `DNS` section to something like `1.1.1.1` or `8.8.8.8` if you are not going to setup `Pi-hole` or other DNS servers.\n\n### Revoke a peer (client)\nYou can remove a client by running the following command:\n```\nsudo ./revoke-peer.sh xei-mobile\n```\n`xei-mobile` is the name of the client you want to remove.\n\n### Remove WireGuard server\nYou can remove the WireGuard server completely by running the following command:\n```\nsudo ./remove-wireguard-server.sh\n```\nNote that the above script will remove the directory `/etc/wireguard` and its contents including all peers' config files. Backup the direcory if it is necessary.\n\nNote that the above script will not remove Pi-hole. In order to remove Pi-hole visit its [official documentation](https://docs.pi-hole.net).\n\n### WireGuard client applications\nWhen you create a new peer (client) with the above command, a config file will be generated in `/etc/wireguard/peers/client-name/` directory that should be imported to WireGuard client application.\n\nWireGuard client application is available in almost all platforms:\n\n[Download WireGuard client application for Windows](https://download.wireguard.com/windows-client/wireguard-amd64-0.1.1.msi)\n\n[Download WireGuard client application for macOS](https://itunes.apple.com/us/app/wireguard/id1451685025?ls=1\u0026mt=12)\n\n[Download WireGuard client application for Linux](https://www.wireguard.com/install)\n\n[Download WireGuard client application for Android](https://play.google.com/store/apps/details?id=com.wireguard.android)\n\n[Download WireGuard client application for iOS](https://itunes.apple.com/us/app/wireguard/id1441195209?ls=1\u0026mt=8)\n\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\n## Inspiration\nThis repository is heavily inspired by a great similar repository by [angristan](https://github.com/angristan/wireguard-install).\n\n## Donation\nGive a ⭐ if this project helped you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxei%2Fwireguard-setup-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxei%2Fwireguard-setup-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxei%2Fwireguard-setup-scripts/lists"}