pufferffish / wireproxy

Wireguard client that exposes itself as a socks5 proxy
ISC License
4.37k stars 252 forks source link

Using wireproxy to share a wireguard VPN connection with multiple local peers #123

Open ZornsLemma opened 3 months ago

ZornsLemma commented 3 months ago

My VPN provider only allows a fixed number of wireguard connections and I have more machines than they allow.

I would like to set up wireproxy so it connects to my VPN provider (taking up a single connection) and have other machines connect to it as full wireguard peers.

(I already have a more basic setup where the other machines connect to wireproxy via SOCKS to share this single VPN connection, but I would like to be able to route all network access over the VPN without needing to configure each application to use a SOCKS proxy.)

Is this something wireproxy supports? I have been trying to set it up but I can't seem to get it to route any packets between the local peers and the VPN peer. My wireguard.conf has a ListenPort under [Interface] and I have added a [Peer] section for a single local peer as a test:

[Peer]
PublicKey = xxx
AllowedIPs = 192.168.2.2/32

The test machine can connect as a peer and ping the wireproxy machine via wireguard but nothing else.

Should this work and I have just misconfigured things, or is this pushing wireproxy too far? Is it capable of routing packets between multiple peers if configured correctly?

Thanks for any advice, and for creating wireproxy - whether it can do this or not, I have already found it incredibly useful.

pufferffish commented 3 months ago

Sorry but this is outside what wireproxy can do. This would require wireproxy being able to act as a NAT between your VPN provider and your other devices, which is outside the scope of wireproxy. It's better if you just stick with the classic wireguard/firewall rules for this use case.

Sent from Proton Mail mobile

-------- Original Message -------- On Jun 7, 2024, 06:18, ZornsLemma wrote:

My VPN provider only allows a fixed number of wireguard connections and I have more machines than they allow.

I would like to set up wireproxy so it connects to my VPN provider (taking up a single connection) and have other machines connect to it as full wireguard peers.

(I already have a more basic setup where the other machines connect to wireproxy via SOCKS to share this single VPN connection, but I would like to be able to route all network access over the VPN without needing to configure each application to use a SOCKS proxy.)

Is this something wireproxy supports? I have been trying to set it up but I can't seem to get it to route any packets between the local peers and the VPN peer. My wireguard.conf has a ListenPort under [Interface] and I have added a [Peer] section for a single local peer as a test:

[Peer] PublicKey = xxx AllowedIPs = 192.168.2.2/32

The test machine can connect as a peer and ping the wireproxy machine via wireguard but nothing else.

Should this work and I have just misconfigured things, or is this pushing wireproxy too far? Is it capable of routing packets between multiple peers if configured correctly?

Thanks for any advice, and for creating wireproxy - whether it can do this or not, I have already found it incredibly useful.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

ZornsLemma commented 3 months ago

Thanks for getting back to me. It's good to know this just isn't supported instead of me messing up the config. I'll investigate the other options, thanks again!