October 22, 2018, 12:41:34 PM

News : LinuxSolved.com Linux Help Community Forum..

Author Topic: IPTABLES  (Read 2767 times)

Offline Wangdi

  • New Member
  • Posts: 1
« on: May 02, 2011, 01:55:53 AM »
How to block social sites using iptables. Any experts please help.

Offline belax

  • New Member
  • Posts: 2
    • Wagon of Light
« Reply #1 on: May 02, 2011, 12:04:53 PM »

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

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

# iptables -A INPUT -s -j DROP
# iptables -A INPUT -s -j DROP
# iptables -A INPUT -s -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 :)

Offline commandline

  • New Member
  • Posts: 2
    • Server Uptime
« Reply #2 on: May 03, 2011, 12:50:17 AM »
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.