Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wireguard Tunnel for Docker Containers - Tunnel Containers to a VPS with public IPV4

Featured Replies

Hi, 

 

I have following issue: I don't have a public IPV4-Address but want to run some servers. I rented a VPS with a public IPV4 and successfully forwarded ports like 8080 on a VM to the VPS.

 

I tested a setup which allows me to tunnel let's say a nginx-server from my Unraid VM via my VPS (with a public ipv4-address) and make it accessible via the VPS's IP like "123.123.123.123:80". I used this tutorial and it works great: https://gist.github.com/Quick104/d6529ce0cf2e6f2e5b94c421a388318b

I can access the Server running on the VM (with wireguard inside) on my UnRaid-Server.

 

Now, I want to simple use this method to access my docker containers. So I set up the build in Wireguard-Feature in unraid. The container is able to connect to the internet via the VPS IP. All port forwardings are set on the VPS as always. But I can't access let's say port 8080 on the VPS Ip. Curious: When I run a port scan, it shows me a active port 8080. It looks like the webpage is loading, but it's not.

 

There must be a problem between the wireguard endpoint on my unraid and the container.

 

Following IPTables are set on the VPS (The VPS Setup shouldn't be the problem):

 

iptables -A FORWARD -i eth0 -o wg0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT &
iptables -A FORWARD -i wg0 -o eth0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT &

iptables -A FORWARD -i eth0 -o wg0 -p tcp --syn --dport 8080 -m conntrack --ctstate NEW -j ACCEPT &
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8080 -j DNAT --to-destination 10.66.66.2 &
iptables -t nat -A POSTROUTING -o wg0 -p tcp --dport 8080 -d 10.66.66.2 -j SNAT --to-source 10.66.66.1 &

These Iptables work when running the tunnel directly between a VM (KVM) and the VPS.

 

I also tried the docker-container gluetun-vpn. It produces the exact same issue. I can't connect to ports like 8080 via the "vpn tunneled access for docker".

 

Is there anyone having the same issue or solved it?

 

Thanks Unraid-Community!

 

WGSetup.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.