All of lore.kernel.org
 help / color / mirror / Atom feed
From: Danny <dannydebont@gmail.com>
To: netfilter@vger.kernel.org
Subject: Redirect question
Date: Sat, 22 Mar 2014 15:38:02 +0200	[thread overview]
Message-ID: <20140322133802.GA5012@fever.havannah.local> (raw)

Good day,

My setup is:

     wlan0 ----> br0 -----> eth0 =====> router
     internal    internal   internal
     10.0.0.5    10.0.0.4   10.0.0.3    10.0.0.2
     (apache:80)
     (squid:3128)
     (iptables)

I am running Debian 7 with a few servers on it. Everything is fine. Squid is
fine if I configure browsers to use the proxy 10.0.0.5:3128.

However, all internal clients can still connect to the internet if I do not tell
them to go through the proxy.

I have a simple iptables setup:

####################################################################################
# Generated by iptables-save v1.4.14 on Sat Mar  22 16:28:57 2014
*nat
:PREROUTING ACCEPT [76:4907]
:INPUT ACCEPT [24:1899]
:OUTPUT ACCEPT [117:9446]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -j MASQUERADE
COMMIT
# Completed on Mon Mar  3 16:28:57 2014
# Generated by iptables-save v1.4.14 on Mon Mar  3 16:28:57 2014
*filter
:INPUT ACCEPT [462:67612]
:FORWARD ACCEPT [112:5720]
:OUTPUT ACCEPT [354:42889]
-A FORWARD -s 10.0.0.0/24 -i eth0 -o wlan0 -m conntrack --ctstate NEW -j ACCEPT
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
COMMIT
# Completed on Sat Mar  22 16:28:57 2014
####################################################################################

How would I go about routing all the local clients to squid's port 3128?

I have tried the following, but it doesn't work

-t nat -A OUTPUT -p tcp --dport 80 -m owner --uid-owner squid -j ACCEPT
-t nat -A OUTPUT -p tcp --dport 3128 -m owner --uid-owner squid -j ACCEPT
-t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 3128

Thank You

Danny

             reply	other threads:[~2014-03-22 13:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-22 13:38 Danny [this message]
2014-03-22 22:32 ` Redirect question Nikolai Lusan
  -- strict thread matches above, loose matches on Subject: below --
2005-03-04 22:59 Redirect Question Gary W. Smith
2005-03-04 23:05 ` Gavin Hamill
2003-07-13 21:55 REDIRECT question George Vieira
2003-07-11 11:09 Ruslan Spivak
     [not found] <Pine.LNX.4.44.0307021216100.16552-100000@localhost>
2003-07-02 13:13 ` Ruslan Spivak
2003-07-02 10:56 Ruslan Spivak
2003-07-02 11:01 ` Chris Wilson
2003-07-02 11:14   ` Ruslan Spivak

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=20140322133802.GA5012@fever.havannah.local \
    --to=dannydebont@gmail.com \
    --cc=netfilter@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.