I am looking to use my Raspberry Pi as a VPN tunnel (not sure of the correct terminology). The basic setup is as follows:
- I have wireguard set up on the RPi and I have successfully connected to my VPN server. DNS is working so when I ping or telnet to my destination server from the Pi it works.
- I would like to have a port in the Pi set up so when I connect it forwards though the VPN. E.g. if my RPi is on 192.168.0.10, I would like to use my laptop and connect to say 192.168.0.10:8000. This will then forward traffic back and forth through the VPN tunnel.
The idea is that there is next to no setup required on my desktop or laptop to connect to the secure server as this is handled by the pi.
So instead of connecting to: my.secure.server:1234 which is usually not accessible without a VPN.
I instead connect to: 192.168.0.10:8000 (RPi) which then forwards to my.secure.server:1234 and back.
Is this possible? Am I asking for a miracle?
My WireGuard Config:
[Interface]
Address = 10.XX.XX.XX
PrivateKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ListenPort = 51820
DNS = 172.XX.XX.XX,10.XX.XX.XX
[Peer]
PublicKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PresharedKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Endpoint = 74.XX.XX.XX:51820
AllowedIPs = 172.XX.0.0/16,10.XX.0.0/24
My /etc/sysctl.conf (edit):
net.ipv4.ip_forward=1
Some extra info:
- I have full control over the VPN client / Raspberry Pi
- I have full control over the laptop and desktop which will connect though the tunnel, but the preference is that there are no changes or software install on these.
- I have NO control on the VPN Server (WireGuard) at the destination.
- The connection from RPi to VPN Server seems to be working as I can connect to the destination server on the ports required.
- I am using Raspbian OS
I have also checked the following posts, to which I am not sure if they apply, so any advice on this too is appreciated:
- How to bridge an access point with a remote network by openvpn?
- How to correctly handle port forwarding so pivpn wireguard works. Next steps are pi-hole
Thanks in advance.