#Subnet router from docker container

1 messages · Page 1 of 1 (latest)

formal jetty
#

I'm trying to replace my openvpn set up with tailscale, where i have the ability to connect to various self hosted apps on a server at home from my mobile when i'm not on wifi.

To confirm, i want to be able to connect tailscale on my phone, then go to a browser and type for example 192.168.68.220:8080 and have it connect to that address and port on my home server.

I have various apps on multiple ports on this server and want to be able to connect to all.

From my limited understanding, i should be able to do this by creating a tailscale container on the server and then setting it up as a subnet router?

I use portainer to create and edit docker compose files in stacks and would prefer to do as much in portainer as possible.

I have successfully created a tailscale docker container using the authkey docker compose:

'''
version: "3.7"
services:
ts-authkey-test:
image: tailscale/tailscale:latest
container_name: ts-authkey-test
hostname: banana
environment:
- TS_AUTHKEY=tskey-auth-123456789
- TS_STATE_DIR=/var/lib/tailscale
- TS_USERSPACE=false
volumes:
- /home/cam/appdata/tailscale:/var/lib/tailscale
devices:
- /dev/net/tun:/dev/net/tun
cap_add:
- net_admin
privileged: true
restart: unless-stopped
'''

I'm now following https://tailscale.com/kb/1019/subnets and trying to do the next step - enable IP forwarding however am stuck. I assume i need to start with:

'''
echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
sudo sysctl -p /etc/sysctl.d/99-tailscale.conf
'''

However when i go to the container in portainer and try exec in the console i get error:

OCI runtime exec failed: exec failed: unable to start container process: exec: "bash": executable file not found in $PATH: unknown

Does anyone have any tips or can you point me to a guide that does what i want to do?

Thanks

Tailscale

Use subnet routers to give devices outside your local network access to services within specific subnets. Extend your private network with Tailscale.

granite sonnet
#

Have you tried using sh instead of bash in portainer

#

There is a pull down menu for which shell to use

formal jetty
#

I haven't thanks will try tonight

formal jetty
#

Thanks - that worked. Some comments in case anyone else gets stuck in the future:

Use sh in the portainer console dropdown.

Following the instructions on https://tailscale.com/kb/1019/subnets my docker container had the /etc/sysctl.d file so i used the first set of commands. Note sudo wasn't recognised, so i removed sudo and effectively executed:

echo 'net.ipv4.ip_forward = 1' | tee -a /etc/sysctl.d/99-tailscale.conf

echo 'net.ipv6.conf.all.forwarding = 1' | tee -a /etc/sysctl.d/99-tailscale.conf

sysctl -p /etc/sysctl.d/99-tailscale.conf

Then i ran:

sudo tailscale set --advertise-routes=192.168.68.0/24

Then i enable subnet routes in the admin console and it all worked!

I didn't need to add access rules... Is this necessary if its only me?

Otherwise thanks for the help and good luck all!

Tailscale

Use subnet routers to give devices outside your local network access to services within specific subnets. Extend your private network with Tailscale.