I'm using Squid Proxy for (DNS Filtering), I have configured squid proxy behind my GCP Cloud NAT in transparent mode to intercept HTTP and HTTPS Web Traffic, I have added only below rules to redirect HTTP and HTTPS traffic to squid.
iptables -t nat -A PREROUTING -s 0.0.0.0/0 -p tcp --dport 80 -j REDIRECT --to-port 3129
iptables -t nat -A PREROUTING -s 0.0.0.0/0 -p tcp --dport 443 -j REDIRECT --to-port 3130
But as I have learned so far Squid is a web proxy and only handling HTTP, HTTPS & FTP Requests, Squid does't understand SMTP,UDP and any other protocol request, but above iptables rules only working for HTTP and HTTPS, my rest of the SMTP and UDP request are getting block. As I understand we can't tell squid to handle SMTP and UDP Request therefore I only want to handle HTTP and HTTPS traffic on squid, And I also want rest of my ports directly redirect to my GCP Cloud NAT.
Can anybody help me which iptables rule I should write for only redirect port 80, 443 request to Squid, And rest of the port request I want to bypass or redirect directly to my GCP Cloud NAT
Traffic Flow
Private VM -> Squid Proxy -> GCP Cloud NAT