The Wild

Squid Proxy on pfSense: Step-by-Step Setup

· 6 min read · Ocean Life

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Setting up a Squid proxy on pfSense gives you a caching and filtering HTTP/HTTPS proxy for your network. It can speed up web browsing by caching frequently accessed content, block unwanted domains, and provide access control. This guide walks you through installing and configuring the Squid package on pfSense, including enabling transparent proxy mode, configuring ACLs, and troubleshooting common issues.

What You'll Need

  • A pfSense firewall (version 2.4 or newer) with admin access to the web GUI.
  • At least one network interface configured (LAN or OPT) where you want to apply the proxy.
  • Basic familiarity with pfSense's web interface and firewall rules.
  • Optional: a domain list or blacklist file if you plan to use content filtering.

Step-by-Step

  1. Install the Squid package: In the pfSense web GUI, go to System > Package Manager > Available Packages. Search for "squid" and click Install next to the "Squid" package (usually named pfSense-pkg-squid). Confirm the installation and wait for it to complete.
  2. Access Squid settings: After installation, a new menu item Services > Squid Proxy appears. Click on it to open the Squid configuration page.
  3. Enable the proxy: On the General tab, check the box Enable Squid Proxy. Set the Proxy Interface(s) to the interface(s) you want the proxy to listen on (e.g., LAN). For the Proxy Port, the default is 3128; you can change it if needed. Leave Transparent Proxy unchecked for now—we'll enable it later if desired. Click Save.
  4. Configure cache settings (optional): Go to the Cache tab. Adjust the Cache Size (in MB) based on your disk space—a typical value is 100–500 MB for small networks. Set the Cache Drive to your disk (e.g., /var/squid/cache). You can also set Minimum Object Size and Maximum Object Size to control what gets cached. Click Save.
  5. Set up access control (ACLs): Go to the ACL tab. Here you can define allowed or denied destinations. For example, to block a domain, add a new ACL: Type = dstdomain, ACL Name = blocked_sites, and in URL/domain enter the domain (e.g., .example.com). Then, under Proxy Restrictions, add a rule: Action = Deny, ACL = blocked_sites. Click Save.
  6. Apply the configuration: After making changes, click Apply at the top of the page to commit the settings. The proxy will start.
  7. Test the proxy manually: On a client machine, set your browser's proxy settings to point to your pfSense LAN IP and port 3128. Try browsing a website—if it loads, the proxy is working. You can check the Squid access log under Status > System Logs > Proxy to see requests.
  8. Enable transparent proxy (optional): If you want clients to use the proxy without manual configuration, go to Services > Squid Proxy > General, check Transparent Proxy, and select the interface (e.g., LAN). Save and apply. Then you must add a firewall rule to redirect HTTP traffic to the proxy port. Go to Firewall > Rules, edit the LAN rules, and add a rule: Action = Pass, Protocol = TCP, Source = LAN net, Destination = any, Destination Port = 80, and under Advanced Features set Redirect Target Port to 3128. Save and apply. HTTPS traffic (port 443) is not transparently intercepted by default; you would need SSL inspection, which is complex and out of scope.
  9. Verify transparent proxy: After adding the firewall rule, test by browsing from a client without manual proxy settings. Check the Squid logs to see if requests appear.

Common Mistakes

  • Forgetting to apply changes: Many settings only take effect after clicking Apply. Always apply after each change.
  • Wrong interface selection: If you select the WAN interface as the proxy interface, it will be exposed to the internet—a security risk. Use LAN or OPT interfaces.
  • Transparent proxy without firewall rule: Enabling transparent proxy alone does nothing; you must add the firewall redirect rule.
  • Blocking all traffic with ACLs: If you create a deny rule that matches too broadly (e.g., dstdomain .), you may block all web access. Test ACLs with specific domains first.
  • Ignoring cache directory permissions: If the cache directory is not writable by the Squid user, the proxy may fail to start. Ensure the directory exists and has proper ownership (usually proxy:proxy).

Tips

  • Use the Status > Squid Proxy page to monitor cache hits and performance.
  • For content filtering, you can import a blocklist (e.g., from a URL) under the ACL tab by adding an ACL of type dstdomain and pasting domains, or use the URL Filter feature if you have a list.
  • If you have a large network, consider increasing the cache size and enabling Cache Dynamic Content for better performance.
  • To allow HTTPS traffic through the proxy, clients must be configured to use the proxy for all protocols (HTTP and HTTPS). Squid can cache CONNECT requests, but it cannot inspect the content.
  • Always back up your pfSense configuration before making major changes: Diagnostics > Backup & Restore.

Troubleshooting

  • Proxy not starting: Check the Squid service status under Status > Services. If it's stopped, look at the system log (Status > System Logs > General) for errors. Common issues include invalid ACL syntax or missing cache directory.
  • Clients cannot connect: Verify that the proxy is listening on the correct interface and port. Use netstat from the pfSense shell (via Diagnostics > Command Prompt) to check if port 3128 is open.
  • Transparent proxy not working: Ensure the firewall rule is placed before any blocking rules and that the destination port is correctly set to 80. Also, make sure the proxy interface matches the one in the rule.
  • Slow browsing: If the proxy is slow, check if the cache is working (hit rate under Status > Squid Proxy). If the hit rate is low, increase the cache size or adjust cache object sizes.
  • Blocked sites still accessible: Double-check your ACL configuration. For domain blocking, ensure you are using dstdomain and that the domain matches (e.g., .example.com blocks all subdomains). Also, remember to apply the changes.

Frequently Asked Questions

Can Squid proxy cache HTTPS content?

Squid can cache HTTPS responses only if the client uses the proxy as a forward proxy and the connection is not end-to-end encrypted (e.g., when using SSL bump). By default, HTTPS traffic is tunneled via CONNECT and not cached.

How do I block specific websites for certain users?

You can create ACLs based on source IP or subnet. For example, add an ACL of type src with the IP range, then combine it with a dstdomain ACL in a deny rule.

Can I use Squid on pfSense to filter content for my kids?

Yes, you can use Squid with domain blacklists and ACLs to block adult or harmful sites. However, it only filters HTTP and HTTPS if you configure SSL inspection, which is advanced. For HTTPS, you may need a separate DNS-based filter.

Does transparent proxy work for all devices?

Transparent proxy works for HTTP traffic on any device that uses the pfSense as its gateway. It does not work for HTTPS unless you set up SSL inspection, which requires installing a CA certificate on each client.

How do I uninstall Squid?

Go to System > Package Manager > Installed Packages, find Squid, and click Deinstall. This will remove the package and its configuration, but your firewall rules remain.

Can I run multiple Squid instances?

pfSense's Squid package supports only one instance per interface. If you need multiple proxies, you can run Squid on different ports and use different ACLs, but it's not a true multi-instance setup.