From: "Kevin Conaway" Subject: iptables + apache2 logging irregularity Date: Wed, 22 Jan 2003 22:21:10 -0500 Sender: netfilter-admin@lists.netfilter.org Message-ID: <005b01c2c28e$79f8faa0$0201a8c0@conaway.us> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0058_01C2C264.90D82E00" Return-path: Errors-To: netfilter-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Id: List-Unsubscribe: , List-Archive: To: netfilter@lists.netfilter.org This is a multi-part message in MIME format. ------=_NextPart_000_0058_01C2C264.90D82E00 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have one gateway machine with iptables 1.2.7a. It is has an external = ip address FW_EXT =3D 1.2.3.4 and an internal ip address FW_INT =3D = 2.3.4.5 I have a machine hiding behind this gateway running apache 2.0.43. It = has an internal ip address HTTP_INT =3D 4.5.6.7 Here is how I have my rules setup: -A FORWARD -p tcp -j ACCEPT -A PREROUTING -d FW_EXT -p tcp -m tcp --dport 80 -j DNAT = --to-destination HTTP_INT:80 -A POSTROUTING -d FW_EXT -p tcp -m tcp --dport 80 -j SNAT --to-source = FW_INT -A POSTROUTING -o eth0 -j MASQUERADE -A OUTPUT -d FW_EXT -p tcp -m tcp --dport 80 -j DNAT --to-destination = HTTP_INT I set this up just as described in the netfilter tutorial http://www.netfilter.org/documentation/tutorials/blueflux/iptables-tutori= al.html#AEN2601 If I leave it as is, everything works fine from hosts outside my network = and on the apache server, the log files indicate the correct source = address. I cannot however access the server from my internal network. If I add a rule like -A POSTROUTING -o eth1 -j SNAT --to-source FW_EXT I can then access the server from my internal network but in the apache = logs, it shows all requests as coming from FW_EXT. How can I fix this? Thank you, Kevin Conaway ------=_NextPart_000_0058_01C2C264.90D82E00 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I have one gateway machine with = iptables 1.2.7a. It=20 is has an external ip address FW_EXT =3D 1.2.3.4 and an internal ip = address FW_INT=20 =3D 2.3.4.5
I have a machine hiding behind this = gateway running=20 apache 2.0.43.  It has an internal ip address HTTP_INT =3D=20 4.5.6.7
 
Here is how I have my rules = setup:
 
-A FORWARD -p tcp -j = ACCEPT
-A PREROUTING -d FW_EXT -p tcp -m = tcp --dport=20 80 -j DNAT --to-destination HTTP_INT:80
-A POSTROUTING -d FW_EXT -p tcp -m = tcp --dport=20 80 -j SNAT --to-source FW_INT
-A POSTROUTING -o eth0 -j = MASQUERADE
 
-A OUTPUT -d FW_EXT -p tcp -m tcp = --dport 80=20 -j DNAT --to-destination HTTP_INT
 
I set this up just as described in the = netfilter=20 tutorial
http://www.netfilter.org/documentation/tutorials= /blueflux/iptables-tutorial.html#AEN2601
 
If I leave it as is, everything works = fine from=20 hosts outside my network and on the apache server, the log files = indicate the=20 correct source address.  I cannot however access the server from my = internal network.
 
If I add a rule like
-A POSTROUTING -o eth1 -j SNAT = --to-source=20 FW_EXT
 
I can then access the server from = my internal=20 network but in the apache logs, it shows all requests as coming from=20 FW_EXT.
 
How can I fix = this?
 
Thank you,
 
Kevin=20 Conaway
------=_NextPart_000_0058_01C2C264.90D82E00--