Jump to content

How to Set and Select from Multiple Emby Servers?


Natetronn
Go to solution Solved by darkassassin07,

Recommended Posts

Natetronn

My search-foo is coming up short for some reason.

Is there a way to set multiple servers in the Emby Apps?

For example, I have a single server that runs over a tunnel (cloudflared) and it has url I use to access it when out and about. That same server runs over an IP address and port when I'm home as well. I'd like to use the remote version when away and the local version when home.

So I go to Settings > Change Server, where there is an icon/option to Add Server, which I do. But then the previous server I had set (whether remote or local) is no longer listed and can't be selected or switched to, so I'm forced to add it again and vice versa.

Am I missing something? Is there not a way to add and then switch between server using the various apps and their Select Server options? Currently it seems only one server can be listed at a time, which makes the whole process a bit cumbersome.

Link to comment
Share on other sites

Natetronn

To add context. I've added two different servers here on Android and only the one or the other ever shows up, and this even though they have different addresses and I added both.

Screenshot_20240401_124505_Emby.jpg

Link to comment
Share on other sites

Hi there, are you cloning the two servers?

Link to comment
Share on other sites

17 hours ago, Natetronn said:

That same server

Hi.  The Emby apps track servers by their ID not their address (since there can be multiple addresses for a single server e.g. local and remote).  So, you cannot achieve what you are trying to here with the same actual server.

Link to comment
Share on other sites

Natetronn
Posted (edited)
3 hours ago, ebr said:

Hi.  The Emby apps track servers by their ID not their address (since there can be multiple addresses for a single server e.g. local and remote).  So, you cannot achieve what you are trying to here with the same actual server.

Thank you both for the help!

Okay, that makes sense why it wouldn't be working, since in my case it's the same server, only accessed differently (via url or IP).

Any suggestions for a workaround? Would a second server install address this? I assume that could work; I'll give it a try a bit later. Is that what you were alluding to, Luke?

Or would this be a feature request at this point?

 

Edited by Natetronn
Link to comment
Share on other sites

Lessaj

You could use a reverse proxy which when external resolves to the external address and when internal resolves to the internal IP.

Link to comment
Share on other sites

Natetronn
Posted (edited)
30 minutes ago, Lessaj said:

You could use a reverse proxy which when external resolves to the external address and when internal resolves to the internal IP.

That's not already achieved with  cloudflared tunnel and its remote IP? Or is it still not working since that itself points back to the same internal IP?

Would you mind elaborating a bit? I'm not fully understanding how reverse proxy addresses the single (same) server ID issue.

 

Edited by Natetronn
Link to comment
Share on other sites

Happy2Play

Delete the server id (device.txt) on one server so each has their own.  Emby will generate a new one at startup.

Path will vary per platform (C:\Users\Username\AppData\Roaming\Emby-Server\programdata\data).

 

Link to comment
Share on other sites

adminExitium

In general, this is resolved via NAT reflection or split-horizon DNS depending on the capabilities of your router and whether your DNS server is running on your local network or elsewhere.

Link to comment
Share on other sites

Lessaj
1 hour ago, Natetronn said:

That's not already achieved with  cloudflared tunnel and its remote IP? Or is it still not working since that itself points back to the same internal IP?

Would you mind elaborating a bit? I'm not fully understanding how reverse proxy addresses the single (same) server ID issue.

 

Within my network my pfSense devices acts as the DNS resolver, so when my device asks for https://my.custom.domain it returns a 192.168.x.x based address because that's what I've configured, when I'm outside my network and I ask for https://my.custom.domain the request will go to a different DNS provider, could be Cloudflare or Google or whatever DNS host, those will resolve the external address, whatever that may be. So if I'm on my cell phone for example and I'm on my wifi and I open the emby app it will connect using my reverse proxy using the internal IP returned from the DNS query and if I close the app and turn off my wifi so now I'm on my cellular data and I open the emby app it will connect using the external IP returned from the DNS query. I don't have 2 entries, both internal and external are using the same domain name, just a different IP address is returned from the DNS query.

