Always try NOT to use the same storage disk to store your your cache and your your Router OS, to ensure there is always enough space on your router OS Disk for logs, upgrade / update packages & Backups. Therefore It is highly recommended that the web-proxy cache is stored on a physically separate drive (store) other than the Router OS. Placing the cache on a separate drive ensures maximum performance and reduces problems if the disk becomes full or fails as the OS will then still be OK!
Caching Internet access will require a lot of read and writes to the disk, chose fast disk as for maximum performance / concurrent user request support.
Cache performance also largely depends on RAM size, the More RAM you have in your server, the Better performance you will get.
We will divide this article in 3 Sections.
1# Preparing Secondary Partition for Cache
2# Configuring Web Proxy
3# Transparent Proxy
Let’s BEGIN . . .
1# Preparing Secondary Drive for CACHE
First we will Format secondary harddrive (to be used for cache ), IF YOU DON’T WANT TO USE SECONDARY HARD-DIVE, SKIP THIS STEP.
Goto SYSTEM > STORES > DISKS
Select the Secondary Hard drive and click on FORMAT DRIVE
As shown in the image below.
ow go to STORES tab (by navigating to SYSTEM > STORES)
Select the WEB-Proxy package and click on COPY
It will ask you where to copy WEB-Proxy package, Select Secondary Drive in TO box.
As shown in the image below.
2# Configuring Web Proxy
Now We have to Enable Mikrotik Web Proxy by navigating to
IP > WEB PROXY
As shown in the image below.
Now Click on “Enable”
in Port, Type 8080
Max Cache Size , Select Unlimited from drop down menu, OR if you have limited Disk Space, then use your desired amount.
You have to specify space in KiloBytes for example 1024 KB = 1MB , so if you want to set 5 GB Cache, then use 5242880 , I am using5 GB in this example. The cache size is really based off of how much RAM you have in the machine
As shown in the image below . . .
Click on Apply and your Mikrotik’s Web Proxy is Ready to be used, But Every client have to set proxy address pointing to Mikrotik IP to be able to use Proxy Service.
3# Transparent Proxy
If we want that every user must be automatically redirected to Proxy transparently, then we have to create additional rule to forcefully redirect users to proxy service, which is called TRANSPARENT PROXY.
.
Goto IP > FIREWALL > NAT and create new rule
In Chain , Select dsntant,
In Protocol, Select 6 (tcp)
In Dst. Port, Type 80
As shown in the image below . . .
.
Now goto Action Tab,
In Action, Select redirct
In To Ports, Type 8080
As shown in the image below . . .
Now your newly created rule will look like something below image.
As shown in the image below . . .
OR the CLI version of above rule would be something like below.
1 | /ip firewall nat add action=redirect chain=dstnat disabled=no dst-port=80 protocol=tcp to-ports=8080 |
/ip firewall nat add action=redirect chain=dstnat disabled=no dst-port=80 protocol=tcp to-ports=8080