I would really really really like to have one device on my tailnet as the exitnode for all other devices on the tailnet. However, most VPNs make this really difficult. Is there any way to do this? I’ve read it’s possible with split-tunnelling, but ProtonVPN (which I use) doesn’t support that. I just installed Alpine Linux on my RPI 4b. And would like to use this as my exit node. Does anyone have any tips for how this could be done?

You are viewing a single thread.
View all comments
9 points

I have solved this problem! The trick is to use two Docker containers:

  1. Gluetun (https://github.com/qdm12/gluetun): set this up to connect to your VPN.
  2. Tailscale (https://tailscale.com/kb/1282/docker/): set this to use the Gluetun network.

Here is an example docker-compose.yml:

version: "3"
services:
  gluetun:
    image: qmcgaw/gluetun
    container_name: gluetun
    # line above must be uncommented to allow external containers to connect.
    # See https://github.com/qdm12/gluetun-wiki/blob/main/setup/connect-a-container-to-gluetun.md#external-container-to-gluetun
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    volumes:
      - ./gluetun:/gluetun
    environment:
      - VPN_SERVICE_PROVIDER=airvpn
      - VPN_TYPE=wireguard
      - WIREGUARD_PRIVATE_KEY=xxx
      - WIREGUARD_PRESHARED_KEY=xxx
      - WIREGUARD_ADDRESSES=xxx
      - WIREGUARD_MTU=1320
      - SERVER_COUNTRIES=United States
      # See https://github.com/qdm12/gluetun-wiki/tree/main/setup#setup
      # Timezone for accurate log times
      - TZ=America/New_York
      # Server list updater
      # See https://github.com/qdm12/gluetun-wiki/blob/main/setup/servers.md#update-the-vpn-servers-list
      - UPDATER_PERIOD=24h

  tailscale:
    container_name: tailscale
    cap_add:
      - NET_ADMIN
      - NET_RAW
    volumes:
      - ./tailscale/var/lib:/var/lib
      - ./tailscale/state:/state
      - /dev/net/tun:/dev/net/tun
    network_mode: "service:gluetun"
    restart: unless-stopped
    environment:
      - TS_HOSTNAME=airvpn-exit-node
      - TS_AUTHKEY=xxxxxxxx
      - TS_EXTRA_ARGS=--login-server=https://example.com --advertise-exit-node
      - TS_NO_LOGS_NO_SUPPORT=true
      - TS_STATE_DIR=/state
    image: tailscale/tailscale
permalink
report
reply
5 points

Wow! You know what, I was just thinking about using Gleutun for this enefore I went to bed last night, and then I wake up to this gem of a message!! 😅 Well done sir, I’ll be cooking this up ASAP!

permalink
report
parent
reply
3 points

Let me know how it works out for you! I’m happy to be able to share this. I was very pleased with myself but had no one to tell haha. I actually have several copies of this set up with each Gluetun instance connected to different countries. Then, changing country is as easy as changing your tailnet exit node!

permalink
report
parent
reply
3 points

Awesome stuff dude! I will totally do this too 😁 Worst thing is I am already using Gleutun and I am ashamed I didn’t think about using it for this before… But honestly gonna have to donate some money to the developer of Gleutun as its just so awesome.

permalink
report
parent
reply
2 points

Hell yeah, got that working in an instant! Appreciate the pointer, have a great weekend! :)

permalink
report
parent
reply
1 point
*

For anyone trying this, make sure you do not have “- TS_USERSPACE=false” in your yaml from previous experimentation. After removing this, it works for me too.

In the documentation they say to add sysctl entries, it is possible in docker compose like so:

tailscale:
    sysctls:
      - net.ipv4.ip_forward=1
      - net.ipv6.conf.all.forwarding=1

But it does not seem to make a difference for me. Does anyone know why these would not be required in this specific setup?

permalink
report
parent
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 7.5K

    Monthly active users

  • 6.6K

    Posts

  • 179K

    Comments