How to Setup Squid as Transparent Proxy on CentOs 6.4
In this tutorial I am going to configure Squid acting as Transparent Proxy Server on CentOS 6.4 what does it means?
It means we have no part of configurations on the client browser, just to setup Squid in Transparent Proxy Mode so it will sits between client and internet.
Any request made on Port 80 will be redirected to Port 3128 which is Default Squid port.
Here are the simple steps which you need to perform on squid server, in this Lab I’m using CentOs 6.4 as a base Operating System.
CentOS 6.4 Hostname = pxy.broexperts.com (As Squid Proxy Server)
eth0 : (Connected to Internet)
eth1 : (Connected to LAN)
Xp Pro SP3 (Client PC for testing)
|Gateway:||10.0.0.1 (Squid Server IP)|
TIP : Setting up DNS server for this Tutorial you can follow this BIND Caching-only Configurations on CentOs 6.4
Step-1: Squid Installation on CentOS 6.4
- Installing squid packages.
- Open Terminal and run the follwoing command.
Step-2: Edit Configuration file as per the Network Settings
- Edit squid configuration file “/etc/squid/squid.conf”.
- Create one ACL(Access Control List) Named “lan”
- Allow http access for “lan”
- Add the word transparent or intercept after the port “3128” just follow the below line.
Step-3: Specify the hostname at the end of the file.
- you can check the hostname by typing “hostname” command in the terminal
- Now Save and Exit “:wq”
Step-4: Restart and “chkconfig” the squid service
- By using chkconfig command you can ensure service availability on the next boot.
Step-5:Add IPtables rule for transparent squid proxy.
iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 80 -j REDIRECT –to-port 3128
iptables -I INPUT -s 10.0.0.0/8 -p tcp –dport 3128 -j ACCEPT
Now you can test browsing on Client Machine.
Watch Video Guide :
If you have any questions realated to this post you can drop a comment below.
Do you like this Tutorial ? Share it with others on Facebook, Twitter, and Google Plus!