Edited by Lessaj
  • Like 1
Link to comment
Share on other sites

1 hour ago, Happy2Play said:

Delete the server id (device.txt) on one server

He's using the same physical server - just two different routes to it.

We recently had a discussion about this same exact scenario but I don't recall if there was any satisfactory resolution.

Link to comment
Share on other sites

OK so it's not actually multiple servers?

Link to comment
Share on other sites

Natetronn
Posted (edited)
1 hour ago, Luke said:

OK so it's not actually multiple servers?

That's correct. It's one server. I apologize for any confusion; I see now I wasn't clear in my posts in that I want to be able to add multiple "servers" (since that's the terminology in the various apps ui), but in reality I want to be able to add multiple "routes" to a single server.

5 hours ago, ebr said:

He's using the same physical server - just two different routes to it.

Yup, exactly. Locally I connect using the local Emby server ip:port and for remote I use a domain (no port signin) that I have setup via cloudflared that tunnels to the that same Emby server.

5 hours ago, ebr said:

We recently had a discussion about this same exact scenario but I don't recall if there was any satisfactory resolution.

Sounds like the only way to get by this would be to setup a second Emby server, one for my local access and another for remote access? That way there are two different Emby Server IDs?

I'm running the Docker version, so setting up another container wouldn't be a big deal, but then it wouldn't be very "DRY". Too bad there wasn't some sort of "switch" that could manage switching between multiple routes.

Anyway, really appreciate everyone's help on this!

 

Edited by Natetronn
Link to comment
Share on other sites

darkassassin07

This is handled automatically already is it not? Why do you want to manually switch routes?

 

When on the servers LAN (and able to reach it) clients will use the LAN address listed in the server dashboard. (this can be overridden with a different address if desired), if they can't reach that; then they'll use the domain.

 

I run a very similar setup: external domain is used from both LAN and WAN with different addresses returned depending on dns resolver. Previously I allowed clients to reach embys lan IP+port directly, switching routes as they see fit. Recently, I've switched to that address being unreachable to clients. Now clients are forced to use the domain regardless of location, with the IP returned determining the route used.

Both scenarios have worked without issue.

Link to comment
Share on other sites

Natetronn

Perhaps I'm missing something? Btw, I'm running the docker version of Emby server, if it matters.

19 minutes ago, darkassassin07 said:

This is handled automatically already is it not? Why do you want to manually switch routes?

I actually want to be able to add both routes for a single Emby Server in the various apps (Emby Android app, for example). Currently, when I add one route, it removes the other route that I previously added. That is, I'm not able to have two routes that both point to a single Emby server (and its Server ID) when using the Android app; apparently because the Server ID is the same and it therefore doesn't know there is a difference between the two routes; if I'm reading ebr correctly.

Being able to switch between routes on the Apps, whether having a place where the routes can be changed somehow in the UI, or by adding two servers (talking client UI terminology here; see above screenshot again), but with two different routes, both of which point to the same server and its Server ID, is fine by me.

But it doesn't sounds like that's currently possible and isn't something that exists.

When I'm home, I'd like to use a local IP address. When I'm on the go, I'd like to use my domain that is setup with cloudflared. And I'd like to avoid having to type in the ip:port or url again, since that's a bit of pita. And I don't want to use an external domain and run traffic through Cloudflare and my ISP if I don't have to.

I'm not fully following your suggestions under the context, but I'll consider it a bit more after letting it sink in a bit. Thanks for your support, either way.

Link to comment
Share on other sites

darkassassin07

When you look at your server dashboard, there are two addresses listed: 'In-Home (LAN) access' and 'Remote (WAN) access'.

Both of these addresses are passed to and remembered by every client that connects to your server, regardless of what address they actually used to connect.

Then, later, when attempting to re-connect to the server, the client will try both addresses. If it successfully connects to the 'In-Home' address, it'll just use that. Otherwise it'll fall back to the 'Remote' address. This is entirely automatic.

 

