L
L
lohmag2014-09-17 11:58:44
linux
lohmag, 2014-09-17 11:58:44

How to configure squid and iptables to filter certain ips by url?

It is necessary to filter certain sites by url, there is an ip address and the actual url.
What was the idea - a rule is created in iptables to mark packets to specific addresses

iptables -A PREROUTING  -i eth0 -p tcp --dport 80 -d 199.115.119.133 -t mangle -j MARK --set-mark 1

After that, such a packet can be redirected using policy routing to another server where, for example, squid stands, which will filter by the url entered in the ACL.
Now I feel sorry for a separate server for such a small amount of traffic, how to redirect these packets to squid located on the same server without touching the rest of the http traffic?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2014-09-17
@BuriK666

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -d 199.115.119.133 -j DNAT --to localhost:3128

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question