IPTV router

On my IPTV Recording page, I have put some information about connecting a linux htpc directly to the fiber modem to watch and record IPTV. Another solution that I already had in my mind for the last months is to use a small linux router, which can share the iptv link to the original Amino STB *and* a linux htpc. When I was thinking about this in the last months, I figures that in this setup it would even be possible to use a windows based htpc, because you don’t need to spoof the dhcp request on the windows host anymore. So on this page I’ve put some information together how to setup such a linux router. See also my blog article about the maximum amount of streams.

Software and Hardware
I’m using the the dd-wrt distribution for this. For the hardware I first tried the PC Engines WRAP board. I still had one of these laying around. Although dd-wrt does not officially support the WRAP, It did boot and everything worked, but when viewing 3 iptv streams at once, all streams were stuttering. The load of the linux router went up to 5 or 6, so it clearly couldn’t handle this amount of traffic with it’s 260MHz CPU. Then i switches over to the successor of the WRAP: The PC Engines ALIX board. Specifically the alix2d3. I also had one of these laying around. This with it’s 500MHz CPU it has more power to handle the mbit’s of data we’re going to send through.

Brand Type Working Load Comments
PC Engines wrap1e203 Partly 10%@1 HD stream Can not handle more than 2 streams
PC Engines alix2d3 yes 1%@1 HD stream, 19%@5 HD streams No load problems

I assume any other router that’s fully supported by dd-wrt will also work, as long as the CPU is strong enough to handle all the iptv streams you’re going to use. If you tried this setup with an other dd-wrt supported router, please tell me and I will add your information here as well.

Installing dd-wrt
For the Alix, installing dd-wrt is quite simple. You go to the dd-wrt router database. Search for Alix. There should only be one result. Click on the resultset. At this writing it recommended me version v24 PreSP2 [Beta] Build 13064. I downloaded the DD-WRT X86 Public Serial: Console image. After downloading the image can be copied with dd (under linux) directly to a compactflash card. You must use a compactflash card with a minimum size of 32MByte.

Place the compactflashcard into the alix. I also attached a null-modem cable to the serialport of the Alix so I can monitor the boot progress (serial settings 15200n8). Then I gave the Alix some power and watch it boot on the serial console. After booting, I attached my notebook with a network cable to the second network port eth1 (the one in the middle). We are going to use the eth0 as WAN connection to the iptv network. My notebook received a 192.168.1.x address through DHCP from the linux router.

Configuring dd-wrt
All configuration options we need to do, can be done in the webgui of dd-wrt. Open http://192.168.1.1 in the browser of your notebook to open the dd-wrt webgui. At first dd-wrt will ask you to enter a new loginname and password to secure the dd-wrt admin environment. Please change this to something you can also remember, or write this information down somewhere. When you are in the admin environment follow the next steps to configure the dd-wrt router to use it as a iptv router.

Click on gray tab Setup (below the dd-wrt logo). In the WAN Connection Type box, change the Connection Type to Automatic Configuration – DHCP. Click on the Apply Settings button below on the page.

Wait until the page is done refreshing, and click on the blue tab MAC Address Clone. Enable the MAC Clone and change the Clone WAN MAC to the MAC address of your Amino STB. It is printed on top on a sticker of your SetTopBox and it will probably start with 000202. Click on the Apply Settings button below on the page.

When the dd-wrt router is done applying these new settings, click on the blue tab Networking. Half way on the page there is a Port Setup box. Make sure that the WAN Port Assignment is set to eth0. If you have not applied the settings from the previous pages, you will probably see a config setting Network Configuration eth0. If this is true, change this setting for eth0 from Default to Unbridged. To be safe, click on the Apply Settings button below on the page.

When the dd-wrt router is ready, click on the gray tab Services. In the DHCP Client box, enter the value Aminoaminet130fisys in the box behind Set Vendorclass. This will make sure that the dhcp server of the IPTV network will see the DHCP request as if it was an Amino device, and return a correct IP-address. A bit lower on the page you will see the DNSMasq box. In this box enter the following value in the memo field below Additional DNSMasq Options:

dhcp-option=43,08:10:68:74:74:70:3a:2f:2f:77:2e:7a:74:36:2e:6e:6c:2f:10:10:45:75:72:6f:70:65:2f:41:6d:73:74:65:72:64:61:6d

This configuration setting will send back the dhcp option 43 (Vendor Encapsulated Information) inside the DHCP Offer from the dd-wrt router to the Amino STB. The hex-values hold the following information:

http://w.zt6.nl/

Europe/Amsterdam

This information is used by the Amino STB. The first line is the url opened by the STB, which should be a webpage including the menu of the STB. This menu holds links to the iptv streams. Click on the Apply Settings button below on the page.

After the page is done reloading, click on the gray tab Security. On this page you will see the box named Block WAN Requests. Uncheck the checkbox in front of Filter Multicast. This setting will now allow multicast traphic to flow from the WAN side (IPTV network) to the STB. The linux router will use an igmp proxy for this. Click on the Apply Settings button below on the page.

