iptables to redirect traffic through AP router?
Hello
I run a wifi router in AP mode and want to setup iptables rule to redirect traffics to Google AdSense to a proxy. I added this chain and rule to NAT table:
1. Create GoogleAds chain
-N GoogleAds
2. Append this chain to PREROUTING chain
-A PREROUTING -j GoogleAds
3. In GoogleAds chain, I make some rules:
-A GoogleAds -d 74.125.235.25/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8888
-A GoogleAds -d 74.125.235.26/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8888
-A GoogleAds -d 74.125.235.13/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8888
But the problem is that no traffic is driven to those rules, though it is driven to GoogleAds chain
Screenshot: http://i.imgur.com/bpRBE.png
I suspect this is related to AP mode of router. I tried on OpenWrt on VirtualBox and successful.
How should right iptables rule is?
(I brought the GoogleAds chain to POSTROUTING, but got error ip_tables:
REDIRECT target: bad hook_mask 0x10/0x9)
Thanks.
Signature · 5 lines
Regards, Quân Y!IM: ng_hquan_vn GTalk: ng.hong.quan