Project

General

Profile

Port forwarding support

Added by Daniel Morgan about 1 year ago

Hi, I've done some research on this forum and externally, I've got TVH all up and running locally, I now want to access the live channels and recordings externally.

From my research I know TVH needs to be port forward from my router or via a VPN.

I've attempted to add a port forwarding rule on my router under virtual server. With TVH up address and using the internal and external ports to 9981.

However after this and trying to access the channels via Kodi which is my frontend client it won't load the channel list.

What could I be doing wrong and how can it be done through a VPN as I use express VPN.

I've attached a screenshot of the options from my router for port forwarding.

Many thanks


Replies (17)

RE: Port forwarding support - Added by Adrian Smith about 1 year ago

Port 9981 is for the web interface. You would need to forward port 9982 as well since Kodi uses HTSP I believe. Protocol for both should be TCP.

RE: Port forwarding support - Added by Daniel Morgan about 1 year ago

Thanks tried that but no joy. I've set two separate rules for ports 9981 and 9982 and same IP addresses with TCP option.

Is there anything that needs to be set in TVH itself for it to work?

Thanks

RE: Port forwarding support - Added by Hiro Protagonist about 1 year ago

TVH doesn't care where the connection is coming from.

Can you access the web UI via port 9981 from your external network?

RE: Port forwarding support - Added by Adrian Smith about 1 year ago

Hiro Protagonist wrote:

TVH doesn't care where the connection is coming from.

Can you access the web UI via port 9981 from your external network?

What about the "Allowed Networks" setting for each user in "Configuration/Users/Access Entries"? Or does TVH not respect this setting?

RE: Port forwarding support - Added by Adrian Smith about 1 year ago

What device is TVH running on? Does that device have a firewall installed? If so, does the firewall have rule(s) to allow remote (non-local subnet) inbound connections on the relevant ports?

RE: Port forwarding support - Added by Daniel Morgan about 1 year ago

Hi to answer both your questions, when trying to access ip address of TVH:9981 externally, nothing loads.

I've created a NAT portforwading rule in my router for TVH up address for 9981 and a separate one for 9982, both TCP, no joy

The device in an ex windows 10 elite book miniature pc which has been fully wiped and running just Ubuntu 20 via ethernet through a power line adapter to my router

Internally Kodi picks it up straight away, streams, records no problem but as soon as I'm off my network I can't access externally.

I want to be able to view the love channels externally via Kodi on my phone.

Thanks

RE: Port forwarding support - Added by Adrian Smith about 1 year ago

Daniel Morgan wrote:

Hi to answer both your questions, when trying to access ip address of TVH:9981 externally, nothing loads.

I've created a NAT portforwading rule in my router for TVH up address for 9981 and a separate one for 9982, both TCP, no joy

The device in an ex windows 10 elite book miniature pc which has been fully wiped and running just Ubuntu 20 via ethernet through a power line adapter to my router

Internally Kodi picks it up straight away, streams, records no problem but as soon as I'm off my network I can't access externally.

I want to be able to view the love channels externally via Kodi on my phone.

Thanks

Just to be clear, you ARE using your external, public IP address to access TVH when you're not on your local network aren't you? The IP address you use when you're on your local network at home won't work externally. When you're at home and connected to the same network as TVH, use a site like https://whatismyipaddress.com/ to find your external IP address. This is the address you must use to connect to TVH when you're not connected to your local network.

You should be aware though that your external address can change from time to time (unless you have purchased a static public IP address from your ISP). Depending on how often (and for how long) you are away from home, you ultimately might be better off using Dynamic DNS - but that's probably something to worry about as a "phase 2" in the process.

RE: Port forwarding support - Added by Daniel Morgan about 1 year ago

Ahh.....ok that's were I am going wrong. I'm using my internal IP.

So if I set a forwarding rule for my external IP address at port 9981 and 9982 then it should connect?

Apparently that's not as safe so how would I do it via VPN? As I have a premium membership with express VPN

Ahh I would use it quite often and I haven't purchased a static public IP. So dynamic DNS may be best

RE: Port forwarding support - Added by Adrian Smith about 1 year ago

Daniel Morgan wrote:

So if I set a forwarding rule for my external IP address at port 9981 and 9982 then it should connect?

Not quite. Per the screenshot of your router port forwarding configuration in the original post the "Internal IP" is the address of the TVH box on your LOCAL/INTERNAL network. "Internal Port" will be 9981 (and also 9982). "Protocol" is TCP.

As for the "External Port" you can use different port numbers if you want - this may help to obscure the services you're hosting from anyone port scanning your external IP address. The maximum TCP port number is 65,535. So you could, for example, use external ports 49981 and 49982 mapped to internal ports 9981 and 9982 respectively. Assuming you did that, to access the TVH web interface when you're not on your local network you'd browse to "http://<Your EXTERNAL IP address>:49981".

As to how "safe" (or not) this is, I'll just say that it's not something that I would personally do. You would need to make your own risk assessment and take a decision.

I'll respond re. VPNs separately.

RE: Port forwarding support - Added by Adrian Smith about 1 year ago

Daniel Morgan wrote:

Apparently that's not as safe so how would I do it via VPN? As I have a premium membership with express VPN

