Routing lan http trafic to lan proxy server

Report wireless and/or network connectivity problems in this forum.

Moderator: Moderators

Post Reply
User avatar
powerlogy
Posts: 67
Joined: Wed Aug 22, 2012 12:04 pm
Location: Turkey

Routing lan http trafic to lan proxy server

Post 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.

User avatar
powerlogy
Posts: 67
Joined: Wed Aug 22, 2012 12:04 pm
Location: Turkey

Re: Routing lan http trafic to lan proxy server

Post 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.

phonoflux
Posts: 1
Joined: Wed Jun 08, 2011 4:39 pm

Re: Routing lan http trafic to lan proxy server

Post 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!

Post Reply