In my OpenWrt box I have two internal networks,one for my LAN and other for the wifi guests. I have configured a proxy server, and to distribute the configuration to the clients, I did a little script to generate a proxy.pac file dependent on the client IP.
I have this in /www/cgi-bin/proxy.pac:
#!/bin/sh
mynetmask="255.255.255.0"
eval $(/bin/ipcalc.sh $REMOTE_ADDR $mynetmask)
if [ "$NETWORK" = "192.168.10.0" ]; then
proxy=""PROXY 192.168.10.1:3128; DIRECT""
else
proxy=""PROXY 192.168.11.1:3128; DIRECT""
fi
echo Content-Type: application/x-ns-proxy-autoconfig
echo ""
echo "function FindProxyForURL(url, host)
{
return $proxy;
}"
Make it executable, you can test it in command line passing the client IP:
# REMOTE_ADDR=192.168.10.100 sh -x /www/cgi-bin/proxy.pac
Finally, add the option 252 to the DHCP of the interfaces you want:
252,http://192.168.11.1/cgi-bin/proxy.pac