IPTV recording

Since a few months I have a fiber optic connection to my home, the so called Zeewolde op Glasvezel project. I bought one Amino Aminet130m settopbox (STB) from the service provider XMS. This are the steps I took to get the iptv running on my mythtv media pc. See also my IPTV Router page, where I describe the steps to take to setup a dd-wrt based router, so you can use your STB together with your windows or linux htpc.

Getting an ip-address on my linux machine

When connecting my mythtv media pc directly to the digital tv ethernet port of the Genexis modem, I would not get a ip-addres through DHCP. The settopbox is getting an ip-address without issues, so there must be something different. To see which data packets are send between the STB and the modem, I used an PC Engines Alix board. This is a small headless linux device. It has 3 ethernet ports and a compactflashcard socket. I’m using OpenWRT (x86, ext2 version), so I have a small linux device which I can use. I’m using all three ethernet ports. eth0 is connected to the STB. eth1 is connected to the second networkport (also eth1) of the mythtv media pc. And eth2 is connected to the Genexis modem on the digital TV port M2. In OpenWRT I’ve setup a bridge br-dtv with the devices eth0, eth1 and eth2. In sysctl I’ve setup proxyarp for all ethernet ports. Now the listening can begin!

When running wireshark on the mythtv media pc, listening on eth1, I could see the dhcp request from the STB to the fiber network. The DHCP request contains some extra information that is used on the DHCP servers of the supplier, so they know when to return an ip-address and when not. Before we can try a modified DHCP request from the mythtv media pc, I need to change the mac address of the eth1 of the mythtv media pc. I’m using fedora 12, so I could easily use the following configuration in /etc/sysconfig/network-scripts/ifcfg-eth1

# nVidia Corporation MCP55 Ethernet
DEVICE=eth1
BOOTPROTO=dhcp
HWADDR=00:1f:c6:xx:xx:xx
MACADDR=00:02:02:xx:xx:xx
ONBOOT=yes
NM_CONTROLLED=no
TYPE=Ethernet
IPV6INIT=no

I’ve changed the last 6 bytes of the original mac address of the networkcard and of the new mac address to xx. The HWADDR has the original mac address of eth1, MACADDR must be the same as the mac address of your aminet130m device.

If I look at the DHCP request from the STB, I see the following dhcp options in the request:

  • 53 DHCP Message Type = DHCP Discover
  • 57 Maximum DHCP Message Size = 548
  • 50 Requested IP Address = 10.252.x.x
  • 51 IP Address Lease Time = infinity
  • 55 Parameter Request List
    • 1 Subnet
    • 2 Time Offset
    • 3 Router
    • 6 Domain Name Server
    • 12 Host Name
    • 15 Domain Name
    • 17 Root Path
    • 23 Default IP Time-to-Live
    • 28 Broadcast Address
    • 29 Perform Mask Discovery
    • 31 Perform Router Discovery
    • 33 Static Route
    • 40 Network Information Service Domain
    • 41 Network Information Service Servers
    • 42 Network Time Protocol Servers
    • 43 Vendor-Specific Information
  • 43 Vendor-Specific Information = 03:09:61:6d:69:6e:65:74:31:33:30:04:05:66:69:73:79:73 (x03x09aminet130x04x05fisys)
  • 60 Vendor Class Identifier = Aminoaminet130fisys
  • 61 Client Identifier = 00:02:02:xx:xx:xx (max address of your aminet130m)

Next we have to alter the dhcp request from the linux pc and add make it look like the dhcp request of the Amino STB.I’ve entered the following content to /etc/dhclient-eth1.conf to create a dhcp request from the linux pc that looks the same as the aminet130m:

request subnet-mask, time-offset, routers, domain-name-servers, host-name, domain-name,
   root-path, default-ip-ttl, broadcast-address, perform-mask-discovery, router-discovery,
   static-routes, nis-domain, nis-servers, ntp-servers, vendor-encapsulated-options;
send dhcp-max-message-size 548;
send vendor-encapsulated-options 03:09:61:6d:69:6e:65:74:31:33:30:04:05:66:69:73:79:73;
send vendor-class-identifier "Aminoaminet130fisys";
send dhcp-client-identifier 01:00:02:02:xx:xx:xx;
supersede domain-name-servers 208.67.222.222, 208.67.220.220;
supersede static-routes 82.139.121.0 10.252.160.1;

Again, I’ve changed the last 6 bytes of the mac-address of the aminet130m to xx. So fill in the mac-address from your own amino aminet130m. The Vendor encapsulated options looks like some kind of serial number, but it isn’t, it just is almost the same as the vendor class identifier. When converted to ASCII you get: “x03 x09 aminet130 x04 x05 fisys”. I also added two supersede commands to keep my linux box still using the opendns dns servers, and add a static route for all non-multicast servers used on the XMS network (e.g. webserver with STB menu config). This way I can still use my default gateway on eth0 to my local network and internet, and still access the XMS servers from the linux pc.

Some extra settings for routing is needed, so I’ve also entered some info in /etc/sysconfig/route-eth1

ADDRESS0=224.0.0.0
NETMASK0=240.0.0.0

This route can not be added to the supersede dhcp config, because you have to enter an gateway ip-address in the dhcp config. The 224.0.0.0/6 range is the multicast range, and therefore does not have a gateway ip-address.

Your routing table should look something like this:

[root@htpc ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
82.139.121.0    10.252.160.1    255.255.255.0   UG    0      0        0 eth1
10.84.100.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
10.252.160.0    0.0.0.0         255.255.252.0   U     0      0        0 eth1
224.0.0.0       0.0.0.0         240.0.0.0       U     0      0        0 eth1
0.0.0.0         10.84.100.254   0.0.0.0         UG    0      0        0 eth0

With these changes (spoofing mac address) and adding the vendor information to the dhcp request, my linux pc gets an ip-address as if it was a Amino STB. In this dhcp ack there is again a vendor specific field. the content of the field is an url for the STB to load it’s menu and the current timezone. In my case:

http://w.zt6.nl/

Europe/Amsterdam

More information will come…

Post to Twitter