Question

Connect to DigitalOcean droplet localhost through WireGuard

Posted May 1, 2021 275 views
VPN

Hey there,

I used a PiVPN setup at home and was able to access localhost resources using my mobile phone successfully. I now however am looking to access some localhost resources hosted on a DigitalOcean doplet. I have managed to install PiVPN the same way, and I am able to connect to the wireguard server and route all traffic through the VPS successfully (my IP shows as the DigitalOcean server IP).

What I can not do however, is access localhost resources. For testing I installed an Nginx server running on localhost, which is at 10.18.0.5 on the droplet, but I can not reach this from my home computer.

Configs are as follows:

Home computer (named alice for testing):

[Interface]

PrivateKey = ILLHtp3d6qyP2wfWvBgsys3tTGfLUv6at7Jf9t/Y2X4=

Address = 10.6.0.2/24

DNS = 1.1.1.1, 1.0.0.1


[Peer]

PublicKey = XXX

PresharedKey = XXX

Endpoint = XX.XX.XX.XX:51820 (VPS IP address)

AllowedIPs = 0.0.0.0/0, ::0/0

WireGuard server:

[Interface]

PrivateKey = XXX

Address = 10.6.0.1/24

ListenPort = 51820


PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQ>

PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MA>



### begin alice ###

[Peer]

PublicKey = XXX

PresharedKey = XXX

AllowedIPs = 10.6.0.2/32

### end alice ###

Some extra notes:

  • I can reach the Nginx server with curl 10.18.0.5 on the VPS, the Nginx server does run
  • I am able to ping 10.6.0.1 and 10.18.0.5 from the home computer

Any help would be appreciated!

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!