Network Troublshooting > General Networking Support in Linux

IPTABLES

(1/1)

Wangdi:
How to block social sites using iptables. Any experts please help.

belax:
hello!

firstly, you have to know the IP addresses of the social sites what you want to block. you can look up those with dig (or nslookup).

for example, we want to block facebook.com:

# dig facebook.com +short
69.63.189.16
69.63.189.11
69.63.181.12

now we see that facebook.com has 3 IP addresses.
we can block them simply with these commands:

# iptables -A INPUT -s 69.63.189.16 -j DROP
# iptables -A INPUT -s 69.63.189.11 -j DROP
# iptables -A INPUT -s 69.63.181.12 -j DROP

of course you replace the IPs if you want to block something else :)
note that you need root access to use iptables.

hope it helps :)

commandline:
Why mess with ip tables when you can install one of the plethora of firewalls?
You can ban anyone from the command line and it takes less than three seconds.

Navigation

[0] Message Index

Go to full version