netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Redirect question
@ 2014-03-22 13:38 Danny
  2014-03-22 22:32 ` Nikolai Lusan
  0 siblings, 1 reply; 10+ messages in thread
From: Danny @ 2014-03-22 13:38 UTC (permalink / raw)
  To: netfilter

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

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Redirect Question
@ 2005-03-04 22:59 Gary W. Smith
  2005-03-04 23:05 ` Gavin Hamill
  0 siblings, 1 reply; 10+ messages in thread
From: Gary W. Smith @ 2005-03-04 22:59 UTC (permalink / raw)
  To: netfilter

We have a client moving offices and will need to migrate their DNS (and some of their DNS entries) over at some point in time.  But for a variety of reasons we cannot do that.  They have 16 IP's at their current location and will get another 16 at their new location.
 
What we would like to do is to have the firewall rewrite or redirect all traffic coming in on two IP's and redirect them to two destination IP's on the new firewall.
 
i.e. they have 205.34.43.1/28 and 206.32.43.1/28.  We want all traffic that is currently destined for 205.34.43.2 to go to 206.32.43.2.  These are not at the same location.
 
What is the easiest way to accomplish this?  both locations are running RHEL3 and a fairly basic configuration with iptables.
 
Gary Wayne Smith

^ permalink raw reply	[flat|nested] 10+ messages in thread
* RE: REDIRECT question
@ 2003-07-13 21:55 George Vieira
  0 siblings, 0 replies; 10+ messages in thread
From: George Vieira @ 2003-07-13 21:55 UTC (permalink / raw)
  To: Ruslan Spivak, netfilter

PREROUTING only works for real packets being received from the network and not locally generated packets (localhost). So with localhost, the packets do not leave the wire and come back for PREROUTING to work, I think only INPUT/FORWARD/OUTPUT will receive these localhost packets.

Thanks,
____________________________________________
George Vieira
Systems Manager
georgev@citadelcomputer.com.au

Citadel Computer Systems Pty Ltd
http://www.citadelcomputer.com.au

Phone   : +61 2 9955 2644
HelpDesk: +61 2 9955 2698
 

-----Original Message-----
From: Ruslan Spivak [mailto:alienoid@is.lg.ua]
Sent: Friday, July 11, 2003 9:09 PM
To: netfilter@lists.netfilter.org
Subject: REDIRECT question


Hello!

Can you help me with the following:

i try to make REDIRECT on my local host -

$IPTABLES -t nat -N REDIRECT_CHAIN
$IPTABLES -t nat -A REDIRECT_CHAIN -p tcp --dport 80 -j REDIRECT 
--to-port 7080
$IPTABLES -t nat -A PREROUTING -j REDIRECT_CHAIN

When users in my LAN connect to my host's 80 port they are redirected to 
7080 - it's ok. But when i try to do on my host - telnet localhost 80 - 
i get connection refused (looks like redirection doesn't work). What 
maybe the problem?

Best regards,
Ruslan





^ permalink raw reply	[flat|nested] 10+ messages in thread
* REDIRECT question
@ 2003-07-11 11:09 Ruslan Spivak
  0 siblings, 0 replies; 10+ messages in thread
From: Ruslan Spivak @ 2003-07-11 11:09 UTC (permalink / raw)
  To: netfilter

Hello!

Can you help me with the following:

i try to make REDIRECT on my local host -

$IPTABLES -t nat -N REDIRECT_CHAIN
$IPTABLES -t nat -A REDIRECT_CHAIN -p tcp --dport 80 -j REDIRECT 
--to-port 7080
$IPTABLES -t nat -A PREROUTING -j REDIRECT_CHAIN

When users in my LAN connect to my host's 80 port they are redirected to 
7080 - it's ok. But when i try to do on my host - telnet localhost 80 - 
i get connection refused (looks like redirection doesn't work). What 
maybe the problem?

Best regards,
Ruslan




^ permalink raw reply	[flat|nested] 10+ messages in thread
* REDIRECT question
@ 2003-07-02 10:56 Ruslan Spivak
  2003-07-02 11:01 ` Chris Wilson
  0 siblings, 1 reply; 10+ messages in thread
From: Ruslan Spivak @ 2003-07-02 10:56 UTC (permalink / raw)
  To: netfilter

Hello, netfilter users.

i want make transaparent proxy on localhost and want to disabe access 
after redirecting to port 3128 if destination address in net other then 
193.108.240.0/22.
Does REDIRECT target send packet to INPUT chain and i should disable 
access in INPUT chain or should i disable access in '-t nat -A 
POSTROUTING' chain?

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT 
--to-port 3128


Thanks in advance. Your help is very, very appreciated.

Best regards,
Ruslan




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-03-22 22:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.44.0307021216100.16552-100000@localhost>
2003-07-02 13:13 ` REDIRECT question Ruslan Spivak
2014-03-22 13:38 Redirect question Danny
2014-03-22 22:32 ` 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
2003-07-02 10:56 Ruslan Spivak
2003-07-02 11:01 ` Chris Wilson
2003-07-02 11:14   ` Ruslan Spivak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).