Once you have your router set up with either Tomato or DD-WRT firmware, follow the following steps:
- Assign a static IP address to your Chromecast.
- Navigate to Administration -> Scripts and save the following line under Firewall Scripts
For Tomato Firmware:
iptables -t nat -A PREROUTING -s IP-OF-CHROMECAST/32 -d 8.8.8.8 -p udp --dport 53 -j DNAT --to IP-OF-ROUTER
iptables -t nat -A PREROUTING -s IP-OF-CHROMECAST/32 -d 8.8.4.4 -p udp --dport 53 -j DNAT --to IP-OF-ROUTER
For DD-WRT Firmware:
For intercepting all DNS:
iptables -t nat -A PREROUTING -i br0 -p udp --dport 53 -j DNAT --to $(nvram get lan_ipaddr)
iptables -t nat -A PREROUTING -i br0 -p tcp --dport 53 -j DNAT --to $(nvram get lan_ipaddr)
Intercepting only the Chromecast:
iptables -t nat -A PREROUTING -i br0 -s IP-OF-CHROMECAST/32 -p udp --dport 53 -j DNAT --to $(nvram get lan_ipaddr)
iptables -t nat -A PREROUTING -i br0 -s IP-OF-CHROMECAST/32 -p tcp --dport 53 -j DNAT --to $(nvram get lan_ipaddr)
If you didn’t set our DNS in your router use this (Not recommended):
iptables -t nat -I PREROUTING -i br0 -s IP-OF-CHROMECAST/32 -p udp --dport 53 -j DNAT --to OUR-DNS-SERVER
iptables -t nat -I PREROUTING -i br0 -s IP-OF-CHROMECAST/32 -p tcp --dport 53 -j DNAT --to OUR-DNS-SERVER
Simply replace IP_OF_CHROMECAST with the static IP you assigned to the Chromecast in Step 1 and replace IP-OF-ROUTER with the IP of your router if you’ve configured our DNS in your router, otherwise replace it with two of our DNS servers below.
That’s it! Happy casting!