Monday, April 11, 2016

Install and Configure SQUID Proxy Server on CentOS/RHEL 6/5

SQUID is a Proxy server and also used for web filtering. Its widely used for increasing web server speed by caching repeated data.
This article will help you to Install and Configure SQUID Proxy Server on CentOS/RHEL Linux systems.

1. Install Squid

Squid can be easily install using yum command line tool.
# yum install squid

2. Setup Port and Start Service

Squid by default run on port 3128. If you want to start squid on different port, Edit squid configuration file and change http_port value. For example we are changing squid to run on port 8080.
# vim /etc/squid/squid.conf
http_port 8080
Start/Restart Squid service.
# service squid restart

3. Configure SQUID to Block Specific Website

Add below rules to block specific website before any allow all rules. Below example will block yahoo.com and www.rediff.com.
acl blocksite1 dstdomain yahoo.com
acl blocksite2 dstdomain www.rediff.com
http_access deny blocksite1
http_access deny blocksite2
If you have a long list of domain names, Create a file /etc/squid/blockwebsites.lst and put domain names one per line and add below rule in squid configuration file.
acl blocksitelist dstdomain "/etc/squid/blockwebsites.lst"
http_access deny blocksitelist
blockwebsites.lst file content example:
# cat /etc/squid/blockwebsites.lst
yahoo.com
www.facebook.com

4. Configure Squid to Block Specific Keyword

Add below rules to block specific website before any allow all rules. Below example will block all pages having keyword yahoo or gmail.
acl blockkeyword1 url_regex yahoo
acl blockkeyword2 url_regex gmail
http_access deny blockkeyword1
http_access deny blockkeyword2
If you have a long list of keywords, Create a file /etc/squid/blockkeywords.lst and put keywords one per line and add below rule in squid configuration file.
acl blockkeywordlist url_regex "/etc/squid/blockkeywords.lst"
http_access deny blockkeywordlist
blockkeywords.lst file content example:
# cat /etc/squid/blockkeywords.lst
yahoo
gmail
facebook
Congratulation’s you have successfully install and configured Squid proxy server.

Thursday, March 10, 2016

Mikrotik Tutorial for Beginners

After finishing installation, a beginner like me might be confused how to login a Mikrotik router. :(
User: admin
Password: <none/ blank>
Anyways, I am going to share some very basic commands of Mikrotik CLI.
Add IP address in a interface:
>ip address add address 10.0.0.1/24 interface ether1
Check the IP:
>ip address print
Add default Gateway for Mikrotik:
>ip route add gateway=192.168.200.1
Check the Route:
>ip route print
Masquerade / NAT implementation through WAN interface:
>ip firewall nat add chain=srcnat action=masquerade out-interface=ether1
Check NAT:
>ip firewall nat print
Forward your External Interface request to a Internal IP:
>ip firewall nat add chain=dstnat dst-address=10.5.8.200 action=dst-nat to-addresses=192.168.0.109 ### 10.5.8.200 (External), 192.168.0.109 (Internal)
Port Forward / Mapping from External to Internal:
>ip firewall nat add chain=dstnat dst-port=1234 action=dst-nat protocol=tcp to-address=192.168.1.1 to-port=1234 ### port forward/ mapping