this post was submitted on 09 Jul 2025
15 points (100.0% liked)

Linux

11910 readers
111 users here now

Welcome to c/linux!

Welcome to our thriving Linux community! Whether you're a seasoned Linux enthusiast or just starting your journey, we're excited to have you here. Explore, learn, and collaborate with like-minded individuals who share a passion for open-source software and the endless possibilities it offers. Together, let's dive into the world of Linux and embrace the power of freedom, customization, and innovation. Enjoy your stay and feel free to join the vibrant discussions that await you!

Rules:

  1. Stay on topic: Posts and discussions should be related to Linux, open source software, and related technologies.

  2. Be respectful: Treat fellow community members with respect and courtesy.

  3. Quality over quantity: Share informative and thought-provoking content.

  4. No spam or self-promotion: Avoid excessive self-promotion or spamming.

  5. No NSFW adult content

  6. Follow general lemmy guidelines.

founded 2 years ago
MODERATORS
 

Hello everyone, I have I guess a bit tricky situation on hand

I have 4 devices (2 computers, 2 cellphones) on my home network, they're all connected on the same LAN, and additionally, all are also running Tailscale (rather out of the box configuration except specific IPv4 addresses given by me)

When going out of home, I normally take up to 2 devices with me and connect to the ones at home through the Tailscale IP

Usually I do this by typing the IP address manually on either scenario, if I'm home I connect typing the LAN IP Addresses for the devices, otherwise I manually type the Tailscale IP addresses

I would like to now optimize this process using Host Names; I would like to type in say, SSH pc1 and that connect via LAN IP if available, and otherwise fallback to Tailscale IP if not

Result being I can just type the one singular host name, and connect successfully regardless if I'm home or not, also using the best possible connection (LAN preferred over Tailscale)

I am aware Tailscale has a feature that it does this out of the box using the Tailscale IP on the same LAN, but this doesn't seem to work on all devices (the phones) and additionally that generates some noticeable overhead given their age too

I have been reading about Avahi and thinking of using it on each device, advertising the same host name with both it's IPs, which I am yet to try but figured I could use more input on solutions if anyone has experience with it, I'd appreciate any

Thanks for reading, and I hope you have a nice day

you are viewing a single comment's thread
view the rest of the comments
[โ€“] oranki@piefed.social 1 points 3 days ago (1 children)

mDNS refers to multicast DNS (.local), while similar you should not mix it up with Tailscale's MagicDNS, which is entirely a Tailscale thing, dependent on their APIs.

mDNS also seems to be what you're after too. For the hostname-only resolution to work, you need to have Avahi or equivalent mDNS daemon running on the hosts, and add .local to the search domains. Setting search domains can be done manually on each host or via DHCP network-wide.

With mDNS and .local in the search domains, when you try e.g. http://myhost/ in the browser, the browser first tries myhost, then adds each search domain, e.g. myhost.local. Since .local is reserved for mDNS, querying it results in an mDNS query in your network, and if there's a device with a matching name, it will respond with it's IP address.

Note that if you have Tailscale and MagicDNS active, your tailnet's domain will (or should) be the first one on the search domains list, and your DNS server is set to 100.100.100.100, which is a dummy address on which the tailscale daemon runs the internal DNS server for Tailscale, including MagicDNS.

Multicast DNS / Avahi is a little bit error prone in my experience, but when nothing goes wrong, this would give you what you're looking for.

There are other options, like your router automatically registering DNS entries for DHCP hosts, or running a separate DNS server anf manually adding records for the hosts you need this for.

[โ€“] Coki91@lemmy.world 1 points 1 day ago

Right, I didn't pick up on that m/multicast DNS difference, I thought I was talking about the same thing, thanks for clarification

Sounds like I do have options here, so while I wait for my ISP to comply, I'll also try out Avahi then