All of lore.kernel.org
 help / color / mirror / Atom feed
* Transparent proxy where source IP address remains unchanged -- possible?
@ 2005-08-09  1:29 Adam Rosi-Kessel
  2005-08-11  5:42 ` Jan Engelhardt
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Rosi-Kessel @ 2005-08-09  1:29 UTC (permalink / raw)
  To: netfilter

I'm new to iptables and have perhaps a naive question.

I am wondering if there is a way to configure a proxy such that packets
are redirected to a new IP address, but the *source* IP address remains
unchanged.

To illustrate: let's say we have "userbox" 10.1.1.2, "faketarget"
10.1.1.3, and "realtarget" 10.1.1.4.

Userbox initiates an ssh connection to faketarget. Faketarget routes all
packets to realtarget.

I understand how to do this while changing the source IP address. I would
run these commands on faketarget:

iptables -t nat -A PREROUTING -i eth0 -s 10.1.1.2 -d 10.1.1.3 -p tcp --dport ssh -j DNAT --to 192.168.98.4 
iptables -t nat -A POSTROUTING -o eth0 -s 10.1.1.2 -d 10.1.1.3 -j SNAT --to 10.1.1.3

Easy enough. But in this case, the connection to realtarget appears to
come from faketarget, not userbox, the originator of the ssh connection.
This is normally what you want with local NAT.

But what if I want the connection to realtarget to appear to come from
userbox.  I want faketarget to be an almost invisible middleman.  I don't
want to rewrite the source IP address, but leave it as is.  If I just
leave off the second iptables line above, however, no packets are
forwarded to realtarget at all.

Is this possible?  Am I asking the wrong question?
-- 
Adam Rosi-Kessel
http://adam.rosi-kessel.org


^ permalink raw reply	[flat|nested] 18+ messages in thread
* Transparent proxy where source IP address remains unchanged -- possible?
@ 2005-08-10 15:22 Adam Rosi-Kessel
  2005-08-12 18:35 ` curby .
  0 siblings, 1 reply; 18+ messages in thread
From: Adam Rosi-Kessel @ 2005-08-10 15:22 UTC (permalink / raw)
  To: netfilter

I'm new to iptables and have perhaps a naive question.

I am wondering if there is a way to configure a proxy such that packets
are redirected to a new IP address, but the *source* IP address remains
unchanged.

To illustrate: let's say we have "userbox" 10.1.1.2, "faketarget"
10.1.1.3, and "realtarget" 10.1.1.4.

Userbox initiates an ssh connection to faketarget. Faketarget routes all
packets to realtarget.

I understand how to do this while changing the source IP address. I
would run these commands on the faketarget box:

iptables -t nat -A PREROUTING -i eth0 -s 10.1.1.2 -d 10.1.1.3 \
	-p tcp --dport ssh -j DNAT --to 192.168.98.4

iptables -t nat -A POSTROUTING -o eth0 -s 10.1.1.2 -d 10.1.1.3 \
	-j SNAT --to 10.1.1.3

Easy enough. But in this case, the connection to realtarget appears to
come from faketarget, not userbox, the originator of the ssh connection.
This is normally what you want with local NAT.

But what if I want the connection to realtarget to appear to come from
userbox.  I want faketarget to be an almost invisible middleman.  I
don't want to rewrite the source IP address, but leave it as is.  If I
just leave off the second iptables line above, however, no packets are
forwarded to realtarget at all.

Is this possible?  Am I asking the wrong question?
-- 
Adam Rosi-Kessel
http://adam.rosi-kessel.org



^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: Transparent proxy where source IP address remains unchanged -- possible?
@ 2005-08-12 15:21 Gielen, Casper
  0 siblings, 0 replies; 18+ messages in thread
From: Gielen, Casper @ 2005-08-12 15:21 UTC (permalink / raw)
  To: netfilter

> >Subject: Transparent proxy where source IP address remains unchanged --
> >    possible?
> 
> Check Balabit TPROXY. To retain the source address however, you need to patch 
> the application that initiates the second part. In your case, the sshd on 
> faketarget.

I used this today with squid, and I have to say it works great.
-- 
Casper


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

end of thread, other threads:[~2005-08-19  3:16 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-09  1:29 Transparent proxy where source IP address remains unchanged -- possible? Adam Rosi-Kessel
2005-08-11  5:42 ` Jan Engelhardt
2005-08-11 13:07   ` Adam Rosi-Kessel
2005-08-11 19:17     ` Jan Engelhardt
2005-08-11 20:47       ` Adam Rosi-Kessel
2005-08-12  5:02         ` Grant Taylor
2005-08-12 13:07           ` Adam Rosi-Kessel
2005-08-13  6:40             ` Grant Taylor
2005-08-13 13:12               ` Adam Rosi-Kessel
2005-08-15  6:51                 ` Grant Taylor
2005-08-15 14:33                   ` Adam Rosi-Kessel
2005-08-15 14:39                     ` Taylor, Grant
2005-08-17 21:07     ` Ray Van Dolson
2005-08-19  3:16       ` Adam Rosi-Kessel
  -- strict thread matches above, loose matches on Subject: below --
2005-08-10 15:22 Adam Rosi-Kessel
2005-08-12 18:35 ` curby .
2005-08-12 18:52   ` Adam Rosi-Kessel
2005-08-12 15:21 Gielen, Casper

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.