Created
July 4, 2012 16:49
-
-
Save luisuribe/3048290 to your computer and use it in GitHub Desktop.
block facebook using iptables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FACEBOOK_ALLOW="192.168.1.12 192.168.1.14 192.168.1.111" | |
iptables -N FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 66.220.144.0-66.220.159.255 --dport 443 -j FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 69.63.176.0-69.63.191.255 --dport 443 -j FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 204.15.20.0-204.15.23.255 --dport 443 -j FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 66.220.144.0-66.220.159.255 --dport 80 -j FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 69.63.176.0-69.63.191.255 --dport 80 -j FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 204.15.20.0-204.15.23.255 --dport 80 -j FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 69.171.242.0-69.171.242.255 --dport 80 -j FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 69.171.229.0-69.171.229.255 --dport 80 -j FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 69.171.224.0-69.171.224.255 --dport 80 -j FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 69.171.242.0-69.171.242.255 --dport 443 -j FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 69.171.229.0-69.171.229.255 --dport 443 -j FACEBOOK | |
iptables -I FORWARD -m tcp -p tcp -m iprange --dst-range 69.171.224.0-69.171.224.255 --dport 443 -j FACEBOOK | |
## FACEBOOK ALLOW | |
for face in $FACEBOOK_ALLOW; do | |
> iptables -A FACEBOOK -s $face -j ACCEPT | |
> done | |
iptables -A FACEBOOK -j REJECT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment