I have a Ubuntu box with Squid installed acting as a transparent proxy server. The config which does the magic is the following. (eth0 is external interface and eth1 is internal.)
sudo sh -c 'echo 1 > /proc/sys/net/ipv4/ip_forward' sudo iptables -t nat -A POSTROUTING --jump MASQUERADE --source 192.168.0.0/24 sudo iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
At this point the proxy works fine.
Then i need to filter out some packets so I use ufw. i.e.
sudo ufw allow http sudo ufw allow https sudo ufw allow ssh sudo deny 5223/tcp sudo ufw enable
At this point nothing works anymore. Not sure what I am missing. Should i do anything with port 3128? Am I having issues because I have two interfaces? Trying the hardest to wrap my head around this but no luck.