Drop all outgoing traffic with linux iptables to destination port 80 / http / www

To block all outgoing traffic to the port 80 ( http, www, html ) use command:

iptables -A OUTPUT -p tcp –dport 80 -j DROP

To remove all iptables rules use command:

iptables -F

Sometimes you need to DROP all port 80 ( http, www, html ) traffic except certain IP address. In this case you ca run:

iptables -A OUTPUT -d <your ip address> -p tcp –dport 80 -j ACCEPT

iptables -A OUTPUT -p tcp –dport 80 -j DROP

Leave a Reply

You must be logged in to post a comment.