this post was submitted on 10 Aug 2023
7 points (100.0% liked)

Self Hosted - Self-hosting your services.

11447 readers
12 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

Important

Beginning of January 1st 2024 this rule WILL be enforced. Posts that are not tagged will be warned and if not fixed within 24h then removed!

Cross-posting

If you see a rule-breaker please DM the mods!

founded 3 years ago
MODERATORS
 

This is a question mostly for the sake of trying to learn more about how self-hosting works, and it is not vital that I resolve this. But if anyone wants to help me understand this, I would greatly appreciate it.

I have a media server running at home with certain Docker containers (Jellyfin, Navidrome and Audiobookshelf currently). I have not exposed these services to the internet, so they are currently only accessible on my home network, which is all I need for the time being. The server itself is connected to an external VPN provider as there may or may not be some torrenting involved at some point. Let's say the name of the server is mediaserver.

From my laptop connected to the same network, I can access all these services through http://mediaserver.local: or http://:, while connected via the same VPN provider on the laptop also. On my cell phone (running CalyxOS), I am unable to do so. I need to disable VPN in order to access the services.

What is the difference between my laptop connected via VPN and my phone doing the same thing, both connected to my home network. I didn't actually think the VPN would come in to play before making requests outside my home network, but that's probably just me being ignorant.

top 15 comments
sorted by: hot top controversial new old
[–] [email protected] 4 points 1 year ago (1 children)

Not an expert but my first thought is check DNS. I would make sure both devices are using the same DNS resolver and are resolving the hostname correctly.

[–] [email protected] 2 points 1 year ago

This is probably where my lack of knowledge in networking shines through more than ever, but I kinda thought that local IPs would be handled locally and not depend on which DNS servers I use? But I guess that if VPN is active and has not been explicitly told to allow local connections through split tunneling, then it actually do make that request with whatever DNS server I use, which obviously couldn't resolve some random local hostname?

[–] [email protected] 2 points 1 year ago (1 children)

You probably need to set up split tunneling in your VPN app on your phone. Either enable split tunneling for the apps on your phone that you use to connect to your home server or enable split tunneling in the VPN app for the local IP address of your home server so that you can use any apps to connect to your home server while still having the VPN enabled for any other websites you visit in those apps. I know ProtonVPN and Mullvad both automatically have split tunneling set up for local IPs on PC but not for Android, this would explain the differences between your laptop and phone

[–] [email protected] 1 points 1 year ago

Ah, that would explain it. I could set up split tunneling on a per app basis only in my current VPN, and not IP, but it works. However, I am in the process of migrating to ProtonVPN now. Here the "per app"-permission also works, and it does have the option to allow certain IPs, but I was not able to get it to work.

[–] [email protected] 1 points 1 year ago (1 children)

It depends on the VPN. Sometimes there's a "block local network access" while connected. It could be a client setting or a server setting. Additionally, VPNs are all about routing. So you could run into a problem if you connect to a VPN where the remote network is the same as the IP address of the server you're trying to connect to.

So if it is that you're having a conflict between the remote and local networks overlapping, you could change the IP addresses on your local network. It's probably a good idea not to use the default subnet that your router gives you (like 10.0.0.0 or 192.168.0.0 or 192.168.1.0).

[–] [email protected] 1 points 1 year ago (1 children)

Just checked this, and "Allows local access" is checked in the VPN application, and "Block all non-VPN traffic" is unchecked in Android settings.

About potentially overlapping IPs: I did check, and they were all different (server, laptop, phone).

[–] [email protected] 1 points 1 year ago

Try the VPN IP of your other box instead of the FQDN? I use tailscale+headscale to exit onto my home network from mobile.

I had no idea that two hosts using the same VPN provider would/could be on the same network... I share an account with like 4 other people and we each get one device. Now I have to go look.

[–] [email protected] 0 points 1 year ago (2 children)

Check your wan IP on both your laptop and phone.

I typically use curl https://checkip.amazonaws.com

[–] [email protected] 4 points 1 year ago (2 children)

Tip: curl ifconfig.me

It's shorter, gives additional info when accessed with a browser, and I don't trust Jeff Bezos.

[–] [email protected] 2 points 1 year ago (1 children)

Alternatives:

ipconfig.io

ifconfig.io

ipinfo.io < this also gives info about the IP and you can use it to do ip lookups with ipinfo.io/IP

You can also get your ip through cloudflare dns :

dig ch txt whoami.cloudflare @1.1.1.1 +short

[–] [email protected] 2 points 1 year ago (1 children)

You can also just self host this also by adding a line in your Nginx config to return the client IP var. I have ip.domain.ca and curl that. On mobile now but if anyone is interested I'll post my config later.

[–] [email protected] 2 points 1 year ago (1 children)

Would definitely be interested

[–] [email protected] 2 points 1 year ago

This is all you need. It'll return your IP in a curl/wget/browser

  location / {
    add_header Content-Type text/html;                             
    return 200 '$remote_addr';
  }
[–] [email protected] 1 points 1 year ago
[–] [email protected] 1 points 1 year ago

They are different, but share the first three numbers.