I'm trying to use iptables to force DNS for certain devices (Shibby Tomato on Asus RT-N66U). I haven't found anything online describing such a configuration. The closest I could find was this:
# For the Samsung TV, use WAN DNS (i.e., Comcast).
# #############################################################
iptables -t nat -A PREROUTING -i br0 -s samsung-tv.home.lan -p tcp --dport 53 -j DNAT --to $(nvram get wan_get_dns | awk -F' ' '{print $1}')
iptables -t nat -A PREROUTING -i br0 -s samsung-tv.home.lan -p udp --dport 53 -j DNAT --to $(nvram get wan_get_dns | awk -F' ' '{print $1}')
# For every other client, use LAN 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)
This is close, but there are a couple problems.
1) I'd prefer to do it by MAC address, rather than hostname. Is that possible?
2) This only allows a single DNS server per client. Is there a way to assign a primary and secondary DNS using this (or similar) method?