VPN

From 太極
Revision as of 10:25, 29 April 2023 by Brb (talk | contribs) (→‎Wireguard)
Jump to navigation Jump to search

Resource

Blocked, ports

My self hosted VPN does not work in school, what is an alternative? WireGuard defaults to listening on port 51820.

VPN vs Tor

How You Can Host Your Own VPN: VPS

Client

VPN Protocols Compared

6 VPN Protocols Compared: Which Is Best?

Diskless VPN

Why You Should Choose a VPN With Diskless Servers

Wireguard

WireGuard is a fairly new VPN protocol which is much more secure and faster than OpenVPN or IPsec.

Android part:

Use in Ubuntu client

  • Install wireguard
sudo apt update
sudo apt install wireguard
  • Generate Public and Private Keys:
umask 077
wg genkey | tee privatekey | wg pubkey > publickey
This will create two files privatekey and publickey in the current directory.
  • Create a configuration file:
    • <IP address> with an IP address of your choice, For example, if the WireGuard server assigns IP addresses in the 10.0.0.0/24 subnet to connected clients, you can use an IP address in the same subnet on the client side, such as 10.0.0.2.
    • <server IP> with the IP address of the WireGuard server. ou can find the public IP address of your server by running the command curl ifconfig.me in the terminal of the server.
    • <server port> with the port number of the server. By default, WireGuard uses UDP port 51820 for communication. However, it is possible that the WireGuard server is configured to use a different port.
# Server
[Interface]
PrivateKey = <private key>
Address = <IP address>

# Client
[Peer]
PublicKey = <public key>
AllowedIPs = 0.0.0.0/0
Endpoint = <server IP>:<server port>
PersistentKeepalive = 21
  • Start the WireGuard interface
sudo wg-quick up /path/to/configuration/file
  • Check the status of the interface:
sudo wg show

Usage with commercial VPNs

To use WireGuard with Windscribe VPN, you need to follow these steps:

  • Sign up for Windscribe VPN
  • Enable the WireGuard protocol: Open the Windscribe app and go to the "Preferences" section. Under the "Connection" tab, select "WireGuard" as the protocol.
  • Generate a WireGuard configuration file: Go to the Windscribe website and sign in to your account. Under the "My Account" section, click on "Generate OpenVPN/WireGuard Config". Select "WireGuard" as the protocol and choose the server location you want to connect to. Click on "Generate" to download the configuration file.
  • Install WireGuard on Ubuntu
  • Import the Windscribe configuration file: Move the downloaded Windscribe configuration file to a directory of your choice on your Ubuntu machine. Open the terminal and run the following command to import the configuration file:
sudo wg-quick up /path/to/windscribe-config-file
  • Verify the connection:
sudo wg show

PiVPN

wg-easy

sudo ufw allow 51820/udp
  • Steps
    1. Add wg.taichimd.us to cloudflare.
    2. Update ddclient.conf (recall I use my domain name instead of IP in the WG_HOST)
    3. Open 51820/UDP port on router
    4. sudo ufw allow 51820/udp; docker-compose up -d
    5. Go to http://IP:51821 & add a new client
    6. scan QR on Android wireguard app
    7. Disable wifi and connect http://neverssl.com to test the connection
  • Extra steps:
    1. In cloudflare, disable DNS Proxy
    2. Include WG_ALLOWED_IPS=0.0.0.0/0 (not sure if this is necessary)
    3. sudo rm wg0.* (for some reason, the conf file was not changed after I modify docker-compose.yml file)
    4. docker-compose up -d
    5. Re-log in and re-create a new client tunnel, etc.
    6. In the http://IP:51821 client page, you should see a red dot showing a client is connected and some network activity (up/down).
  • Any benefit to changing default WireGuard port?

OpenVPN

List of free and fast VPNs

Windscribe

5 Free Privacy Tools You Can Use on Any Device. Windscribe has 10GB/month for free

Torrent

5 Best Free VPNs for Torrenting and P2P — Updated in 2022, The Best Free VPN for Torrenting (April 2022 Updated)

How to Set Up a VPN on Your Router

https://www.makeuseof.com/tag/setup-vpn-router/

dVPN

How Does a Decentralized VPN (dVPN) Work?