Wireguard(Debian)
1. Install WireGuard Tools
First, update your package list and install the necessary WireGuard tools on your client machine:
Code
sudo apt update
sudo apt install wireguard-tools
2. Generate Client Key Pair
Generate a unique private and public key for your client:
Code
wg genkey | tee client_private.key | wg pubkey > client_public.key
Keep the client_private.key file secure, as you’ll use its content in the configuration file.
3. Create Client Configuration File
Create the WireGuard configuration file for the client:
Code
sudo nano /etc/wireguard/wg0.conf
Add the following content to the file, replacing the bracketed placeholders with your specific details:
Code
[Interface]
PrivateKey = <contents-of-client_private.key>
Address = 10.0.0.2/24 # Client's internal IP (adjust if needed)
DNS = 8.8.8.8, 1.1.1.1 # Example DNS servers
[Peer]
PublicKey = <server_public_key>
AllowedIPs = 0.0.0.0/0 # Route all traffic through the VPN
Endpoint = <server_public_ip_or_domain>:51820 # Server's public IP/domain and WireGuard port
PrivateKey: The content of theclient_private.keyfile you generated.
Address: The client’s internal IP address within the WireGuard subnet. DNS: The DNS servers the client should use when connected to the VPN. PublicKey: The public key of the WireGuard server. AllowedIPs: 0.0.0.0/0 routes all client traffic through the VPN. Endpoint: The public IP address or domain name of your WireGuard server and the port it listens on (default 51820).
4. Start and Enable the WireGuard Interface
Start the WireGuard tunnel using wg-quick:
Code
sudo wg-quick up wg0
To enable WireGuard to start automatically on system boot, use systemctl:
When error “line 32: resolvconf: command not found” occures > install openresolv > apt install openresolv
Code
sudo systemctl enable wg-quick@wg0
5. Verify the Connection
Check the status of the connection with the wg command:
Code
sudo wg
This should show the interface details and peer information if the connection is successful.
VPN to Fritzbox
FritzBox VPN on Ubuntu 18.04
- Configure VPN for a user on your FritzBox and don’t forget to show the pop-up including your credentials etc. afterwards. Also make sure you check “Allow access from internet”.
sudo apt install vpnc network-manager-vpnc- Create file
sudo nano /etc/vpnc/vpn.conf, paste the following content and insert your credentials etc.
IPSec gateway yourfritzboxhere.myfritz.net
IPSec ID your_user
IPSec secret your_preshared_key
Xauth username your_user
Xauth password your_password //When this line is removed you will be asked for a password
- Connect VPN:
sudo vpnc vpn - Disconnect VPN:
sudo vpnc-disconnect