Interactive television with OpenWrt (Telenet Digicorder or Proximus decoder behind your own router)
use a VLAN to link the WAN port with the LAN port the set-top box is attached to.
My tv set-top box (Telenet Digicorder in Belgium) needs an external IP address. Without it, you’re missing certain functions, such as browsing the program guide further than two days, or planning recordings over the web. The Digicorder only gets an external IP address when it’s connected to the modem/router my ISP (Telenet) installs.
If you use your own router with DHCP enabled, you run into troubles. Everywhere on Belgian forums you will find that I should buy Powerline adapters to keep a direct line between the Digicorder and the Telenet router. Or I should drop the (silly) idea to have my own router… But where’s the fun in that?
My home network
For personal reasons (guest wifi, VPN, etc.), I like having my own router connected to the Telenet router, with DHCP enabled for a different subnet. The router I use is a Linksys WRT1900AC with OpenWrt. In my apartment, the Telenet modem/router is installed in a storage room. My NAS (a noisy old pc) is also located there. That’s why I installed the WRT1900AC there as well. The WRT1900AC WAN port is connected to a port on the Telenet router. One of the LAN ports is connected to the NAS, another to a cable in the wall that arrives behind the television. At the television location, there are several devices that need LAN and/or WAN connectivity: the A/V receiver (LAN), Playstation 4 (LAN), Raspberry Pi with OpenElec (LAN) and then the Digicorder (LAN+WAN!). I use a TP-Link TL-WR1043nd (v1) as a switch to distribute internet at the television location.
I admit that my setup is more complex than the average Telenet customer’s setup, so first I will explain how to have the Digicorder behind just one router (other than the one provided by Telenet), then with the extra switch.
How NOT to do it
Telenet doesn’t use IPTV, so my initial attempts to use igmpproxy with OpenWrt were a waste of time. I also don’t want to use Powerlink or pull extra wires through the wall, that would be the easy way out.
Digicorder behind one router
Let’s just start with what most people would do: installing a personal router behind the Telenet router and attach the Digicorder.
You need to create a VLAN (Virtual LAN) to link the port the Digicorder is attached to with the WAN port. How your current switch setup looks, depends on the router/switch you have. In the WRT1900AC, there are already two VLANs. If you’re not sure about the port numbers, look up your router in the OpenWrt wiki.
These are the ports for the WRT1900AC, taken from the WRT1900AC OpenWrt wiki at the time of writing:
The standard switch setup is this:
Which looks like this in /etc/config/network:
config switch_vlan option device 'switch0' option vlan '1' option vid '1' option ports '0 1 2 3 5' config switch_vlan option device 'switch0' option vlan '2' option vid '2' option ports '4 6'
The cable towards the Digicorder is attached to port 3, so we remove it from VLAN 1 and add it to VLAN 2:
config switch_vlan option device 'switch0' option vlan '1' option vid '1' option ports '0 1 2 5' config switch_vlan option device 'switch0' option vlan '2' option vid '2' option ports '3 4 6'
No further customization is required! Tagging isn’t needed because each port belongs to just one VLAN. The firewall rules are still fine. Port 3 belongs to the WAN zone now.
Digicorder behind a router and a switch
Now let’s add an OpenWrt switch to provide internet to the other devices at the Digicorder’s location.
On the WRT1900AC, port 3 (cable going to the TL-WR1043nd) will be used for both LAN and WAN traffic, so the port will be added to both VLANs and tagging needs to be enabled:
/etc/config/network on the WRT1900AC:
config switch_vlan option device 'switch0' option vlan '1' option vid '1' option ports '0 1 2 3t 5' config switch_vlan option device 'switch0' option vlan '2' option vid '2' option ports '3t 4 6'
The TL-WR1043nd will be used as a switch, so the DHCP server is disabled. I also won’t need the WAN port anymore, so port 0 will be added to VLAN 1. Port 1 is used for the Digicorder. Port 0 is the cable from the WRT1900AC and it needs to be tagged (because it is tagged when it leaves the WRT1900AC on port 3).
/etc/config/network on the TL-WR1043nd:
config switch_vlan option device 'switch0' option vlan '1' option ports '0t 2 3 4 5t' config switch_vlan option device 'switch0' option vlan '2' option ports '0t 1 5t'
So the Digicorder is in a separate VLAN with the cable coming from the WRT1900AC.
I removed the WAN interface and added a second LAN interface. LAN is attached to eth0.1 (VLAN 1) and LAN2 to eth0.2 (VLAN 2). Notice that I removed the wifi network, but feel free to leave it. Both interfaces are configured to be DHCP clients. LAN will get its IP from the WRT1900AC and LAN2 will get it from the Telenet router.
Both LAN and LAN2 are in the same firewall zone. The WAN firewall zone is still there but is unused.
At this point the Digicorder gets an IP address from the Telenet router and an external IP! The only thing left to do is to enable masquerading in the WRT1900AC for the LAN zone. Only then you are able to login into the TL-WR1043nd for configuration:
This works exactly the same with a Proximus decoder. Don’t be fooled (like I was) by the fact that IPTV works via VLAN 30. That’s only from the Bbox towards Proximus. I used VLAN 2 just fine.
I changed the local IP subnet for the Bbox to 192.168.0.x. My own router still works with 192.168.1.x. The decoder will get an IP address from the Bbox (e.g. 192.168.0.64) after setting up as described above. The only difference is that on the WRT1900ac, the WAN interface (on eth1) now connects to Proximus via PPPoE instead of being a DHCP client when used for Telenet.