title: Can iptables allow DNS queries only for a certain domain name?
body: <p>I have iptables blocking all UDP traffic at the moment, however I want to allow only certain DNS queries to get through. </p>
  
  <p>Let's use google.com as an example. </p>
  
  <p>I am trying to use string matching to find the domain name in the request, and allow it. This is what I came up with. </p>
  
  <p><code>iptables -A OUTPUT -o eth0 -p udp --sport 53 -m string --string "google.com" --algo bm -j ACCEP</code>T</p>
  
  <p>I have also tried <code>--dport 53</code> instead of <code>--sport</code>. No dice.</p>
  
  <p>If anyone knows how this can be done or see's where I went wrong your help is appreciated!</p>
  
  <p>Thanks,
  Jarred</p>