ghostserverd / mediaserver-docker

Docker compose for comprehensive autonomous media server
253 stars 42 forks source link

Wireguard VPN port forward with Mullvad not working as expected #16

Open sourea opened 4 years ago

sourea commented 4 years ago

I opened up port on my wireguard key as described in https://mullvad.net/en/help/port-forwarding-and-mullvad/

I changed the exposed port on one of the services in the compose file to the port mullvad allocated. I am able to access the service over the specified port on the local network. However, I am unable to reach the same using the wg interface's public ip address and port combination. I checked an online port tester tool as well and the port shows as closed.

Is there any specific configuration that needs to be set to enable port forwarding seamlessly?

ghostserverd commented 4 years ago

This is probably a dumb question but have you forwarded the port on your router?

sourea commented 4 years ago

I have forwarded the port on my router. It seems like it only works if the service inside the docker container uses the same port number as the number exposed by mullvad on the key. For example I setup a simple nginx hello container (https://hub.docker.com/r/nginxdemos/hello/) and mapped my mullvad port (Say 12345) to 80 inside the container i.e

service:
  hello:
    network_mode: service:wireguard

  wireguard:
    image: ghostserverd/wireguard
    ports:
      - 12345:80 # does not work

Then I tried a netcat inside another container but mapped the mullvad port to the same one inside the container this time

service:
  netcat:
    network_mode: service:wireguard

  wireguard:
    image: ghostserverd/wireguard
    ports:
      - 12345:12345 # works

By making netcat listen on the same port, I was able to see that it was open with an online port scanning tool on mullvad's allocated public ip. I am not sure if its something to do with how the iptables rules are setup or not so far