WireGuard terminal setup guide
Configure your environment
-
Install WireGuard for your distribution.
Install additional packages for Debian/Ubuntu/Mint:
$ sudo apt install resolvconf curl -
Generate your private and public keys and store them in a safe place.
$ cd ~ $ mkdir wireguard $ cd wireguard $ wg genkey | tee privatekey | wg pubkey > publickey $ chmod 600 privatekey $ cat privatekey abcdefghijklmnopqrstuvwxyz0123456789= $ cat publickey 9876543210zyxwvutsrqponmlkjihgfedcba=Note: The keys above are examples only.
Setup WireGuard to use IVPN
-
Log in to the IVPN Client Area.
-
On the
VPN Accountspage, click theWireGuardtab. Go toWireGuard Key Managementlocated underTools. Click theAdd New Keybutton. Copy the contents of the public key file and paste them into thePublic Key:field. Add a comment, likeLinuxif you prefer, and click theAdd Keybutton.Be sure to copy the PUBLIC key and not the PRIVATE key. The PRIVATE key must always be kept a carefully guarded secret. -
Make note of the
IPv4 addressandIPv6 addressbeside your newly added public key on the WireGuard tab in the Client Area. These are the IP addresses your computer system will have on our internal network that will be in the172.x.y.z&fd00:4956:504e:ffff::aaaa:bbbbformat respectively. -
WireGuard uses the UDP protocol and IVPN offers different ports to connect on. Choose a port:
udp 53 udp 80 udp 443 udp 1194 udp 2049 udp 2050 udp 30587 udp 41893 udp 48574 udp 58237 -
Choose a WireGuard server to connect to from our Server Status page. Remember the hostname and the public key of the server.
-
To create a WireGuard configuration file for the connection you will need the following information:
Your private key from step #2 of the environment configuration.
$ cat ~/wireguard/privatekey abcdefghijklmnopqrstuvwxyz0123456789=Your assigned IP addresses from step #3 above.
172.x.y.z, fd00:4956:504e:ffff::aaaa:bbbbThe server port from step #4 above.
2049The server
hostnameand serverpublic_keyfrom step #5 above.us-tx1.wg.ivpn.net JPT1veXLmasj2uQDstX24mpR7VWD+GmV8JDkidkz91Q= -
Create the WireGuard configuration file.
$ sudo mkdir /etc/wireguard $ sudo touch /etc/wireguard/us-tx1.conf $ sudo chmod 600 /etc/wireguard/us-tx1.conf $ sudo nano /etc/wireguard/us-tx1.confUse Nano or your favorite text editor to edit the configuration file. Enter the details accordingly
[Interface] PrivateKey = abcdefghijklmnopqrstuvwxyz0123456789= Address = 172.x.y.z/32, fd00:4956:504e:ffff::x:y/128 DNS = 172.16.0.1 [Peer] PublicKey = JPT1veXLmasj2uQDstX24mpR7VWD+GmV8JDkidkz91Q= Endpoint = us-tx1.wg.ivpn.net:2049 AllowedIPs = 0.0.0.0/0, ::/0Press
Ctrl + xto save the file and exit from the nano editor.- Add '/32' & '/128' to the end of your assigned IPv4 and IPv6 addresses respectively.
- Add the chosen port at the end of the hostname with a prefix of ':' -
You are now ready. To connect run:
$ sudo wg-quick up us-tx1 -
Check the contents of
/etc/resolv.confto confirm that thewg-quickprogram updated the DNS server in your system.$ cat /etc/resolv.conf nameserver 172.16.0.1 ...You may have to manually add an entry for our internal DNS IP address.
$ sudo nano /etc/resolv.conf nameserver 172.16.0.1 ...Press
Ctrl + xto save the file and exit from the nano editor. -
Check your external IPv4 & IPv6 IP addresses to verify that you are connected to IVPN.
$ curl ifconfig.co $ curl -6 ifconfig.co -
To disconnect run:
$ sudo wg-quick down us-tx1Be sure to undo the manually applied changes to/etc/resolv.confif any changes were required.
Suggest an edit on GitHub.