Testing connectivity
After changing all the settings mentioned above, it maybe wise to reboot the router. Go the the gray tab Services and click in the button Reboot Router on the bottom of the page. Then connect a networkcable from the fiber modem directly into the first networkport (eth0) of the linux router. For the Alix, this is the network port on the right side (next to the usb ports), when looking at the back of the router. After the router is rebooted, your iptv router should be ready to use.

First check on the web interface of the dd-wrt router if it has a successful connection to the IPTV network. Click on the gray tab Status, then click on the blue tab WAN. It should look something like this (at least when you use the IPTV service of fiber Internet provider XMS):

Connection Type:Automatic Configuration - DHCP IP Address: 10.252.16x.xxx Subnet Mask: 255.255.252.0 Gateway: 10.252.160.1 DNS 1: 82.139.121.131 DNS 2: 82.139.121.194

When this looks correct, then attach the STB to the thirth networkport eth2 (the networkport on the left side, looking from the back of the Alix). Apply some power to the STB after you connected it to the IPTV router and your tv. Then the STB should start (give it a minute or 2) and you can watch TV on the STB.

Remarks in usage
Because the STB is now connected through a linux router and not directly the firmware upgrade will not work. During the firmware upgrade the STB is doing a DHCP request with a different vendor class. This difference DHCP vendor class will return a slightly difference vendor encapsulated options back in the DHCP Offer. This time it will not hold a webpage with a menu for the STB, but a multicast address, which is be used by the STB to download the new firmware. Because the DHCP request to the IPTV network in the setup bescribed above is not done by the STB but by the router, and we have set the vendorclass on the router to Aminoaminet130fisys, this firmware upgrade will not work. If you really need an firmware upgrade, then connect the STB directly to the fiber modem, do the firmare upgrade, and then reattach it to the dd-wrt router.

The extra services like ‘Uitzending gemist’ also don’t work. I’m not sure (yet) why they don’t work, so I’ll try to figure that out some time and see if I can fix this.

Connecting a Linux htpc
When you have the IPTV with the STB running, you can attach a linux htpc, and use the STB and linux htpc at the same time. This gives you the opportunity to place the htpc in the living room, and use the STB in the bedroom, and be able to watch all your digital tv channels on both places without any conflicts. Because the dd-wrt router takes care of the most important parts of connecting to the IPTV network, the setup on a pc is easy.

A htpc must also keep it’s connection with the real internet, so my setup on my htpc involves two network cards. The first networkcard (eth0) is connected to a switch in my private network. This private network is using a 10.84.100.x/24 ip range and a dhcp server is running on a Asus router. This asus router is connected to the internet port of the fiber modem. The eth0 of the htpc is setup to use dhcp. The second networkcard (eth1) is setup with an static ip-address 192.168.1.2/24 and connected to the dd-wrt router. Make sure you don’t use any MAC address spoofing (as I showed on my IPTV Recording page), because this will give MAC conflicts between your linux htpc and your STB.

You need some extra static routes to send the traffic for the IPTV network to your dd-wrt router instead of your default gateway (internet router). For the IPTV service of fiber Internet provider XMS you need the following static routes:

Network Destination
10.252.160.0/22 gw 192.168.1.1
82.139.121.0/24 gw 192.168.1.1
224.0.0.0/4 dev eth1

Because the Linux htpc is using the DNS servers from my internet router, it will not be able to resolve any hostnames used on the IPTV. For this I’ve added some hostnames to the /etc/hosts file:

82.139.121.132        w.zt6.nl

After this, you can setup mythtv to use the iptv recorder, based on a m3u file. and you should be able to record up to 5 IPTV streams. Please take care. These maximum of 5 iptv streams are some kind of maximum from the IPTV network. When you are watching one stream on the STB, you can only watch or record a maxmimum of 4 streams on your htpc.

Connecting a Windows htpc
The first step is: Stop using windows, and install Linux on your htpc… (just kidding 🙂

Connecting a windows htpc directly with the IPTV network is a lot more difficult then connecting a linux htpc. The bigest issue is that the DHCP request must have a specific Amino Vendor class. This can’t be done in Windows, because this Vendor class is hardcoded into a dll file. With the dd-wrt setup I described above, you don’t have this problem anymore, which makes it possible to Windows as a htpc. I’m not using a windows htpc, but I can give some information here for the ones who do have a windows htpc.

When you are using the same setup as with my linux htpc, then make sure you have two network cards in your htpc. Connect the first one to your private network, which has a router to internet, and connect the second one to the dd-wrt router. Set the first networkcard to use DHCP to get an ip-address from your internet router and setup the second networkcard with a static ip-address. You could use the ip-address 192.168.1.2 with netmask 255.255.255.0. If you need to setup more htpc systems, use an ip-address between 192.168.1.3 and 192.168.1.99. This is because the dd-wrt router is using 192.168.1.100 til 192.168.1.150 for DHCP clients.

Setup the following static routes on the second networkcard:

Network Netmask Gateway
10.252.160.0 255.255.252.0 192.168.1.1
82.139.121.0 255.255.255.0 192.168.1.1
224.0.0.0 240.0.0.0 192.168.1.1

Then add the following lines to the file c:windowssystem32driversetchosts

82.139.121.132        w.zt6.nl

This should all be enough to be able to watch iptv streams on your windows htpc. If you have any questions, remarks, success or failure stories, please comment below!

Post to Twitter