u/q5305s17

Split tunneling / One sided tunnel usage only

Hello,

My goal is to have a wg tunnel established between a "client" and "server", but not send any of the client's traffic through the wg tunnel. I only want the server traffic to go through the client.

No matter what, it seems like the tunnel won't work unless the client has AllowedIPs = 0.0.0.0/0 . If I keep this, then the server is bi-directional full tunneling.

  • 10.66.66.5 is the homeserver wg client IP
  • 10.66.66.1 is the VPS wg server IP

>>> Client - Homeserver that hosts a website

[Interface]
PrivateKey = REDACTED
Address = 10.66.66.5/32
DNS = 9.9.9.9,1.1.1.1
[Peer]
PublicKey = REDACTED
PresharedKey = REDACTED
Endpoint = 123.123.123.123:12345
AllowedIPs = 0.0.0.0/0 # This puts client traffic in tunnel. Changing it to "10.66.66.1/32" does not keep server traffic in the tunnel. The server cannot reach the client when I set this to anything other than 0.0.0.0/0.

>>> Server - VPS that acts as a proxy to homeserver website (nginx -> anubis -> homeserver)

[Interface]
Address = 10.66.66.1/24
ListenPort = 12345
PrivateKey = REDACTED
PostUp = iptables -t nat -A POSTROUTING -o enp1s0 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -o enp1s0 -j MASQUERADE
[Peer]
PublicKey = REDACTED
PresharedKey = REDACTED
AllowedIPs = 10.66.66.5/32

>>> client

>>> ip route

default via 192.168.1.1 dev enx7cc2c64af446 proto dhcp metric 100 
169.254.0.0/16 dev enx7cc2c64af446 scope link metric 1000 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 
172.18.0.0/16 dev br-e766702ebe72 proto kernel scope link src 172.18.0.1 linkdown 
192.168.1.0/24 dev enx7cc2c64af446 proto kernel scope link src 192.168.1.16 metric 100

>>> server

>>> ip route

216.128.x.x metric 100default via 216.128.x.x dev enp1s0 proto dhcp src 216.128.182.135 metric 100 
10.66.66.5 dev wg0 scope link 
108.61.10.10 via 216.128.x.x dev enp1s0 proto dhcp src 216.128.x.x metric 100 
169.254.x.x via 216.128.x.x dev enp1s0 proto dhcp src 216.128.x.x metric 100 
216.128.x.x/23 dev enp1s0 proto kernel scope link src 216.128.x.x metric 100 
216.128.x.x dev enp1s0 proto dhcp scope link src
reddit.com
u/q5305s17 — 7 days ago