Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Here is a problem I'm trying to solve for hours, with no luck:
My debian host has a single ethernet card and is configured with 3 virtual interfaces, each with it's own IP address, let's say a.a.a.a, b.b.b.b, and c.c.c.c
A squid server is proxying http requests for authenticated users. Squid is configured to listen to all interfaces, not bound to any single one.
What I need to do is make the squid http requests originate from the *same* IP address that the client request comes in. For example if a client uses a.a.a.a:3128 to make a request to the proxy, squid will use a.a.a.a in its corresponding http request. If another client request comes in b.b.b.b:3128, squid will use b.b.b.b for it's http request.
In other words, I need the source IP of the squid http requests leaving my box to be the same as the destination IP of the client requests that come in.
I haven't found any way to do this with squid itself, so I tried in vain to implement it in iptables by trying to MARK/SNAT traffic. As it seems, squid http requests are not RELATED to the client requests to squid, so there is no way to do this with usual connection tracking. Is there any other way?
Thanks for any help!
For example if a client uses a.a.a.a:3128 to make a request to the proxy, squid will use a.a.a.a in its corresponding http request. If another client request comes in b.b.b.b:3128, squid will use b.b.b.b for it's http request.
I'm not an HTTP expert, but I think when you say "http request" in this context, you really mean the response + message body that is returned by the remote web server, right?
Also, is your squid host providing NAT to your client networks or not?
Thank you for your reply anomie. Sorry for not being very clear.
It also turns out I should have RTFMed better before asking for help! I found that squid is perfectly capable of providing what I wanted. I just added these to my squid.conf file, and it worked:
Again, what I wanted was that squid would use the same IP address to make any requests to remote servers that the client uses in his requests.
For example if a client makes a request to squid on IP a.a.a.a, squid will use the same IP to connect to the remote server.
For the reference, the OS is Debian 5.0.3 (stable), Squid is 2.7
One last question though: how can I, in addition to the above, demand that the clients are authenticated? I mean something similar to:
acl auth proxy_auth REQUIRED
Is it possible to "chain" acl statements? Sorry, I'm a complete squid noob at the moment!
Replying to myself, the http_access statement above is of course wrong, and incidentally the answer to my second question. The correct configuration is:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.