Sasktel IPTV

From MythTV Official Wiki
Revision as of 06:32, 3 November 2010 by Sphery (talk | contribs) (Don't advertise mc2xml in the official wiki. All channels are available through Schedules Direct, so there is no need to steal the data with mc2xml.)

Jump to: navigation, search

How to get up and running on Sasktel IPTV

This isn't a definitive guide, just what I did to get Sasktel IPTV working on my box. I'm running KnoppMyth (So that's Debian, then).

You will need

  • (At least 1 "Spare") Sasktel Max box (Motorola VIP1200P)
  • Second network card

Note: The network information given by DHCP from the DSLAM for your second network card will not be internet routable. For each MAC address, it appears the DSLAM will only allocate 2 video streams. If you want to record more than 2 at once, you'll need 3 network cards (More than 4, 4 network cards, and so on).

Each box can record 1 HD stream or 2 SD streams at a time. To set this up, create three tuners, one for HD, which is in group 1 and group 2, then one SD tuner for group one and one SD tuner for group 2. This requires two video sources.

Configuring MAC addresses

Take the MAC address (00:21:80:xx:yy:zz) from the underside of your spare box, and set the second network card's MAC to match it. You can do this in /etc/network/interfaces like so:

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
# automatically added when upgrading
auto lo eth0 eth1
iface lo inet loopback

iface eth0 inet dhcp

iface eth1 inet dhcp
        # Set up the hardware (MAC) address
        hwaddress ether 00:21:80:xx:yy:zz

        # Ensure IGMP is v2 and rp_filter is OFF
        pre-up echo 2 >/proc/sys/net/ipv4/conf/eth1/force_igmp_version
        pre-up echo 0 >/proc/sys/net/ipv4/conf/eth1/rp_filter

        # Ensure multicast requests are routed to this interface
        up route add -net eth1

Configuring DHClient

Before you can bring up eth1 however, you also need to do a little fakery with dhclient. Note, the MAC address is used here again, in a few places. Set /etc/dhcp3/dhclient.conf like this:

interface "eth1" {
   # Note, no "routers" in this request. The default gateway for the IPTV 
   # connection won't route internet traffic. So if we don't ask for one,
   # we don't lose our 'net access
   request subnet-mask, broadcast-address, time-offset, domain-name, host-name;

   # The DNS server given to us is wrong, and will not look up any sites.
   # override this with one we know is good (In this case, the gateway address
   # for eth0.
   supersede domain-name-servers;

   # Hello Mr. DSLAM, I am a VIP1200 box
   send host-name "CED002180xxyyzz";
   # See my shiny Motorola-assigned hostname?
   send dhcp-client-identifier 01:00:21:80:xx:yy:zz;
   # See my pretty Motorola-assigned MAC address?
   send vendor-class-identifier "MotoVIP1200P_sasktel-";
   # And see my sasktel firmware provided ID string?
   # Please can I have a 10.110 range IP address?
   # I'm really not faking this!

This should be enough to fool the DSLAM into thinking you're second network card is a VIP1200P box, and when you bring up eth1 you should get a private address in the 10.110.x.x range. If you do, congratulations!

Gentoo Specifics

You can ignore the "Configuring MAC addresses" section above, because Gentoo does things differently

Create the init script:

ln -s /etc/init.d/net.lo /etc/init.d/net.eth1

Add the following to /etc/sysctl.conf

net.ipv4.conf.eth1.rp_filter = 0
net.ipv4.conf.eth1.force_igmp_version = 2

/etc/conf.d/net needs a few things:

# Tells eth1 to use dhclient
modules_eth1=( "dhclient" )

# Create the broadcast route

# Set the specific MAC address

You can test it with

/etc/init.d/net.eth1 start

if you get a 10.x.x.x, you're in good shape, and you can set the init script to the default runlevel:

rc-update add net.eth1 default

I used dhclient, which means that you should use the same /etc/dhcp/dhclient.conf as above.

Channels list

Now you need an m3u file to tune the network recorder to.

Regina SD channel list using Schedules Direct: Sasktel IPTV Regina Channels

Saskatoon SD & HD channel list using Schedules Direct: Sasktel IPTV Saskatoon Channels

With that set up, you should be all set. Enjoy watching your Sasktel Max!

How I worked this out

I'm certain others on other IPTV systems are interested in how I got this info, so here's the basics.

You will need

  • a PC
  • a hub
    An external switch may also work, but the built-in switch in the 2wire box will not work, as it does VLAN seperation.
  • a (spare) Set-Top Box
    You cannot have two connections sharing the same MAC, and the boxes have to be registered before the DSLAM will give out IP allocations. Don't try guessing a new MAC.

How to start

  • Get the PC up and running, with as little software running as possible, and with Wireshark capturing packets. The more network activity on your PC, the more pages of packets you'll have to scroll through to find the ones you need.
  • Plug in the STB to the power. Literally, plug in the power cord. After about a second you'll see a lot of traffic in Wireshark's window.
  • Leave Wireshark capturing packets until the STB boots to the menu. It may reboot twice before getting there, be patient.
  • Once the STB is sitting at the menu, you can stop the capture.

Wireshark (should) now have a log of the STB coming up, requesting an initial IP address, downloading it's bootloader over multicast, rebooting and loading the firmware from multicast. You will need to go back through the list of captured packets until you see the most recent DHCP/BOOTP request. Expand it to get all the details of every item sent in the DHCP request. These are the details you will need to add to your DHClient configuration.

Finding the channels

  • Start a new capture in Wireshark
  • Grab the remote and tune the STB to a channel
  • * At this point, you will see the IGMP join request, followed quickly be a whole mass of UDP packets, coming from a private IP source, and headed to a multicast ip. These are the IPTV stream for that channel.
  • Pick a UDP packet (It shouldn't matter which one, they'll all be to and from the same location), and note down it's DESTINATION IP address and DESTINATION port.
  • * It's possible that Wireshark will try and be helpful supply the port's name for you in the packet listing. If you click on a packet, however, it will give you the number in the "User Datagram Protocol" header.
  • * For the first channel, open VLC, and choose "Media -> Open Network". Protocol UDP, address is the destination IP address, and port is the destination port. You should see on your computer screen the same as the feed from your STB. If so, congratulations.
  • Also note down the channel number and name. This will help later when it comes time to map your XMLTV IDs
  • Tune to the next channel, lather, rinse and repeat.

This process may take a while to complete, going through every channel, but by the end you should have a complete channel to IP/Port map.

Building the M3U

So, now you've got your list of IPs, ports, channel numbers and names. You might be wondering how to make them a nice M3U file. Well, here's how I did it.

I knew I would have to do some manipulation of these details, so I originally noted them down in OpenOffice Calc. Once I had them there, it was a fairly simple step to join them into an (almost) M3U style:

XMLTV ID Ch # Ch Name IP Port Code
16001 3 CBC 9400 =CONCATENATE("#EXTINF:0,";B1;" - ";C1;"~#EXTMYTHTV:xmltvid=";A1;"~udp://";D1;":";E1)

The last cell there is the one that does most of the magic. For this example, it comes out to

#EXTINF:0,3 - CBC~#EXTMYTHTV:xmltvid=16001~udp://

But it still needs an M3U header, and to be split on those ~'s. So, that column gets fed into notepad (To ensure the values, and not the contents were copies), and has an M3U header prepended to it (#EXTM3U). Then it gets thrown into nano on my linux box, saved, and processed with a little sed:

sed 's/~/\n/g' notquiteanm3ufile.txt >channels.m3u

This gives you a nice, concise M3U file that you can use with Myth to your heart's content.


This isn't a definitive guide. There is no guarantee this will work with your IPTV setup, but (for now) it is working fine for me. If you do manage to get IPTV working with your provider, please feel free to update this page, or make a new one for your provider. Hopefully, working together on this, we can make Myth an IPTV box to be reckoned with!