Friends, in our previous post we’ve discussed some thing about the configuration of proxy server. In this post we’ll enjoy:
How to set up Proxy server in CentOS / Red Hat ?
Now lets see the steps clearly:
At first we’ll clean all the data of “YUM”:
[root@localhost ~]# yum clean all
Then we clear our screen, that is our terminal screen:
[root@localhost ~]# clear
We’ve imported our proxy, you can find this proxy from your internet service provider:
[root@localhost ~]# http_proxy = http://172.16.200.1:3128
We are now updating the Yum database:
[root@localhost ~]# yum -y update
Install squid, which will work as proxy server:
[root@localhost ~]# yum -y install squid
Install iptables, which is also required for the configuration of proxy server:
[root@localhost ~]# yum -y install iptables-services
Now enable and restart the squid and iptables software:
[root@localhost ~]# systemctl enable squid [root@localhost ~]# systemctl start squid [root@localhost ~]# systemctl enable iptables [root@localhost ~]# systemctl start iptables
Now you need to backup the squid configuration file:
[root@localhost ~]# cp /etc/squid/squid.conf /etc/squid/squid.conf.org.back [root@localhost ~]# nano /etc/squid/squid.conf
Uncomment line ##
cache_dir ufs /var/spool/squid 100 16 256 (100 MB, 16 Level)
Press “Ctrl+o” to save
Press “Ctrl+x” to exit
[root@localhost ~]# nano /etc/squid/squid.confat the end write,
( Here see, I’ve written two IP address. One is LAN IP address and the other is my domain (iict) IP address )
acl lan src 192.168.10.0/24
acl iict src 172.16.0.0/16
http_access allow lan
http_access allow iict
Press “Ctrl+o” to save
Press “Ctrl+x” to exit
[root@localhost ~]# systemctl restart squid
Again open the configuration file:
[root@localhost ~]#nano /etc/squid/squid.confWrite:
visible_hostname iict.com
Now you need to configure firewall,
[root@localhost ~]# firewall-cmd –zone=public –add-port=3128/tcp –permanent [root@localhost ~]# firewall-cmd –reload
You also need to disable the SELinux. follow the commands:
[root@localhost ~]# nano /etc/selinux/configSELinux=enforcing Make it to SELinux=disabled
Now reboot the system
[root@localhost ~]#reboot
To forward LAN, just use these commands:
[root@localhost ~]# iptables –A INPUT –m state –state NEW –m tcp –p tcp –dport 3128 –j ACCEPT [root@localhost ~]# systemctl restart iptables [root@localhost ~]# systemctl restart squid
See the internet access log:
[root@localhost ~]# tail –f /var/log/squid/access.log
So you’ve successfully set up a proxy server. To check your proxy server, open Firefox browser. Give IP address (Options>>advanced>>network>>connection>setting>>Manual proxy configuration)
Now after pressing ” OK “, just enter any website address, it will work, if you’ve implemented all the steps properly. Also if you check the access.log file, you can check the log information of browsing.
In the previous post I’ve shown, how to block specific keyword, website or IP address.
Hope that You have enjoyed learning it.
Leave a Reply