My network: 192.168.0.1 server. (enp0s3 NAT, enp0s8 internal) 192.168.0.10-15 clients (enp0s3 internal).
I have a proxysquid for blocking websites,and so on.
My clients can navigate and browse any website if no proxy is set at firefox settings, if I set the proxy they can't reach any website but can ping 8.8.8.8
My iptables for the conection are:
EXTERNA="enp0s3"
INTERNA="enp0s8"
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t filter -F
iptables -t nat -F
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
# ALLOW TCP & UDP PROTOCOLS
iptables -t filter -A FORWARD -i $INTERNA -p tcp -m multiport --dports 53,80 -j ACCEPT
iptables -t filter -A FORWARD -i $INTERNA -p udp --dport 53 -j ACCEPT
iptables -t filter -A FORWARD -i $INTERNA -p tcp --dport 443 -j ACCEPT
iptables -t filter -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
# ALLOW NAT
iptables -t nat -A POSTROUTING -o $EXTERNA -j MASQUERADE
To force clients I've tried:
iptables -t nat -A PREROUTING -i $INTERNA -p tcp -m multiport --dports 80,443 -j REDIRECT --to-port 3128
And:
iptables -t nat -A PREROUTING -i $INTERNA -p tcp -m multiport --dports 80,443 -j DNAT--to-destination 192.168.0.1:3128
The second one (-j DNAT), worked fine while I was using an ACCEPT default policy, but now I need to set the default policy to DROP, and it's not working anymore.
Honestly I'm a novice using iptables, and maybe the solution is easier than I think, but I need some help, thanks you all.