Requirements
- USB stick - 1G or more in size
- USB-capable router running TomatoUSB.
Install entware
Pick a USB stick that you can dedicate to your router since it will be completely erased by the following process.
Configure the GUI for entware
In the web GUI, go to the "USB and NAS->USB Support" section and tick the following options:
[x] Core USB Support
[x] USB 2.0 Support
[x] USB Storage Support
[x] Ex2/Ext3 File Systems Support
[x] Automount
Paste this text into the "Run after mounting" box:
#!/bin/sh /opt/etc/init.d/rc.unslung start
Paste this text into the "Run before unmounting" box:
#!/bin/sh
/opt/etc/init.d/rc.unslung stop
sleep 15
for i in `cat /proc/mounts | awk '/ext3/{print($1)}'` ; do
mount -o remount,ro $i
done
Click the "Save" button and then check the "USB Status" at the bottom of the screen. If your USB stick is mounted, click "Unmount". In subsequent steps, we are going to format the USB stick, so we don't want it mounted.
Go to the "Administration->Scripts->Init" page. Paste the following into the "Init" script section:
echo "LABEL=ENTWARE /opt ext3 rw,noatime 1 1" >> /etc/fstab sleep 5 python /opt/PlexConnect/PlexConnect.py
Go to the "Administration->Scripts->Init" page. Paste the following into the "Firewall" script section:
iptables -t nat -A PREROUTING -s 192.168.1.111 -d 192.168.1.1 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:8080 iptables -t nat -A PREROUTING -s 192.168.1.111 -d 192.168.1.1 -p tcp --dport 443 -j DNAT --to-destination 192.168.1.1:8443
substitute your AppleTV IP address for 192.168.1.111 and your router's IP address for 192.168.1.1
Click the "Save" button.
For reference, most of the above is taking from the entware USB setup instructions.
Prepare the USB stick
Plug the USB stick in and ssh to the router. Remember, the next steps will completely erase the USB stick!
Find the device name for your USB stick
Run "fdisk -l" to display all the block devices and their partitions. Here is an example:
# fdisk -lDisk /dev/sdb: 16.2 GB, 16231956480 bytes
64 heads, 32 sectors/track, 15480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytesDevice Boot Start End Blocks Id System
/dev/sdb1 1 15480 15851504 83 Linux
You can see that the disk /dev/sdb is a 16GB block device. Since there are no other 16GB devices on my router, I can be pretty sure that the 16GB stick that I plugged in is mapped to /dev/sdb.
Partition the USB stick
Use fdisk to delete all the partitions on your USB disk. Then create a single partition spanning the entire drive and set its type to 83 (Linux). Write the partition table and exit fdisk.
Format the USB stick
Replace the /dev/sdb1 below with the path to your newly created partition.
mkfs.ext3 -L ENTWARE /dev/sdb1
Perform the entware install
mount /opt entware-install.sh
REBOOT the router.
PlexConnect
Now that entware is installed on your router, it is time to add PlexConnect.
Install PlexConnect dependancies
opkg update opkg install git opkg install python opkg install python-openssl opkg install pyload opkg install nano opkg install ca-certificates
Create a Symlink for Git
ln -s $(which git) /opt/lib/git-core/git
Install PlexConnect
cd /opt git clone git://github.com/iBaa/PlexConnect.git
Create Certificates
mkdir /opt/PlexConnect/assets/ mkdir /opt/PlexConnect/assets/certificates/ openssl req -new -nodes -newkey rsa:2048 -out /opt/PlexConnect/assets/certificates/trailers.pem -keyout /opt/PlexConnect/assets/certificates/trailers.key -x509 -days 7300 -subj "/C=US/CN=trailers.apple.com"openssl x509 -in /opt/PlexConnect/assets/certificates/trailers.pem -outform der -out /opt/PlexConnect/assets/certificates/trailers.cer && cat /opt/PlexConnect/assets/certificates/trailers.key >> /opt/PlexConnect/assets/certificates/trailers.pem
chmod -R +x /opt/PlexConnect
chmod -R 755 /opt/PlexConnect
Settings.cfg
Run PlexConnect so it will create Settings.cfg
cd /opt/PlexConnect ./PlexConnect.py
wait few secs and stop PlexConnect with CTRL + C
nano /opt/PlexConnect/Settings.cfg
[PlexConnect] enable_plexgdm = True ip_pms = 192.168.178.10 port_pms = 32400 enable_dnsserver = False port_dnsserver = 53 ip_dnsmaster = 8.8.8.8 prevent_atv_update = True enable_plexconnect_autodetect = False ip_plexconnect = 192.168.1.1 hosttointercept = trailers.apple.com port_webserver = 8080 enable_webserver_ssl = True port_ssl = 8443 certfile = ./assets/certificates/trailers.pem allow_gzip_atv = False allow_gzip_pmslocal = False allow_gzip_pmsremote = True loglevel = Normal logpath = .
CTRL + X to exit and Y for save.
On your router's Tomato web page, Go to Advanced -> DHCP/DNS -> Dnsmasq Custom configuration and enter:
address=/trailers.apple.com/192.168.1.1 address=/atv.plexconnect/192.168.1.1
http://trailers.apple.com/trailers.cer
ENJOY!
How to Update
To update entware:
opkg update opkg upgrade
To update PlexConnect:
cd /opt/PlexConnect git pull
Credit to dferg and shroud for their contributions to the community.
Edited by moderation to include ca-certificates as prereq