Albert E. Souza
Albert E. Souza

Reputation: 116

IPtables exception on block facebook access

I have 3 ip ranges on my network, I blocked Facebook access with the command line:

iptables -I FORWARD -m string --algo bm --string "facebook.com" -j DROP

I would like to make an exception to the network range "192.168.0.x"

How can I do that?

Thanks in advance!

Upvotes: 0

Views: 5251

Answers (1)

Daniel t.
Daniel t.

Reputation: 1055

You can simply negate the source IP address using the ! mark.

iptables -I FORWARD ! -s 192.168.0.0/24 -m string --algo bm --string "facebook.com" -j DROP

Upvotes: 1

Related Questions