KPN Routed IPTV on an Ubiquiti EdgeRouter Lite - Lessons Learned - Part 2

Written by Pim on Saturday April 23, 2016 - Comment - Permalink
Categories: technology, howto - Tags: edgerouter, iptv, kpn, ubiquiti

After blogging about my lessons learned on 28 March this year, I have to create a 'part 2' because of problems with the static route to the KPN IPTV network.

The problem: On every reboot, I get a DHCP address in another subnet. The previous static route doesn't match the new subnet and causes a not working IPTV network in-house. To resolve this, I had to update the static route at every reboot...

The solution: Update the static route after the boot process has completed.

The scripts I created:

#!/bin/vbash

source /opt/vyatta/etc/functions/script-template

r_ip=$(run show dhcp client leases | grep router | awk '{ print $3 }');
iptv_static=$(echo "set protocols static route 213.75.112.0/21 next-hop $r_ip")

configure
delete protocols static route 213.75.112.0/21
eval $iptv_static
commit
save
exit

The script retrieves the next-hop address from the DHCP client lease. Then I delete the previous static route to 213.75.112.0/21 and set a new one.

To run it at every boot, create the script in the /config/scripts/post-config.d directory and make it executable (chmod +x).