INTERACT FORUM

Please login or register.

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

Author Topic: Why isn't Media Network working on port 80?  (Read 3046 times)

Mastiff

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1977
  • The Multi-Zone Tzar
Why isn't Media Network working on port 80?
« on: December 02, 2016, 05:19:37 pm »

I have set up my Pi as an access point, like this article explains (technically it's a router, I believe, but never mind):

https://frillip.com/using-your-raspberry-pi-3-as-a-wifi-access-point-with-hostapd/

This is for use in my Volvo XC60, for music playback, with a 2 TB hard drive with a bit over 160K tracks. It all started because I was annoyed the Volvo couldn't take my full library on it's USB system, and now I have Media Center running on it. I can then connect to the AP with my Android phone and control the music from the J.Remote app, and the built-in original dashboard display of the Volvo will show the cover and track info for what I'm playing. This works on port 8080, but I want to use exactly the same setup as I have at home, where I run MC Windows version on a Windows Server 2008 R2 (old OS, yeah, but I don't like Windows Server 2012 - I want the interface I'm used to). So I need the port to be 80, and that just doesn't work. The app won't connect and I get "ERR_CONNECTION_REFUSED" in Chromium.

Mind you this is a regular MC 22 for Linux system (not DLNA renderer, full library setup), set up from the great Pi tutorial here on the board, and with a lot of help from mwillems getting MC to autostart and a few other things.

When I run sudo netstat -tlnpu while using port 80, nothing comes up in the readout (so there's nothing else using that port), but when I run it while using port 8080 it shows mediacente22 LISTENING. Is this a bug, that MC for Linux can't run Media Network on port 80? Or is there something else going on here?
Logged
Tor with the Cinema Inferno & Multi-Zone Audio system

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5174
  • "Linux Merit Badge" Recipient
Re: Why isn't Media Network working on port 80?
« Reply #1 on: December 02, 2016, 05:26:58 pm »

Can you post the output of iptables -L?  What happens if you try to connect to the pi using a webbrowser using http://pi.ip.address.here
Logged

Mastiff

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1977
  • The Multi-Zone Tzar
Re: Why isn't Media Network working on port 80?
« Reply #2 on: December 02, 2016, 05:42:04 pm »

Hi! Thanks for being back to the rescue!  ;D

Code: [Select]
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere           

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

And the same thing happens with a browser, no contact on port 80, working on 8080 (hence the "ERR_CONNECTION_REFUSED" in Chromium that I mentioned in the first post). I am using dnsmasq and hostapd if that matters.
Logged
Tor with the Cinema Inferno & Multi-Zone Audio system

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10712
Re: Why isn't Media Network working on port 80?
« Reply #3 on: December 02, 2016, 05:45:44 pm »

All ports below 1024 are "privileged" ports on Linux, which means they require special access to run a server on.

This means you require one of two things:
- run as root, *NOT recommended*
- set a special capability on the MC executable if your system supports it (ie. kernel is new enough)

The basic command is this:
Code: [Select]
setcap 'cap_net_bind_service=+ep' /usr/bin/mediacenter22 (is that the right path to the mc binary? fix as needed)

Note, the command needs to be run as root, or with sudo.

I have not actually tested this with MC however. Extended capabilities have some extra limitations that may or may not break things. And you may need to reset it whenever MC is updated.
If this doesn't work, another option would be to use iptables to route port 80 traffic to another port which MC actually runs on.
Logged
~ nevcairiel
~ Author of LAV Filters

Mastiff

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1977
  • The Multi-Zone Tzar
Re: Why isn't Media Network working on port 80?
« Reply #4 on: December 02, 2016, 05:55:24 pm »

Thanks, Hendrik! That was the right path, and it worked. :)
Logged
Tor with the Cinema Inferno & Multi-Zone Audio system
Pages: [1]   Go Up