Wat
Dit artikel legt uit hoe je een basis Squid-proxyserver op Linux installeert en configureert, en hoe je clientapparaten instelt om via de proxy te communiceren.
Waarom
Squid is een krachtige caching proxyserver die de browseprestaties verbetert, webfiltering mogelijk maakt en toegangscontrole biedt. Een juiste clientconfiguratie zorgt ervoor dat het verkeer veilig en effectief via de proxy wordt geleid.
Hoe
Stap 1: Installeer Squid
Op RHEL-gebaseerde systemen (AlmaLinux, Rocky, CentOS):
sudo dnf install squid -y
Op Debian-gebaseerde systemen (Ubuntu):
sudo apt update
sudo apt install squid -y
Stap 2: Configureer de Squid-proxy
Bewerk /etc/squid/squid.conf
:
sudo nano /etc/squid/squid.conf
Minimale werkende configuratie:
http_port 3128
acl localnet src 192.168.0.0/16
http_access allow localnet
http_access deny all
dns_v4_first on
Aanbevolen optimalisaties:
cache_mem 64 MB
maximum_object_size_in_memory 512 KB
maximum_object_size 20 MB
access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
Stap 3: Activeer en start Squid
sudo systemctl enable --now squid
Stap 4: Configureer de firewall
firewalld:
sudo firewall-cmd --add-port=3128/tcp --permanent
sudo firewall-cmd --reload
UFW:
sudo ufw allow 3128/tcp
Stap 5: Configureer clientapparaten
Op Linux (tijdelijke shell-instelling):
export http_proxy="http://<squid-ip>:3128"
export https_proxy="http://<squid-ip>:3128"
Op Linux (systeemwijd persistent):
Bewerk /etc/environment
:
http_proxy="http://<squid-ip>:3128"
https_proxy="http://<squid-ip>:3128"
Op Windows (PowerShell, alleen huidige gebruiker):
netsh winhttp set proxy <squid-ip>:3128
Om te resetten:
netsh winhttp reset proxy
Stap 6: Test de verbinding
Op een client:
curl -x http://<squid-ip>:3128 http://example.com
Op de Squid-server:
sudo tail -f /var/log/squid/access.log
Conclusie
Deze eenvoudige configuratie biedt een functionele proxyserver zonder gebruik te maken van PAC-bestanden. Het maakt gecentraliseerd beheer, logging en flexibele netwerkverkeercontrole mogelijk.