How can I block a website using iptables with this rules?
Hello again guys,
I already set up a rule with mac filtering with this rule: I set the iptables default rule to: Code:
iptables -P INPUT ACCEPT Code:
iptables -A POSTROUTING -t nat -o eth0 -s 192.168.1.0/24 -d 0/0 \ I need any ideas, suggestions or tips from you guys. Thanks |
Words like "website" really don't mix with iptables. But you've not said a thing about what this site is, so it's hard to know if anything is possible. There are ways to attempt to match certain strings in web traffic which can be used to filter at a deeper level, but it's really not appropriate most of the time. You need to stay in a world of IP addresses and port numbers, so if you can define what this site is in those terms, then great, otherwise, that's what http proxies are for.
|
Thank you for your response, Chris.
The website is google.com. How can we able to block this site? Applying iptables. |
First thing- You are using IPTABLES, so you should know the IP address of the website you want to block.
And Google has a range of IP addresses and you will have to block each of them. Code:
sudo iptables -A INPUT -s IP_ADDRESS -j REJECT |
Thanks but this rule not working to the iprules given above.
Code:
sudo iptables -A INPUT -s IP_ADDRESS -j REJECT Code:
+---+ S: SERVER eth0: connection from the internet/other network eth1: internal network |
you can't block google from IP tables. Google has HUNDREDS of potential IP addresses serving a myriad of different sites that can change at any given second. That's absolutely NOT a plan. You need a proxy, something that understands HTTP.
|
Hello Chris,
May I know how we can use proxy to block a website in ubuntu server? any guidelines or steps? |
sure, just google information about squid, that's exactly what it's for.
|
All times are GMT -5. The time now is 11:40 PM. |