0

My System:

Local: Arch Linux
VPS: Linode uubuntu 20.04.1
Standard Wireguard Package on both ends

So I am using airdcppd, a file sharing program which uses 3 ports on my local machine to transfer traffic info.

They are:

23288/tcp
21500/udp
13875/tcp

What I want to do is to forward these ports to the VPS wireguard so it will appear as if the ports on running on the server side and are opened to the public.

To achieve this I modified my wireguard interface config according to these guides:

Guide 1

Guide 2

So my config now looks like so:

local:

[Interface]
PrivateKey = <my key>
Address = 10.66.66.2/32,fd42:42:42::2/128
DNS = 1.1.1.1,94.140.15.15

# packet forwarding
PreUp = sysctl -w net.ipv4.ip_forward=1

# port forwarding
PreUp = iptables -t nat -A PREROUTING -d local.ip.address -p tcp --dport 23288 -j DNAT --to-destination 10.66.66.1
PreUp = iptables -t nat -A PREROUTING -d local.ip.address -p udp --dport 21500 -j DNAT --to-destination 10.66.66.1
PreUp = iptables -t nat -A PREROUTING -d local.ip.address -p tcp --dport 13875 -j DNAT --to-destination 10.66.66.1
PostDown = iptables -t nat -D PREROUTING -d local.ip.address -p tcp --dport 23288 -j DNAT --to-destination 10.66.66.1
PostDown = iptables -t nat -D PREROUTING -d local.ip.address -p udp --dport 21500 -j DNAT --to-destination 10.66.66.1
PostDown = iptables -t nat -D PREROUTING -d local.ip.address -p tcp --dport 13875 -j DNAT --to-destination 10.66.66.1

[Peer]
PublicKey = <my key>
PresharedKey = <my key>
Endpoint = vps.ip.address:49503
AllowedIPs = 0.0.0.0/0,::/0

server:

[Interface]
Address = 10.66.66.1/24,fd42:42:42::1/64
ListenPort = 49503
PrivateKey = <my key>

PreUp = iptables -t nat -A PREROUTING -d vps.ip.address -p tcp --dport 23288 -j DNAT --to-destination 10.66.66.2
PreUp = iptables -t nat -A PREROUTING -d vps.ip.address -p udp --dport 21500 -j DNAT --to-destination 10.66.66.2
PreUp = iptables -t nat -A PREROUTING -d vps.ip.address -p tcp --dport 13875 -j DNAT --to-destination 10.66.66.2
PostDown = iptables -t nat -D PREROUTING -d vps.ip.address -p tcp --dport 23288 -j DNAT --to-destination 10.66.66.2
PostDown = iptables -t nat -D PREROUTING -d vps.ip.address -p udp --dport 21500 -j DNAT --to-destination 10.66.66.2
PostDown = iptables -t nat -D PREROUTING -d vps.ip.address -p tcp --dport 13875 -j DNAT --to-destination 10.66.66.2

### Client name
[Peer]
PublicKey = <my key>
PresharedKey = <my key>
AllowedIPs = 10.66.66.2/32,fd42:42:42::2/128

So as you can probably see, my wireguard internal address for local is: 10.66.66.2 and for the server is 10.66.66.1

What happens now is that the local port 23288 on local machine, which appears as open without being vpn-ed is also shown as open after checking with a port checker. The other three ports are still closed but that is not too much of a concern since the main port used is open and that is good enough for my purposes. The other ports are also shown as closed even without being vpn-ed.

No firewalls are used as of now, I am going to allow all the ports invovled after I get this working.

The problem arises is what happens after the packages are sent through the vpn, it doesn't seem to come back to local. As you can I see, I did set up the rules to send back all the packages on those 3 ports back to local machine. But for some reason I am not getting them, as in the app airdc is not displaying what it should.

Did I do something wrong in trying to "forward" back the traffic of those ports to the local machine? Is it the correct way for my local app to receive back the packges? If it is not, what should be the correct way of setting up the VPS wireguard config so that whatever is forwarded on those three ports are returned properly?

Thank you for looking!

EDIT: The local port I use to use to access the service is http://localhost:5960 , and I would like to use that with the vpn so I can access it from the web too, so like this: https://vps.ip.address:5960 , but even if I added a line to forward local port 5960 to the server with the same syntax above it is still not working, maybe this is the key to get the whole thing working too?

1 Answer 1

0

You will instead have to forward the ports from the VPS side to the local machine's internal IP. Like you would on a router at your home to your PC's local address. Not connect the local machine to VPS.

You must log in to answer this question.