• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

Transparent proxy clients & nameservers


I have a working transparent proxy using squid and iptables. (RedHat 9.0)
If I put an ip address in the client web browser it works.
Names do not work so apparently the web browser cannot find the nameservers squid is using.

If I put the squid box in the web browser as a proxy it works with names.

How can I get this to work transparently with names???
0
Ted22
Asked:
Ted22
  • 4
  • 3
1 Solution
 
JivkoCommented:
On the router:
"Mark" packets of destination port 80 with value 2

router# iptables -A PREROUTING -i eth0 -t mangle -p tcp --dport 80 \
 -j MARK --set-mark 2
            

Setup iproute2 so it will route packets with "mark" 2 to squid-box

router# echo 202 www.out >> /etc/iproute2/rt_tables
router# ip rule add fwmark 2 table www.out
router# ip route add default via 10.0.0.2 dev eth0 table www.out
router# ip route flush cache
            
#stop ICMP redirects
naret# echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
naret# echo 0 > /proc/sys/net/ipv4/conf/default/send_redirects
naret# echo 0 > /proc/sys/net/ipv4/conf/eth0/send_redirects

http://www.lartc.org/lartc.html#LARTC.COOKBOOK.SQUID


On the squid box:
squid-box# iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

And finaly squid.conf:

httpd_accel_host virutal
httpd_accel_port 80
httpd_accel_uses_host_header on
httpd_accel_with_proxy on

Regards









0
 
Ted22Author Commented:
They don't let me configure the router and my squid box is configured correctly.

Does that mean I can't do this?
0
 
JivkoCommented:
So .... how did you made the proxy "transparent" if you can not touch the router ????
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Ted22Author Commented:
The router is on the other side of the squid box.
To make this sound stranger, the router is behind a firewall.
It's magic as far as I know.

The squid box gets it's address from a DHCP server.
The proxy is transparent as long as the squid box is the gateway on the client.
(It works with IP addresses, but not names.)








0
 
JivkoCommented:
1. Do you have working DNS? ( Check your resolv.conf on the squid box)
2.Did you put this:
squid-box# iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
at squid box?

3.Did you put this:
httpd_accel_host virutal
httpd_accel_port 80
httpd_accel_uses_host_header on
httpd_accel_with_proxy on

in your squid.conf

?

0
 
Ted22Author Commented:

I double checked all those things .

Maybe I have something in one of those files that's not supposed to be there.

0
 
Ted22Author Commented:
After looking at the Masquerade HOWTO it said that you must put the name server addresses on the client
if it won't find them. Why it would work sometimes and not others it didn't say. I'll accept one of your comments as an answer because everything you said was correct.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now