Dual WAN PCC + Squid Transparent Proxy + Hotspot

Hello everyone!

I am new to mikrotik but I am amazed with what it can do. I am running a Community Hotspot and using Mikrotik Router.
My current setup is this:

RBHAP-Lite (for Dual WAN PCC) + RB951G-2Hnd (for HotSpot users)

WAN1 is 2.5 Mbps down and 600kbps Up
WAN2 is 10Mbps download and 300 kbps upload

The bandwidth I allocate per user is 350kbps download and 250kbps upload maximum of 10 concurrent users but I have 15 registered users in the community.

What I am thinking is to insert Squid transparent proxy server somewhere within the network. I have a spare netbook with 1 GLan and I’m thinking of getting two more usb Lan or a mini pcie lan. I can install Ubuntu in the netbook and run the Squid proxy there.

The problem is I have no Idea how to connect the Dquid Proxy in the network and how to configure the scripts on my two Mikrotik routers.

Maybe you can share your thoughts and I would appreciate if you can help me make this project work.

The scripts that I am Currently using for Mikrotik HAPLite is:

/ip pool
add name=dhcp_pool1 ranges=192.168.9.2-192.168.9.254

/ip dhcp-server
add address-pool=dhcp_pool1 disabled=no interface=Local name=dhcp1

/ip address
add address=192.168.1.2/24 interface=WAN1
add address=192.168.2.2/24 interface=WAN2
add address=192.168.9.1/24 interface=Local

/ip dhcp-server network
add address=192.168.9.0/24 gateway=192.168.9.1

/ip dns
set allow-remote-requests=yes cache-size=5000KiB max-udp-packet-size=2048 servers=8.8.8.8,8.8.4.4

/ip firewall mangle
add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn
add action=mark-routing chain=output connection-mark=WAN1_conn new-routing-mark=to_WAN1
add action=mark-routing chain=output connection-mark=WAN2_conn new-routing-mark=to_WAN2
add chain=prerouting dst-address=192.168.1.0/24 in-interface=Local
add chain=prerouting dst-address=192.168.2.0/24 in-interface=Local
add action=mark-connection chain=prerouting dst-address-type=!local hotspot=auth in-interface=Local new-connection-mark=WAN1_conn per-connection-classifier=both-addresses-and-ports:3/0
add action=mark-connection chain=prerouting dst-address-type=!local hotspot=auth in-interface=Local new-connection-mark=WAN2_conn per-connection-classifier=both-addresses-and-ports:3/1
add action=mark-connection chain=prerouting dst-address-type=!local hotspot=auth in-interface=Local new-connection-mark=WAN1_conn per-connection-classifier=both-addresses-and-ports:3/2
add action=mark-routing chain=prerouting connection-mark=WAN1_conn in-interface=Local new-routing-mark=to_WAN1
add action=mark-routing chain=prerouting connection-mark=WAN2_conn in-interface=Local new-routing-mark=to_WAN2

/ip firewall nat
add action=masquerade chain=srcnat out-interface=WAN1
add action=masquerade chain=srcnat out-interface=WAN2

/ip route
add check-gateway=ping distance=1 gateway=192.168.1.1 routing-mark=to_WAN1
add check-gateway=ping distance=1 gateway=192.168.2.1 routing-mark=to_WAN2
add check-gateway=ping distance=1 gateway=192.168.1.1
add check-gateway=ping distance=2 gateway=192.168.2.1

Please help :slight_smile: Thank you.

In general, installation of HTTP-intercepting squid is simple in any standard LINUX environment, as it only needs an iptables-rule to REDirect http-traffic to squid on same machine. In case, squid runs on another PC (NOT the one with the iptables-rule) it is more difficult.
So, in your case, having 2 WAN-conns, it will need the “more difficult” solution.
Unless, you move the load balancing for the WANs to the new PC.

As you are using MT, you need to integrate the standard LINUX rules for interception from
http://wiki.squid-cache.org/ConfigExamples/Intercept/IptablesPolicyRoute

Thank you for your reply. I guess I’ll just stay with my current setup and will experiment later on.

The only thing I can think of running dual wan + transparent squid is pfsense, and then i’ll use mikrotik for hotspot users.
Do you think that way I can avoid the “difficult solution” ?

Don’t know pfsense in detail. However, you might also install the squid-box (or pfsense ?) inbetween the MTs.
Then you can use the easy solution for your hotspot users, at least.
squid-box could be old/simple ubuntu-PC (or your netbook) , with lot of RAM (fastest cache :slight_smile: and (fast) HDD, 2 NICs.