Squid load balancing using Mikrotik Router OS


Squid load balancing using Mikrotik Router OS
By using this scenario You can redirect HTTP traffic to multi squid proxies and load balancing the squid usage.




Step. 1
Mark routing for http Packet.

/ip firewall mangle chain=prerouting protocol=tcp dst-port=80 action=mark-routing \ new-routing-mark=http passthrough=yes
Step. 2 Add a default route for HTTP traffic to all squid proxies and check them using ping.

/ ip route add dst-address=0.0.0.0/0 gateway=10.1.2.4,10.1.2.3,10.1.2.2 \ check-gateway=ping scope=255 target-scope=10 routing-mark=http comment="" \ disabled=noNote: Now Mikrotik will start routing the http requests to all three proxies in round-robin.
Step. 3 Configure all squid proxies to listen transparent and redirect http traffic on squid's port ( i.e transparent squid is running on 3128 port).

iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128Now we configure ( squid.conf )all proxies to use cache Peering using ICP protocol.
poxy1

icp_port 3130 cacher_peer 10.1.2.3 sibling 3128 3130 cacher_peer 10.1.2.4 sibling 3128 3130
poxy2

icp_port 3130 cacher_peer 10.1.2.2 sibling 3128 3130 cacher_peer 10.1.2.4 sibling 3128 3130
poxy3

icp_port 3130 cacher_peer 10.1.2.2 sibling 3128 3130 cacher_peer 10.1.2.3 sibling 3128 3130

Popular posts from this blog

History of Labor Day

Relationships Ruined by the Internet