HELP: Wireguard for home network with remote exit node
I am looking for some advice on how to (if possible) setup a wireguard network for my home network and when I am connected to that network have a remote wireguard server act as an exit node, so that all external traffic appears to be coming from that remote server whilst keeping traffic bound for the home network local (only accessible via wireguard network)
Local server is a Debian box and other devices will run a flavour of linux. Remote server is already running wireguard and I can connect to that if I bring up a route on each device, but ideally I want to connect to my home net and automatically have outbound traffic go via the remote server. The remote server's wireguard config is not under my control, which may make this unfeasible
comrade_twisty
in reply to PortNull • • •like this
metaStatic likes this.
PortNull
in reply to comrade_twisty • • •null_dot
in reply to PortNull • • •It's not really clear exactly what you want.
When you're at home, and for services running on your home server, it you want everything to go through the remote wireguard server then that's achievable.
However, if you want to be able to access services running on your home server, while you're not at home, via that remote wireguard server, that generally requires port forwarding which commercial providers generally don't offer.
Can you clarify ?
PortNull
in reply to null_dot • • •Yes I want to be able to access my home services from outside over wireguard, but connect directly into the home network. However once connected to the home network I want all traffic to be routed outside via the remote wireguard server.
jubilationtcornpone
in reply to PortNull • • •I want to make sure I understand your goal correctly.
Here's what I'm getting.
Here's the part where I'm a little fuzzy
Did I get any part of that wrong?
Edit: NVM. I saw your response to another comment that sounds like this is exactly what you want.
This should be achievable via routing. I actually do the same thing. The main difference is all the work is done on my router which handles both wire guard connections and routing.
At the minimim you're going to need:
PortNull
in reply to jubilationtcornpone • • •magikmw
in reply to PortNull • • •You can set this up with your router connecting to the remote server and routing your client traffic through there instead of the gateway your router is using for WAN.
Specifics are router... Specific.
You can do the same with a vm in your network acting as a router or proxy as well, pick your poison.
spaghettiwestern
in reply to PortNull • • •If I'm understanding what you want to do, I have this set up on an OpenWRT router with multiple remote endpoints used for different devices. Our phones go to a hosted Wireguard server in one city, PCs to an OpenWRT router in a different location, and IOT devices that aren't blocked and guest devices exit access the Internet locally. With some additional work you should also be able to have remote devices connected via WG exit wherever you like.
Policy Based Routing on OpenWRT makes this possible and it should be doable as long as the devices you want to allow to exit the remote server are included in that server's "Allowed IPs" setting. (Maybe there's a way around that, but I haven't had to deal with it.)
sem
in reply to PortNull • • •PortNull
in reply to sem • • •abeorch
in reply to PortNull • •The one you want to use as an exit node is a commercial vpn provider right?
whatever you want - its pretty much achievable with openwrt, wireguard and some routing (maybe using policy based routing)
Bonus there is a wireguard client app for android that automatically switches off the tunnel back to your home server if you are on its Lan. Its called WG Wireguard.
Selfhosted reshared this.
PortNull
in reply to PortNull • • •network_mode: container:wireguard
.Now when I connect tailscale over the exit node, traffic is going out over the wireguard IP
Setting up a Tailscale Exit Node through NordVPN
Jimmy Wei (The Dev Quill)stratself
in reply to PortNull • • •Hey, glad you got it working. I'm late to the party, but I got a similar solution here: github.com/stratself/tswg. Basically just mounts your own wg.conf to the container and get Tailscale connected over it
Since Wireguard is peer-to-peer, I suppose the "intended" way is to install Tailscale on every client. But it is possible to use the router as a VPN gateway as per this [OpenWRT guide])openwrt.org/docs/guide-user/se…). Hope you get it working anyhow
GitHub - stratself/tswg
GitHubabeorch
in reply to PortNull • •Selfhosted reshared this.