Especially those who want to follow sporting events such as the 2018 Football World Cup on their mobile phones can do so conveniently with the help of a Raspberry Pi with tvheadend and VPN via PPTPD.
Everything you need for this setup is already there when you tvheadend on a Raspberry Pi with DVB-C ...is beginning. If this is not the case, you should first follow the above instructions so that the television reception itself will work. Once this has been done, the next step is to set up the PPTPD server.
For the impatient: at the end of this article you will find a Raspberry Pi, which serves as both tvheadend and PPTPD VPN server, allowing TV streaming of any program to your smartphone. Practical especially for sports events such as Formula 1 or the soccer world championship - and of course highlights such as the final between Germany and Argentina. And this is how the whole thing is then operated:
The following parts are needed to implement this manual (or generally for live television with the Raspberry Pi and tvheadend):
- RaspberryPi rev.B (35,- Euro at Amazon)
- Case for RaspberryPi (5,50 Euro at Amazon)
- 12 Watt USB power supply from Apple, as they work well (11,99 Euro at Amazon)
- Sundtek Media Pro III USB TV Stick (DVB-C, DVB-T, Analog, 89.90 Euro)
Once the Raspberry Pi is set up and streams the TV program to the home network, you can move on to the next step, the setup of the PPTPD VPN server.
Setting up the PPTPD server
One might now object that it would be safer to use OpenVPN. But this is much more complicated to set up and requires additional apps. In principle, you can also implement this guide with OpenVPN, but I will introduce the PPTPD variant here. Users of a Fritz!Box can also skip the following steps, they can directly use the VPN functionality of the Fritzbox. All others can continue reading:
I use Archlinux on my Raspberry Pi, but the configuration can also be transferred to Raspbian (the content of the .conf files remains the same).
1. install packages
~# pacman -Syu ~# pacman -S pptpd
2. edit /etc/pptpd.conf
This file is used to configure the advanced pptpd-options file as well as the IP address range of the PPTPD server and the PPTPD clients. In this case the VPN client will get an IP between 192.168.0.100 and .150. Since this is in the same IP address range as the tvheadend server, access from it is possible without any problems.
option /etc/ppp/pptpd-options localip 192.168.0.73 # IP of the Raspberry Pi remoteip 192.168.0.100-150 # IP range of the clients
3. edit /etc/ppp/pptpd-options
name pptpd refuse-pap refuse-chap refuse-schap require-mschap-v2 require-mppe-128 proxyarp lock nobsdcomp novj novjccomp nologfd ms-dns 188.8.131.52 ms-dns 184.108.40.206
4. create user in /etc/ppp/chap-secrets
Several users can be created in the chap-secrets file, each with login and password. One user per line is entered, this data will be used later for the login.
pptpd * pptpd
5. enable IP forwarding in /etc/sysctl.d/99-sysctl.conf
The following line must be added to the sysctl.conf file so that network access and Internet access also works with VPN connection.
~# sysctl --system reload the system files so that all changes are applied. Last but not least, the iptables firewall needs to be adjusted to allow access for PPTPD clients:
iptables -A INPUT -i ppp+ -j ACCEPT iptables -A OUTPUT -o ppp+ -j ACCEPT iptables -A INPUT -p tcp --dport 1723 -j ACCEPT iptables -A INPUT -p 47 -j ACCEPT iptables -A OUTPUT -p 47 -j ACCEPT iptables -F FORWARD iptables -A FORWARD -j ACCEPT iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE iptables -A POSTROUTING -t nat -o ppp+ -j MASQUERADE
Start PPTPD server and test login
Once everything is set up, the PPTPD server must be started and anchored in the system start scripts so that the VPN server on the Raspberry Pi is automatically loaded at each system start.
~# systemctl start pptpd.service ~# systemctl enable pptpd.service
If the setup was successful (for external access a DynDNS service should be used and the TCP port 1723 must be forwarded on the router to the IP of the Raspberry Pi ) you can connect via VPN and then have access to the local network as if you were on site. This allows for various application scenarios; the World Cup is to be about streaming. All that is needed now is the right apps on the smartphone or tablet.
tvheadend streaming on Android
With a connected VPN, you can use the app just as you would in your home network - so you can also stream the DVB-C signal to the nearest beer garden or office: no more missing a game! Even on 7.2 Mbps limited LTE from Congstar is enough to transmit the television picture. The pleasure is only limited by the available data volume, so you should use a WLAN if possible.