Skip to content

VPN : OpenVPN & Wireguard

Alexis edited this page Sep 29, 2023 · 4 revisions

OpenVPN Access Server (limited to 2 clients) PAID

OpenVPN Community

mv clientABC.ovpn clientABC.conf
cp clientABC.conf /etc/openvpn/client/
systemctl enable openvpn-client@clientABC
# It will find automatically the clientABC.conf and run it at boot and keep it alive.

Wireguard

  • For windows 10:
0.0.0.0/0, ::0 replaces the default route and makes sure traffic won't go somewhere else in an untunnelled interface.
0.0.0.0/1, 128.0.0.0/1   use two routes not to override the default route, but once the VPN is down, these routes will disappear and traffic will go to default route ("untunneleld" interface)
  • Systemd service:
/usr/lib/systemd/system/wg-quick@.service
systemctl enable wg-quick@wg0.service --now
$ cat /usr/lib/systemd/system/wg-quick@.service
[Unit]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target
Wants=network-online.target nss-lookup.target
PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
Documentation=https://www.wireguard.com/
Documentation=https://www.wireguard.com/quickstart/
Documentation=https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
Documentation=https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8

[Service]
Type=oneshot
Restart=on-failure
RestartSec=30
RemainAfterExit=yes
ExecStart=/usr/bin/wg-quick up %i
ExecStop=/usr/bin/wg-quick down %i
ExecReload=/bin/bash -c 'exec /usr/bin/wg syncconf %i <(exec /usr/bin/wg-quick strip %i)'
Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity

[Install]
WantedBy=multi-user.target