Clients will automatically switch between these addresses as necessary, preferring the 'In-Home' address if it's reachable.

You shouldn't need to do anything more.

 

 

Though: as you are running via docker; the default 'In-Home' ip will be the ip of the docker container emby runs in. You'll want to manually specify the IP of the host machine under network settings.

 

 

Finally, the apps will perform a fresh DNS resolution if/when the network changes (wifi>mobile data for example). So you don't even need the apps to know two addresses, they can just keep using the domain and allow the dns to determine the route based on the ip returned. This is what I've been doing for a few months now, as my emby server is also running in docker, but without ports directly exposed.

/edit: I misstook Lessaj's response for one of your own. If you do not have an internal DNS server returning your servers lan ip when you're using your domain within your LAN, my final paragraphs in this and the previous response will make little sense... Sorry about that.

Edited by darkassassin07
  • Like 1
Link to comment
Share on other sites

11 hours ago, Natetronn said:

When I'm home, I'd like to use a local IP address. When I'm on the go, I'd like to use my domain that is setup with cloudflared

Hi.  As Dark pointed out above, Emby already does this automatically.

Link to comment
Share on other sites

Natetronn
Posted (edited)

Thanks everyone!

I was never able to get the Emby's Remote WAN ip:port to work and why I was using cloudflared instead.

I tried Port Forwarding and UPnP as well, per the instructions here: https://github.com/EmbySupport/Emby.Docs/blob/master/Remote-Setup.md - including updating the setting under Network and doing restarts etc.

The traceroute 8.8.8.8 test seems to be fine (no 16-31 on the IPs after my router), however, from all I can gather, my ISP has everything closed off, aside from port 80.

Changing the Local IP and port to my host Under Network settings worked fine (since I'm using Docker.)

Since I don't have access to the Emby Remote port, can I assume the domain I'm using with cloudflared won't switch like normal when remote or local?

Edited by Natetronn
Link to comment
Share on other sites

  • Solution
darkassassin07

That's fine, as long as you have external access setup via some working method.

All you've gotta do is set under network settings: 

External Domain: <your domain>

Public https port: <the port you're using externally> (probably 443)

This simply tells emby what it should tell the clients. Ie; what your external route is.

 

 

Within those settings; there are 'local' http(s) ports, and 'public' http(s) ports.

The local ports are what the actual application 'emby server' is listening to on the host machine (well docker container in this case).

The public ports are what the server tells the clients to connect with, as that may differ from direct LAN access via proxies, port forwarding rules, container mapping, etc.

  • Like 1
Link to comment
Share on other sites

Natetronn
Posted (edited)

Okay, great, thanks!

I set that up and it seems to be working fine with emby.mydomain.com and ports 80 and 443* for public (remote) and then the local host IP address (to skirt Docker) and set with the original local ports (8096/8920; but 8096 is used), in the Network area dashboard.

So, just to be sure I do understand, if may:

For the client app (e.g. Android app on my cell phone) I would just set the Emby Server in the UI to use the remote route and it will somehow switch routes depending on my current address? So when I'm on my local WiFi it will know it's using my local network and when I'm on the go using my cell Data, it knows to use the remote domain? Is that correct?

*I setup up https on Cloudflare for the domain and auto redirect to https as well from within Cloudflare's control panel and it's working.

 

Edited by Natetronn
Link to comment
Share on other sites

darkassassin07

That all sounds right to me.

 

Yes. The apps prioritize using the local address; if connecting to that fails they will then use the remote address.

 

 

One note: For the local connection to work, you must map 8096 on the host to 8096 on the docker container. The clients will only be told the container port for local connections as the server doesn't know any better. (and you can't change this behaviour)

Link to comment
Share on other sites

Natetronn

Thanks @darkassassin07!

I'm now able to see it switch between the remote address and the local one. On Android, if I click my avatar > Change Server I see my local IP address while connected over WiFi. If I turn off the WiFi on my phone, and go to Change Server, I now see it shows up with my remote address/route (domain).

This is very cool 😃 Thanks again everyone!

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...