INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Media Center Server Deployment && SSH Tunnel Proxy  (Read 7835 times)

4n0n

  • Recent member
  • *
  • Posts: 9
Media Center Server Deployment && SSH Tunnel Proxy
« on: November 09, 2016, 11:46:54 am »

Hello,
I am new to the forum and I tried to find answers to my questions through the forum search but I was only able to find information on old versions or no answer at all.
I am planning to run MC22 on a Linux host in headless operation. So as far as I could find out setting up the MC22 still requires an installation of X. Is that correct? Is there no other way to configure MC22 through a config file and start it headless? I did read of the "/medieserver" command but as far as I can tell setting it up still requires some form of UI.

Due to some networking limitations I need to tunnel my connection through SSH in order to get into the network. So my system involves 3 machines.
* One machine running MC22 that has access to the media files.
* One proxy machine that just tunnels through SSH and makes the default MC22 media server port accessible.
* One or more clients that connect through the proxy.

Does anyone have experience with a setup like that? The connection bandwidth of the proxy should be around 100Mbit/s and for the server itself there should also be plenty of upload speed. Do you think that the SSH tunnel will have any performance impact that might make this solution not feasible?

I would greatly appreciate your help before I try to set everything up just to notice that it can not work in the first place.
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient
Re: Media Center Server Deployment && SSH Tunnel Proxy
« Reply #1 on: November 09, 2016, 01:24:13 pm »

I have experience doing something similar, but not identical.  To answer your questions in turn:

I am planning to run MC22 on a Linux host in headless operation. So as far as I could find out setting up the MC22 still requires an installation of X. Is that correct? Is there no other way to configure MC22 through a config file and start it headless? I did read of the "/medieserver" command but as far as I can tell setting it up still requires some form of UI.

MC requires a running xserver to start.  That xserver can be remote or local, but by far the easiest way to deal with it is to setup an extremely lightweight x window manager (like openbox) on the server.  Total ram and CPU use in that scenario is quite low (Mediacenter uses far more RAM than X11 on my server).

Quote
Due to some networking limitations I need to tunnel my connection through SSH in order to get into the network. So my system involves 3 machines.
* One machine running MC22 that has access to the media files.
* One proxy machine that just tunnels through SSH and makes the default MC22 media server port accessible.
* One or more clients that connect through the proxy.

Does anyone have experience with a setup like that? The connection bandwidth of the proxy should be around 100Mbit/s and for the server itself there should also be plenty of upload speed. Do you think that the SSH tunnel will have any performance impact that might make this solution not feasible?

The word "client" is equivocal here; assuming that you mean using a separate MediaCenter instance running locally on a client to connect to the server's MediaCenter instance using the JRiver library server interface tunneled through ssh, your proposed solution should work fine for audio and low bitrate video.  If you mean instead trying to use your client PC as an X11 client, X forwarding over SSH is very, very slow and you'd be better off using VNC in almost all cases.

That said, you'd probably get better results (lower CPU usage and higher throughput) with an actual VPN setup (which is how my own server is configured) rather than trying to create a pseudo-VPN with ssh.  You could also potentially cut out the third box (the proxy box) with a VPN setup.  But it sounds like you may not have full control over configuration.

Quote
I would greatly appreciate your help before I try to set everything up just to notice that it can not work in the first place.

As long as you can manage the traffic so that it arrives at the correct port on the server, it should work.  As I said, I use a VM running OpenVPN to access my server when I'm out of the house and it works great.  It's just a question of performance.
Logged

4n0n

  • Recent member
  • *
  • Posts: 9
Re: Media Center Server Deployment && SSH Tunnel Proxy
« Reply #2 on: May 16, 2017, 06:31:03 am »

I just wanted to post an update to my initial question. I did get a Raspberry Pi and set up everything. However I could not get it to start headless so I just use the Raspbian x-system to load the Media Center on boot. Additionally the Pi is creating a reverse SSH tunnel to another Server and exposes its server capabilities through there.
My findings so far:
Apart from quite some delay when I start the first song the setup is working flawlessly. As I don't have full control over the network in which the Pi is residing I had to use a method like SSH tunnels etc.
I guess the initial delay comes from the transcoding done by the media server. I actually don't like the fact that it does transcode and I guess that's a misconfiguration on my end. So if anyone else wants to run their Media Server from inside a protected network and the Mediacenter forwarding does not work - SSH tunnels are a working alternative.

One downside so far is that configuration in this mode (i don't want to turn on VNC) seems to be difficult as some of the configurations in the configuration-file are not well documented or not self explanatory.

Thank you for the help! I might consider a VPN solution in the future but so far I am happy with my SSH setup.

EDIT:
As this might be interesting to other people thats how I did it:
I installed autossh to reopen the tunnel in case it gets closed down somehow - I did this as it seems easier for me than to use a cron job.
Code: [Select]
sudo apt-get install autossh
Then I added the following lines to /etc/rc.local to get them executed on boot:
Code: [Select]
# SSH reverse tunnel setup
sudo -s
ifdown wlan0
ifup eth0
sleep 1
eval $(ssh-agent)
sleep 0.5
ssh-add /home/pi/.ssh/<name of your not password protected SSH key>
sleep 0.5
autossh -f -N -T -R 0.0.0.0:2223:localhost:22 <user>@<remoter server op>
autossh -f -N -T -R 0.0.0.0:2224:localhost:55555 <user>@<remoter server op>

exit 0

To run Mediacenter automatically with X i added the following line to ~/.config/lxsession/LXDE-pi/autostart
Code: [Select]
@mediacenter22
There are of course other ways to do it - especially with security in mind - but for a first setup to build from there it works.
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13871
Re: Media Center Server Deployment && SSH Tunnel Proxy
« Reply #3 on: May 16, 2017, 09:39:50 am »

It sounds like you are connecting the MC playback box to the server as a library server client.
In this case, transcoding is controlled by the client.
It's under Tools->Options->Media Network->Client Options.

Note that not all audio formats can be seeked on without conversion as a stream.
Transcoding is also useful in the case where you have limited bandwidth.

Logged

4n0n

  • Recent member
  • *
  • Posts: 9
Re: Media Center Server Deployment && SSH Tunnel Proxy
« Reply #4 on: May 18, 2017, 06:14:48 am »

Thank you very much, bob! That solved the initial delay and the transcoding. I misread the options and thought I had to change it in the server settings. Now that I set up everything on the client it works much quicker!

I am super satisfied with my setup and the more I use the Media Center the more happy I am that I did dare to buy it in the past.
Logged
Pages: [1]   Go Up