Iptable Rule to redirect all traffic requesting a specific domain

Posted by user548971 on Server Fault See other posts from Server Fault or by user548971
Published on 2012-06-08T21:24:25Z Indexed on 2012/06/08 22:42 UTC
Read the original article Hit count: 129

Filed under:
|
|

I'm on a simple linux proxy. I'd like to add iptable rules to drop all requests for a specific domain. I figured I run a dig command to get the ip addresses for the domain and then add an iptable rule for each one. It seems, however, that it doesn't work to bind to more than one ip address. So, it seems I need to add ip ranges like this...

iptables -I FORWARD -p tcp -m iprange --dst-range 66.220.144.0-66.220.159.255 --dport 443 -j DROP

That seems to work. However, it has proven pretty problematic to parse the output of dig and correctly create the appropriate iptable rules. Is there a better way?

Thanks!

EV

© Server Fault or respective owner

Related posts about linux

Related posts about iptables