Score:0

Access the localhost of a Wireguard peer from the local host from another peer?

in flag

I have two peers in Wireguard -- A and B. A has a service running on 127.0.0.1:2001. I want to connect A and B, so that B can access that service on 127.0.0.1:2001 as well. Alternatively, I want to forward 127.0.0.1 to a peer -- however, adding 127.0.0.1/32 to AllowedIPs does not work (at least on MacOS).

us flag
You need to set up SSH tunneling for this.
StarDust avatar
in flag
@TeroKilkanen SSH Tunneling does not offer ranges.
StarDust avatar
in flag
Especially since I want to port forward everything from `2001-65535`.
StarDust avatar
in flag
I can use a SOCKS proxy, but it wouldn't be global.
Score:0
cn flag

Get the IP of peer B within Wireguard, then on peer A you can connect in its browser just to the IP of peer B. Should work since you're connected through Wireshark.

StarDust avatar
in flag
Yes, but I want to access it on my localhost.
cn flag
What's stopping B accessing the service on the internal IP instead, e.g. `192.168.1.2:2001`?
StarDust avatar
in flag
@shearn89 Because it's not connected to that IP, only `127.0.0.1` on A, also, it doesn't allow me to access it on `127.0.0.1` on B.
cn flag
Would it not make sense to have peer A run the service on the wireguard interface? Then B can access it over WG?
Ginnungagap avatar
gu flag
Binding to the Wireguard interface is the only sensible solution, anything else to access localhost from remote hosts is a hack and quite frankly, a terrible idea.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.