Linux Iptables allow SQUID proxy incoming client request

SQUID is a high‐performance proxy caching server for web clients, supporting FTP, gopher, and HTTP data objects etc. By default it listen on TCP 3128 port. Following iptables rules allows SQUID incoming client request (open TCP port 3128) for server IP address 202.54.1.20:
iptables -A INPUT -p tcp -s 0/0 –sport 1024:65535 -d 202.54.1.20 –dport 3128 -m state –state NEW,ESTABLISHED -j ACCEPT

ADVERTISEMENTS

iptables -A OUTPUT -p tcp -s 202.54.1.20 –sport 3128 -d 0/0 –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
14 comments… add one
  • suhail ahmad Dec 1, 2006 @ 23:41

    sir,

    how r u.my proluem is i want linux squid proxy server + linux firewall and dhcpd server configur name and mac address based.kindly send me mac address
    configuration.

    Thanx

  • Shahbaz Feb 26, 2007 @ 13:08

    plz sir I install linux AS 3 squid is run proprely but Transparent Proxy not run plz sir give me detail information on Transparent Proxy and configuration.

    Thanks

    Shahbaz

  • Ez Apr 30, 2007 @ 23:02

    Hi

    Both of you dear Contact me at my email address ejaz@beaconet.net

    its a simple and easy configuration ok

    take care
    FE AMAN ALLAH

  • rajesh Oct 28, 2007 @ 4:51

    hi sir some sites not open my local DNS iam useing linux server not open some sites

  • ajay Dec 28, 2007 @ 13:42

    i did install a squid proxy server (white box)

    but how to connect a system with this proxy server while the client system ” white box ” in text mode

  • Atif Jan 19, 2008 @ 7:23

    Hello
    I want to configure squid as a linux server to sharing of net on xp machine as a client.
    Plz tell me about squid configuration on linux server and xp client.
    Thanks

  • pranav vikash Jun 5, 2008 @ 17:05

    hi
    sir m using squid for non-transparent proxy server with iptable .plz tell how i will configure it .m using squid 2.6.19 stable

  • Gopionathan Feb 6, 2009 @ 6:19

    Sir, still iam now using Advanced Server 2. but I am now tray to stable
    2.6 how to configure proxy server and how working in internet ….

  • bimolendu Mar 23, 2009 @ 13:03

    Dear sir how can I restrict to browse some sites from my local network using proxy server and how can I configur to all my user control from proxy server?

  • Fernando Jul 1, 2009 @ 21:24

    Dear Sir, how to configure the proxy server to allow access to a single site to all clients on my network ?
    Thanks in advance.

  • imran Apr 19, 2011 @ 7:02

    sir,
    i am connected internet connection through fedora13 in iptables,
    some web sites are blocking in ip tables, i have accept this website only my pc.

  • steve Jun 4, 2014 @ 8:39

    tested. not working on centos.

    • steve Jun 4, 2014 @ 8:49

      Squid doesn’t talk to the internet on 3128. It listens on 3128. So you have to remove –sport 3128 from your OUTPUT chain.

      [you] (random high port) >=====> (3128) [squid]
      [squid] (random high port) >=====> (80) [internet]

      • steve Jun 4, 2014 @ 8:50

        Also the connection it’s making on your behalf is NEW.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.