IPTV How To

From Alpine Linux
Jump to: navigation, search

Internet Protocol television (IPTV) is a system through which Internet television services are delivered using the architecture and networking methods of the Internet Protocol Suite over a packet-switched network infrastructure, e.g., the Internet and broadband Internet access networks, instead of being delivered through traditional radio frequency broadcast, satellite signal, and cable television (CATV) formats.

Installing tools

Add alpine http repository to /etc/apk/repositories

echo http://alpine.nethq.org/alpine/v1.9/packages/testing/ >> /etc/apk/repositories

Install igmpproxy

apk add igmpproxy

Install iptables (optional, see troubleshooting)

apk add iptables

Setup igmpproxy

Open /etc/igmpproxy.conf in your favorite editor

nano /etc/igmpproxy.conf

Set upstream interface to your WAN interface. In my case eth0

phyint eth0 upstream  ratelimit 0  threshold 1

If you know your ISPs multicast sources you should add them here. If not don't worry we'll come back here later.

altnet 88.222.0.0/16
altnet 10.0.0.0/8

Set downstream interface to your LAN interface. In my case eth1

phyint eth1 downstream  ratelimit 0  threshold 1

Disable other unused interfaces

phyint lo disabled

If you haven't added multicast sources yet your igmpproxy.conf should look like this

quickleave
phyint eth0 upstream  ratelimit 0  threshold 1
phyint eth1 downstream  ratelimit 0  threshold 1
phyint lo disabled

Launch igmpproxy in debug mode

igmpproxy -d -v /etc/igmpproxy.conf

You should see output similar to this

RECV Membership query   from 10.253.88.1     to 224.0.0.1
RECV Membership query   from 10.254.88.1     to 224.0.0.1
RECV V2 member report   from 88.222.27.35    to 239.255.255.250

Now we know that ISPs multicast sources are 10.x.x.x (10.0.0.0/8) and 88.222.x.x(88.222.0.0/16). We need to specify them in /etc/igmpproxy.conf right after upstream interface declaration like this

phyint eth0 upstream  ratelimit 0  threshold 1
      altnet 88.222.0.0/16
      altnet 10.0.0.0/8

Your complete igmpproxy.conf should look like this

quickleave
phyint eth0 upstream  ratelimit 0  threshold 1
        altnet 88.222.0.0/16
        altnet 10.0.0.0/8
phyint eth1 downstream  ratelimit 0  threshold 1
phyint lo disabled

Launch igmpproxy and enjoy IPTV :)

igmpproxy /etc/igmpproxy.conf

Troubleshooting

  • Make sure your local subnet is not same as your ISP's multicast source. 192.168.0.0/24 is probably safe bet.
  • You might need to add forwarding rules to iptables
iptables -I FORWARD -s 88.222.0.0/16 -d 224.0.0.0/4 -j ACCEPT
iptables -I FORWARD -s 10.0.0.0/8 -d 224.0.0.0/4 -j ACCEPT
iptables -I INPUT -d 224.0.0.0/4 -j ACCEPT
  • If you're using shorewall modify /etc/shorewall/shorewall.conf
MULTICAST=Yes

Add following rules to /etc/shorewall/rules

ACCEPT		all		fw:224.0.0.0/4
ACCEPT		all		net:224.0.0.0/4
ACCEPT		all		loc:224.0.0.0/4