[tproxy] socket match can't work with DNAT rules
hi2arun at gmail.com
Tue Dec 16 06:16:19 CET 2008
Balazs comment 1:
"You cannot use DNAT and tproxy on the same connection. What do you want
This is a common scenario. Say you have an intermediate compression
agent/tunneling agent between the tproxy server and the web server as shown
Client <--------> tproxy server <---------> compression/tunneling agent1
<=============> compression/tunneling agent2 <------------------> web server
In this case, the output from the tproxy server has to be DNATted or policy
routed to the compression/tunneling agent. Policy routing is possible if the
compression/tunneling agent lies outside the box. In case, if it runs as
another process along with the tproxy server, DNAT is the only option,
Balazs comment 2:
"If you want to change the target address of the server side connection,
why don't you DNAT the server connection? That should work."
Not able to understand what you exactly mean by "DNAT the server
If my understanding is correct, Tproxy association is only for the socket
created between client and the tproxy server. If that is the case, why does
socket match failure happen for the socket created between tproxy server and
2008/12/3 Balazs Scheidler <bazsi at balabit.hu>
> On Wed, 2008-12-03 at 21:55 +0800, Dong Wei wrote:
> > Hi, all
> > I use the latest tproxy kernel.But I find that, tproxy can't work
> > with DNAT mode.
> > network topology:
> > Web Server(192.168.1.10)----(192.168.1.1)TPROXY
> > Server(22.214.171.124)---(126.96.36.199)Client
> > For TPROXY Server
> > eth0 192.168.1.1
> > eth1 188.8.131.52
> > When Client visit TPROXY Server(184.108.40.206) 80 port, we will redirect
> > it to Web Server.
> > There is a DNAT rule for it.
> > iptables -t nat -i eth1 -d 220.127.116.11 -p tcp --dport 80 -j DNAT
> > --to-destination 192.168.1.10
> > tproxy APP listen on port 50080, and the TPROXY target also set
> > --on-port 50080 for HTTP.
> > Here is the problem:
> > 1. Client send SYN to 18.104.22.168:80
> > 2. TPROXY Server receive it, and TPROXY target will redirect this packet
> > to the socket which is listening on port 50080
> > 3. TPROXY Server send SYN,ACK to the Client
> > 4. Client receive SYN,ACK and send ACK
> > 5. TPROXY Server receive ACK, TPROXY target will redirect this packet to
> > socket listening on port 50080
> > 6. With DNAT rule, the established socket is 22.214.171.124:port ->
> > 7. Client send "GET " request to TPROXY Server
> > 8. socket match find this packet doesn't match any socket. For its
> > sip, sport, dip,dport
> > is 126.96.36.199:port -> 188.8.131.52:80, while the established socket is
> > 184.108.40.206:port -> 192.168.1.10:80
> > So in this case, match can't work correctly for DNAT rules. Anyone has
> > good ideas?
> You cannot use DNAT and tproxy on the same connection. What do you want
> to achieve?
> If you want to change the target address of the server side connection,
> why don't you DNAT the server connection? That should work.
> tproxy mailing list
> tproxy at lists.balabit.hu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the tproxy