Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Joshua N Pritikin <jpritikin@pobox.com>
To: netfilter@lists.netfilter.org
Subject: Re: FAQ 3.13, but on the same box
Date: Tue, 20 Jul 2004 19:12:19 +0530	[thread overview]
Message-ID: <20040720134219.GK676@always.joy.eth.net> (raw)
In-Reply-To: <200407191056.54823.Antony@Soft-Solutions.co.uk>

[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]

On Mon, Jul 19, 2004 at 10:56:54AM +0100, Antony Stone wrote:
> On Monday 19 July 2004 10:44 am, Joshua N Pritikin wrote:
> > I am trying to do Squid + Netfilter + BROWSER on the same machine.
> 
> Oh, right - I hadn't appreciated that part before.   I thought you just meant 
> transparent proxying to a proxy on the gateway instead of to a proxy 
> somewhere else.
> 
> In that case you either need to DNAT your OUTPUT packets, as per your previous 
> posting,

This solution seems to work (below).  I wonder if this should be added
to the various FAQs?  ;-)

#!/bin/sh

iptables -t nat -F  # clear table

# normal transparent proxy
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -j REDIRECT --to-port 8080

# handle connections on the same box (192.168.0.2 is a loopback instance)
gid=`id -g proxy`
iptables -t nat -A OUTPUT -p tcp --dport 80 -m owner --gid-owner $gid -j ACCEPT
iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination 192.168.0.2:8080

-- 
A new cognitive theory of emotion, http://openheartlogic.org

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-07-20 13:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-18 17:32 FAQ 3.13, but on the same box Joshua N Pritikin
2004-07-18 17:44 ` Antony Stone
2004-07-19  2:00   ` Joshua N Pritikin
2004-07-19  8:51     ` Antony Stone
2004-07-19  9:44       ` Joshua N Pritikin
2004-07-19  9:56         ` Antony Stone
2004-07-20 13:42           ` Joshua N Pritikin [this message]
2004-07-20 13:55             ` Antony Stone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040720134219.GK676@always.joy.eth.net \
    --to=jpritikin@pobox.com \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox