this post was submitted on 29 Jan 2024
8 points (90.0% liked)

Selfhosted

40570 readers
582 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

I finally decided that I wanted to be able to externally access some of my Docker containers from outside of my local network. I don’t want to deal with the security hassle of exposing ports on my router, so I decided to go with Tailscale.

All of my container web services are run through traefik and are accessed using hostnames I set up on my DNS server. How would I go about accessing the different web services externally since the hostnames don’t resolve?

all 9 comments
sorted by: hot top controversial new old
[–] [email protected] 4 points 10 months ago (1 children)

https://tailscale.com/kb/1054/dns#nameservers

and

https://tailscale.com/kb/1114/pi-hole#step-3-set-your-raspberry-pi-as-your-dns-server

Set tailscale to use your dns server to resolve your services (or all traffic if you prefer). Assuming your dns server is on 100.x.x.1:53, then put 100.x.x.1 as a nameserver.

[–] WASTECH 2 points 10 months ago* (last edited 10 months ago)

I set that up, but the issue now is that my DNS server is replying back with the private IP, which is not accessible from tailscale.

EDIT: Figured this one out. Need to advertise the routes from one of my machines. Set that up and I am good to go now. Thanks!

[–] [email protected] 1 points 10 months ago (1 children)

Get yourself a domain name. It doesn't cost a whole lot and also allows you to complete DNS-01 challenges for SSL certs. It's also, like, your own. That's also a requirement for owning your email address.
(If you really don't want to pay and don't care about email, you can also use a shared domain DNS such as dedyn.io.)

You then simply set records to the Tailscale IP addresses of the hosts and you're good to go. Alternatively, you can also set them to the hosts' LAN subnet addresses and forward your subnet via a single subnet router; that's how I do it.

[–] WASTECH 2 points 10 months ago

I own 3 different domains and just today set up SSL services for them using Traefik (made another post for an issue I’m having with that).

I ended up doing a subnet router and that got me what I was looking for.

[–] [email protected] 1 points 10 months ago* (last edited 10 months ago) (1 children)

I assume when you say externally you mean via Tailscale, but without running Tailscale on each container/service?

What I currently do is run Tailscale on a few workstation-type devices, but everything else in my network doesn't run the Tailscale client (partly because things like printers, outers, etc can't run the client, and it's less convenient for things like servers).

Those type of devices can be accessed by running one Tailscale node as a Subnet Router. This device is then able to route traffic to it's subnet. Currently I use a Raspberry Pi for this.

My Pi also runs PiHole and acts as my DNS server, so it can name resolve local resources, though I don't think this is required, because Tailscale has its own DNS resolution called Magic DNS. So your Subnet Router should be able to resolve those names anyway (going off memory here, so be sure to check the docs, I may be misremembering how it works since I use the same device for DNS).

You don't even need Tailscale on a remote device to access your LAN - if you enable the Funnel service, you can provide an inbound encrypted path to specified resources.

[–] WASTECH 1 points 10 months ago

That is almost the exact same thing I am doing. I have 2 Pi's running PiHole in HA and I just made one of them the subnet router to allow this access. Since I will be the only one using this, I don't care to use Funnel right now, but thanks for showing that to me. I am (obviously) new to using Tailscale, and that looks like a very neat feature.

[–] JoeKrogan 1 points 10 months ago* (last edited 10 months ago)

I use wireguard and nginx but I set my WG DNS as the server ip. I have adguardhome running on the server and have added the external domains to map to their LAN address so theyre resolved locally when using the vpn or the LAN. A similar setup should work for you.

[–] [email protected] 0 points 10 months ago* (last edited 10 months ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
DNS Domain Name Service/System
HA Home Assistant automation software
~ High Availability
HTTP Hypertext Transfer Protocol, the Web
IP Internet Protocol
PiHole Network-wide ad-blocker (DNS sinkhole)
SSL Secure Sockets Layer, for transparent encryption
nginx Popular HTTP server

[Thread #463 for this sub, first seen 29th Jan 2024, 16:15] [FAQ] [Full list] [Contact] [Source code]