Using dnsmasq/iptables to redirect DNS/HTTP traffic on Tomato
For those running a tomato router (and probably all other router distros based on dnsmasq) this should be helpful
This is a method using dnsmasq to do the DNS rewrite on the router and redirecting trailers.applecom traffic to your router, which then snarfs off that traffic and rewrites it to another server on any port based on the source IP (your ATV).
For my setup this means:
- no root required to run PlexConnect
- no port conflicts on 53/80 on my OS X Server (can disable DNS and change the HTTP port)
- no modifications to ATV at all
- 172.16.32.1 = router (Tomato)
- 172.16.32.2 = server (OS X server, static IP, running PlexConnect)
- 172.16.32.12 = atv (static DHCP)
1) DNS setup
On the router, go to Advanced -> DHCP/DNS and enter the following line to rewrite trailers.apple.com to your router IP
2) Rewrite traffic coming from the ATV to your router to a new destination, for me, my OS X server
Go to Admin -> Scripts and add this to the Firewall tab. You can reload this script by just hitting Save on the Port Forwarding section somewhere.