Page 1 of 1

Routing lan http trafic to lan proxy server

Posted: Fri Nov 08, 2013 5:44 pm
by powerlogy
Hello any help would be good guys, i'm stuck at somewhere with iptables.i have squid server on my lan and i want to route all http trafic to it but squid isn't running on router.

So setup is like this;

Router: 192.168.1.1
Lan:192.168.1.0/24
Squid-server: 192.168.1.3
Squid-port:3128

i made a firewall.user rule to prerouter http traffic to squid but i have problems with it.

Code: Select all

iptables -t nat -A POSTROUTING -p tcp -m iprange --src-range 192.168.1.5-192.168.1.254 --dport 80 -j DNAT --to-destination 192.168.1.3:3128

With this code, routing doesn't work.
If i add this line to it, routing to squid works but squid gives invalid url messages.

Code: Select all

iptables -t nat -A PREROUTING -j MASQUERADE


So how i can work this without any error ? I searched the web but didn't get solution for it, openwrt wiki seems got old about this.

Re: Routing lan http trafic to lan proxy server

Posted: Fri Nov 08, 2013 6:19 pm
by powerlogy
Anyway i found my problem.It was squid's transparent option, i forgot to add it in squid.conf.

So i changed it to

Code: Select all

http_port 192.168.1.3:3128 transparent


Now, it works.Hope it helps someone.

Re: Routing lan http trafic to lan proxy server

Posted: Sat Nov 16, 2013 10:11 pm
by phonoflux
Heya

Have been trying to get this working for the last few days, much to the annoyance of my flatmates.

I've tried this method and various other suggested methods online and can't get it working with various proxy servers and squid in various configurations using transparent, inspect, normal, etc.

gargoyle version: 1.5.10
router ip: 192.168.1.254
squid:192.168.1.229

currently squid is listening on 3 ports:
3128
3127 intercept
3126 transparent

default gateway of clients on the network is the router and i'm wanting to push port 80 to squid.

Any help is much appreciated!