Title: Force Local Internet Connection on Debian 12 Wireguard Client using Fritzbox 7530 VPN Router/Server
Introduction:
This article aims to guide users on how to force a Debian 12 Wireguard client to use a local internet connection rather than passing through a VPN. We will be using a Fritzbox 7530 VPN router/server for this purpose.
Prerequisites:
- Debian 12 installed and configured
- Fritzbox 7530 VPN router/server set up
- Basic understanding of Wireguard and networking
Steps:
-
Configure Fritzbox 7530 VPN Router/Server:
- Log into your Fritzbox 7530 web interface.
- Navigate to the VPN section and create a new Wireguard server configuration.
- Fill in the necessary details such as the IP address, private key, and listening port.
- Save and apply the changes.
-
Install Wireguard on Debian 12:
-
Open a terminal and update your system:
sudo apt update sudo apt upgrade -
Install Wireguard:
sudo apt install wireguard
-
-
Generate Wireguard Private and Public Keys:
-
Generate a private key for the Debian 12 client:
wg genkey | tee /etc/wireguard/privatekey -
Copy the public key to the Fritzbox 7530 VPN server:
cat /etc/wireguard/privatekey | ssh fritzbox_ip 'sudo tee -a /etc/wireguard/wg0.conf << EOF ... [Peer] PublicKey = YOUR_PUBLIC_KEY_HERE Endpoint = fritzbox_ip:LISTENING_PORT ... EOF
-
-
Configure Wireguard on Debian 12:
-
Create a configuration file for the client:
sudo nano /etc/wireguard/wg0.conf -
Add the following details:
[Interface] Address = YOUR_CLIENT_IP/32 PrivateKey = YOUR_PRIVATE_KEY_HERE ListenPort = 51820 [Peer] PublicKey = FRIZBOX_PUBLIC_KEY_HERE Endpoint = FRIZBOX_IP:LISTENING_PORT AllowedIPs = 0.0.0.0/0 PersistentKeepalive = 25 -
Replace
YOUR_CLIENT_IP,YOUR_PRIVATE_KEY_HERE,FRIZBOX_PUBLIC_KEY_HERE,FRIZBOX_IP, andLISTENING_PORTwith your respective values.
-
-
Start and Enable Wireguard:
-
Start the Wireguard service:
sudo systemctl start wg-quick@wg0 -
Enable the Wireguard service to start at boot:
sudo systemctl enable wg-quick@wg0
-
-
Test the Connection:
-
Check the Wireguard interface status:
sudo wg show -
If everything is set up correctly, you should see the interface up and running.
-
Conclusion:
By following these steps, you can force a Debian 12 Wireguard client to use a local internet connection via a Fritzbox 7530 VPN router/server. This setup allows you to bypass the VPN for specific tasks while still maintaining the VPN connection for secure internet browsing.
References:
-
Books:
- "WireGuard: The Complete Guide" by Daniel Micay
-
Articles:
-
Online Resources: