LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-23-2010, 03:59 AM   #1
kabuki
LQ Newbie
 
Registered: Aug 2010
Posts: 2

Rep: Reputation: 0
transparent proxy with squid and iptables won't log IPs from lan


Hi there,

i just finished setup a proxy machine that runs in a separate box from gw.

i have the following iptables rule

on squid box
Code:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
on gw
Code:
iptables -t nat -A PREROUTING -i eth1 -s ! 10.5.5.121 -p tcp --dport 80 -j DNAT --to 10.5.5.121:3128
iptables -t nat -A POSTROUTING -o eth1 -s 10.5.5.0/24 -d 10.5.5.121 -j SNAT --to 10.5.5.1
iptables -A FORWARD -s 10.5.5.0/24 -d 10.5.5.121 -i eth1 -o eth1 -p tcp --dport 3128 -j ACCEPT
everything appears to function right except the fact that all the logs in squid log appear as if they're coming from gw IP 10.5.5.1.


here's an example

Code:
1282549242.411  74219 10.5.5.1 TCP_MISS/200 285 GET http://stork33.dropbox.com/subscribe? - DIRECT/208.43.202.34 text/html
1282549316.634  74218 10.5.5.1 TCP_MISS/200 285 GET http://stork33.dropbox.com/subscribe? - DIRECT/208.43.202.34 text/html
1282549390.883  74244 10.5.5.1 TCP_MISS/200 285 GET http://stork33.dropbox.com/subscribe? - DIRECT/208.43.202.34 text/html
1282549465.092  74205 10.5.5.1 TCP_MISS/200 285 GET http://stork33.dropbox.com/subscribe? - DIRECT/208.43.202.34 text/html
my question is how can i modify the iptables rules so it will forward the real ip's where the requests are originated from.

thanks in advance.
 
Old 09-13-2010, 06:18 PM   #2
HasC
Member
 
Registered: Oct 2009
Location: South America - Paraguay
Distribution: Debian 5 - Slackware 13.1 - Arch - Some others linuxes/*BSDs through KVM and Xen
Posts: 329

Rep: Reputation: 55
Quote:
Originally Posted by kabuki View Post

everything appears to function right except the fact that all the logs in squid log appear as if they're coming from gw IP 10.5.5.1.

Code:
iptables -t nat -A POSTROUTING -o eth1 -s 10.5.5.0/24 -d 10.5.5.121 -j SNAT --to 10.5.5.1
you get that result because of that iptables rule. what do you need it for? for transparent proxying that PREROUTING and FORWARD rules would do just fine
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Squid transparent proxy with iptables cksoo Linux - Server 5 06-12-2008 04:53 AM
IPTABLES for squid (Transparent proxy) kool_kid Linux - Networking 14 10-29-2007 11:45 AM
IPTABLES, SQUID, DANSGUARDIAN and Transparent Proxy metallica1973 Linux - Networking 18 09-03-2007 08:17 PM
Question about transparent proxy + duplicate IPs: is it possible? aNt1X Linux - Networking 0 10-03-2006 04:18 AM
Squid with Transparent Proxy MarleyGPN Linux - Networking 1 08-28-2003 03:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration