title: Droidwall iptables: allow traffic to only one website AND redirect to proxy
body: <p>Background Info: I have rooted an android phone and installed droidwall to get access to iptables. The kernel version is 2.6.35.7-perf.</p>
  
  <p>Objective: Test the efficiency of a proxy (on port 8080) from a comparison of the traffic flow with and without the proxy.</p>
  
  <p>Method: I have creating a test website on a single IP address. I am using an application that monitors how many packets/bytes have been transmitted and recieved by the phone.</p>
  
  <p>Problem: Due to unknown background traffic, unwanted packets are being sent and recieved.</p>
  
  <p>Solution: Use iptables to only allow a connection to one website so I can properly monitor the traffic.</p>
  
  <p>I am able to limit the connections soley to my desired website without the proxy with the rules from <a href="https://serverfault.com/questions/218707/iptables-rules-to-allow-http-traffic-to-one-domain-only">here</a>.</p>
  
  <p>In another test, I can move the unrestricted traffic through the proxy with these iptable rules:</p>
  
  <blockquote>
    <p>iptables -t nat -A OUTPUT -p tcp --dport 80 -j ACCEPT -m owner --uid-owner root<br>
    iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-port 8080</p>
  </blockquote>
  
  <p>How could I integrate the two sets of rules to redirect the traffic from 1.2.3.4 (example) to port 8080 AND drop everything else.</p>
  
  <p>Any help is much appreciated. Thanks!</p>
  
  <p>Luke</p>