I don't think that Express VPN will help you here. I could well be wrong, but as with most VPN services, the Express VPN Client/App is designed to connect a device to an Express VPN server in a specific country and therefore for that connected device to appear to be in that country. All it's doing is securely routing traffic from your device to one of their servers and then out onto the Internet from the geographic location of the Express VPN server you're connected to. It doesn't help you get back into your home network. And even if you connected both your TVH server and a client device to an Express VPN server somewhere, I doubt you could route traffic between them.

IMHO, the VPN solution that is most appropriate here is to host a VPN service yourself on your local network and to securely expose that to the Internet. Pi VPN (https://www.pivpn.io/) is one such option. You'd then use a client like OpenVPN on your devices to connect back into your local network. This is relatively advanced stuff though and, in the nicest possible way, from the discussion so far, I'm sensing that you're not super familiar with networking etc. That's not an issue in itself (everybody has to learn things for the first time at some point) but, in my opinion, there's just as much risk in setting up and configuring your own VPN without fully understanding what you're doing as there is in the simpler port forwarding solution.

If you want to go this route, and you choose to use Pi VPN, I'd be happy to give you some pointers and some gotchas from my own experiences but do give it some thought first.

RE: Port forwarding support - Added by Daniel Morgan about 1 year ago

That's brilliant thank you soo much!! Really well explained and appreciate you going into detail!!

The only questions I have from that is I'm assuming I choose and set my own port number for external TVH. However I would assume whichever number I use I will have to assign that within the web interface somewhere? So that the network knows what device I'm wanting to connect too?

If so how is this done?

Secondly would one port number be for external access to the web interface and a different port number be for external access to be used with a front end like Kodi on my mobile phone, so that the channel guide all shows up?

Many thanks

RE: Port forwarding support - Added by Adrian Smith about 1 year ago

Daniel Morgan wrote:

That's brilliant thank you soo much!! Really well explained and appreciate you going into detail!!

You're welcome.

Daniel Morgan wrote:

The only questions I have from that is I'm assuming I choose and set my own port number for external TVH. However I would assume whichever number I use I will have to assign that within the web interface somewhere? So that the network knows what device I'm wanting to connect too?

If so how is this done?

Secondly would one port number be for external access to the web interface and a different port number be for external access to be used with a front end like Kodi on my mobile phone, so that the channel guide all shows up?

No. No changes are needed to the TVH configuration.

Internal (Local Network) Access
Everything works as it does now. Ports 9981 (web interface) and 9982 (HTSP) are used.

External Access
Let's assume that your TVH server has a local network address of 192.168.1.10.

Configure two port forwarding rules on your router as follows:

Rule1:
External Port: 49981
Internal IP: 192.168.1.10
Internal Port: 9981
Protocol: TCP

Rule2:
External Port: 49982
Internal IP: 192.168.1.10
Internal Port: 9982
Protocol: TCP

What this is doing is telling your router to forward everything received externally (from the Internet) on port 49981 to the local (internal) address of TVH on port 9981. The router is doing the port mapping/translation for you. As far as TVH is concerned, the traffic is received on the normal 9981 port. The same applies for port 49982 being forwarded to port 9982.

To access the web interface from the Internet you'd browse to:

"http://<Your EXTERNAL IP address>:49981"

For Kodi access when you're not on your local network you'd need to reconfigure the TVH PVR Client in Kodi.

In Kodi, go to "Settings/Add-ons/My add-ons/PVR clients/Tvheadend HTSP Client". Once there click on "Configure". You should be at a page similar to the attached screenshot. Change the "Tvheadend hostname or IP address" to your EXTERNAL address and the HTTP/HTSP ports to 49981 and 49982 respectively. After doing this you should be good to go.

One last thing ... I believe that by default, the TVH Kodi PVR Client will use the "admin" user. It's worth double checking the TVH configuration for this user under "Configuration/Users/Access Entries" in the TVH web interface. IIRC, the default value for "allowed networks" is "0.0.0.0/0" which would be fine. If you have anything else for this setting, change it to "0.0.0.0/0".

RE: Port forwarding support - Added by Daniel Morgan about 1 year ago

That's done it!! Honestly thank you soo soo much! This information is documented anywhere for new users to TVH

I've followed this to the letter, but I did a random external port for the web interface and the front end.

Work perfectly when on the local network and on 4g or external networks!

Many Thanks again for going into so much detail, but detail that is easy to follow for new members!

RE: Port forwarding support - Added by Adrian Smith about 1 year ago

Daniel Morgan wrote:

That's done it!! Honestly thank you soo soo much!

No problem. Glad you got it working.

RE: Port forwarding support - Added by Daniel Morgan about 1 year ago

how do I highlight the solved answer for others?

RE: Port forwarding support - Added by Daniel Morgan about 1 year ago

Last question I would like to ask here, if possible is when I record any problem HD or SD the recordings are at 664x668.

I can't find anywhere to set it as 1920x1080 for all recordings.

Could you help with this?

Many thanks

RE: Port forwarding support - Added by Adrian Smith about 1 year ago

This is an entirely new question for which I would suggest you start a new thread.

However, I can’t think of anything off the top of my head and am now away for a few weeks. Hopefully someone else will be able to assist.

    (1-17/17)