TV with OpenWrt

sketch > Openwrt TV

NOTE:
Original tutorial here:
http://ocsovszki-dorian.blogspot.co.uk/2014/01/tl-wdr4900-openwrt-dvb-t-with-ite9135.html
Worth a read, also lot more info beyond the scope of this tutorial.
This tutorial aims for noobs and uses precompiled packages and modules.

Flashing TP-link WDR4900

Flashing from existing openwrt image looks like this on the GUI (luci in web browser):
flickr:14395883126

Unstick the 'keep settings' option, so we start from clean state after.
(ie. this guide and your setup will be the same)

File for flashing can be downloaded from here. (TODO: local mirror for future).

Telnet login

Physical setup
TP-link WDR4900 lan port (yellow) <-> laptop ethernet port

After first install login to '192.168.1.1' via telnet through ETHERNET on LOCAL LAN port (wifi disabled by default in openwrt).
The best is disconnect from the laptop wifi, and have the ethernet active only.
That is because if both (laptop wifi, openwrt) are on the same subnet (192.168.1.x), then internet wont work. You should set up bridging(?) on the laptop.
KISS for now.

telnet 192.168.1.1
$ passwd
# insert new root password here
$ exit
ssh root@192.168.1.1
# login via ssh

Internet setup on the WDR4900

WIFI —> Laptop —> Ethernet —> Router(WDR4900)

We assign 192.168.111.xxx subnet to the router WAN port. We redirecting on the laptop the wifi to the router, so we can update package via the internet on the router.

On the WDR4900

$ vi /etc/config/network:
config interface 'wan'
    option ifname 'eth0.2'
    option proto 'static'
    option ipaddr '192.168.111.2'
    option netmask '255.255.255.0'
    option macaddr '64:66:b3:de:e2:fc'

(Note the proto 'static', ipaddr and netmask changes.)

$ cat /etc/resolv.conf
search lan
nameserver 8.8.8.8

(Note the nameserver 8.8.8.8 changes)

Allow ssh login via the WAN connector:

$ iptables -I INPUT 1 -p tcp --dport 22 -j ACCEPT

To survive boot, put it into /etc/rc.local.

Restart the net on the router:

$ /etc/init.d/network restart

Unplug the ethernet cable from one of the LAN port (yellow) and plug into the WAN port (blue).

On the laptop

iptables -t nat -A POSTROUTING -s 192.168.111.0/24 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

Check routing on both the WDR4900 and the laptop

On the WDR4900:

$ route -n
$ route del default
$ route add default gw 192.168.111.203
# 192.168.111.203 is the laptop's ip addres on the ethernet port (wired network)

On the laptop:

Check if you have internet (any website is working).
If not, fix the gateway problem.

$ route -n

# remove the wrong gateway (network-manager likely will fuckup)
$ route del default

# add the gateway, what is your normal wifi network router (mine is 192.168.1.1)
# it is not the WDR4900!, but a fonera, an asus router, 
# or linksys or another tp-link router
$ route add default gw 192.168.1.1

Save the package list of the vanilla state (on WDR4900)

ssh root@192.168.111.2
$ opkg list_installed > opkg_vanilla_packagelist.txt

For reference here is the output:

Update the opkg package list

$ opkg update

Install the required packages:

opkg install luci htop screen kmod-ath

Packages to be downloaded:

wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/luci_svn-r10373-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/uhttpd_2014-06-11-dabd7dea6445aaa0e5b8d9add1872fa7393b3a85_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/uhttpd-mod-ubus_2014-06-11-dabd7dea6445aaa0e5b8d9add1872fa7393b3a85_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/luci-mod-admin-full_svn-r10373-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/luci-base_svn-r10373-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/lua_5.1.5-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/liblua_5.1.5-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/libuci-lua_2014-04-11.1-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/libubus-lua_2014-05-06-9fda19140e65457d967ff6fe424e420f656c06c9_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/luci-theme-bootstrap_svn-r10373-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/luci-app-firewall_svn-r10373-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/luci-proto-ppp_svn-r10373-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/libiwinfo-lua_49_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/luci-lib-nixio_svn-r10373-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/htop_1.0.3-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/libncurses_5.9-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/terminfo_5.9-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/screen_4.2.1-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/nano_2.3.4-1_mpc85xx.ipk

Text editor, if you need:

opkg install nano

Also Midnight Commander (mc) to not feel handycapped:

opkg install mc

wget log:

wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/mc_4.8.10-1_mpc85xx.ipk.
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/glib2_2.37.7-1_mpc85xx.ipk.
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/zlib_1.2.8-1_mpc85xx.ipk.
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/libpthread_0.9.33.2-1_mpc85xx.ipk.
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/libffi_3.0.11-1_mpc85xx.ipk.
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/librpc_0.9.32-rc2-0a2179bbc0844928f2a0ec01dba93d9b5d6d41a7_mpc85xx.ipk.

Wifi -> openwrt -> (lan) -> laptop/raspi

opkg install luci-proto-relay.

wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/luci-proto-relay_svn-r10373-1_mpc85xx.ipk
wget http://downloads.openwrt.org/snapshots/trunk/mpc85xx/packages/relayd_2011-10-24-4e8f1fa4ca2b176500362843a9e57ea5abd4b7a3_mpc85xx.ipk

Enable graphical user interface (Luci)

/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start

Iptables

iptables -vnL INPUT
iptables -I INPUT 1 -j ACCEPT

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-NoDerivs 3.0 License