1
1
mirror of https://github.com/angristan/wireguard-install.git synced 2024-06-05 04:50:49 +00:00
Go to file
Danila Vershinin 4ca883f6d9
Update README.md
Co-authored-by: jaminmc <jaminmc@gmail.com>
2022-04-17 13:55:11 +03:00
.github Bump ludeeus/action-shellcheck from 0.5.0 to 1.0.0 (#152) 2020-10-27 15:50:47 +01:00
LICENSE Initial commit 2019-05-05 12:42:53 +02:00
README.md Update README.md 2022-04-17 13:55:11 +03:00
wireguard-install.sh Update AdGuard default public DNS addresses (#162) 2020-12-08 10:54:17 +01:00

WireGuard installer

Lint visitors

This project is a bash script that aims to setup a WireGuard VPN on a Linux server, as easily as possible!

WireGuard is a point-to-point VPN that can be used in different ways. Here, we mean a VPN as in: the client will forward all its traffic trough an encrypted tunnel to the server. The server will apply NAT to the client's traffic so it will appear as if the client is browsing the web with the server's IP.

The script supports both IPv4 and IPv6. Please check the issues for ongoing development, bugs and planned features!

WireGuard does not fit your environment? Check out openvpn-install.

Requirements

Supported distributions:

  • Ubuntu >= 16.04
  • Debian 10
  • Fedora
  • CentOS
  • Arch Linux

Usage

Download and execute the script. Answer the questions asked by the script and it will take care of the rest.

curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh
chmod +x wireguard-install.sh
./wireguard-install.sh

It will install WireGuard (kernel module and tools) on the server, configure it, create a systemd service and a client configuration file.

Run the script again to add or remove clients!

Configure clients

RHEL 8

  • Install the necessary packages:
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm
sudo dnf install dnf-plugins-core
sudo dnf config-manager --enable elrepo
sudo dnf install kmod-wireguard wireguard-tools
  • Create file in /etc/wireguard/ with the name you want the network interface to be with extension of .conf. IE: /etc/wireguard/wg0.conf, then put in the contents of the client config generated by the script (copy paste from server). Also run sudo chown -R root. /etc/wireguard ; chmod -R 600 /etc/wireguard for proper permissions.

To enable the connection run sudo wg-quick up [Interface name], like sudo wg-quick up wg0 and to disable wg-quick down [Interface name]

  • Connect: systemctl start wg-quick@wg0.service

  • Verify your public IP has changed to the server's IP, e.g.: curl ipv4.icanhazip.com ; curl ipv6.icanhazip.com

iOS

  • Download the official WireGuard app from the App Store
  • Launch the app, add configuration by option to "Create from QR code"
  • On the server, launch the script to generate client configuration, give a descriptive name, e.g. "iPhone". QR code is displayed after client configuration was generated
  • In iOS, scan the generated QR code

Providers

I recommend these cheap cloud providers for your VPN server:

  • Vultr: Worldwide locations, IPv6 support, starting at $3.50/month
  • Hetzner: Germany and Finland, IPv6, 20 TB of traffic, starting at €3/month
  • Digital Ocean: Worldwide locations, IPv6 support, starting at $5/month
  • PulseHeberg: France, unlimited bandwidth, starting at €3/month