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???
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

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


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?
So .... how did you made the proxy "transparent" if you can not touch the router ????

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

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

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


Ted22Author Commented:

I double checked all those things .

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

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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.