Hi,<br><br>Balazs comment 1:<br>&quot;You cannot use DNAT and tproxy on the same connection. What do you want<br>
to achieve?&quot;<br><br>This is a common scenario. Say you have an intermediate compression agent/tunneling agent between the tproxy server and the web server as shown below:<br><br>Client &lt;--------&gt; tproxy server &lt;---------&gt; compression/tunneling agent1 &lt;=============&gt; compression/tunneling agent2 &lt;------------------&gt; web server<br>
<br>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, AFAIK.<br>

<br>Balazs comment 2:<br>&quot;If you want to change the target address of the server side connection,<br>
why don&#39;t you DNAT the server connection? That should work.&quot;<br><br>Not able to understand what you exactly mean by &quot;DNAT the server connection&quot;.<br><br>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 DNAT server?<br>
<br>Regards,<br>Arun S.<br><br><br><div class="gmail_quote">2008/12/3 Balazs Scheidler <span dir="ltr">&lt;<a href="mailto:bazsi@balabit.hu">bazsi@balabit.hu</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Wed, 2008-12-03 at 21:55 +0800, Dong Wei wrote:<br>
&gt; Hi, all<br>
&gt;<br>
&gt; &nbsp; &nbsp;I use the latest tproxy kernel.But I find that, tproxy can&#39;t work<br>
&gt; with DNAT mode.<br>
&gt;<br>
&gt; network topology:<br>
&gt;<br>
&gt; Web Server(192.168.1.10)----(192.168.1.1)TPROXY<br>
&gt; Server(202.0.0.1)---(202.0.0.10)Client<br>
&gt;<br>
&gt; For TPROXY Server<br>
&gt; eth0 192.168.1.1<br>
&gt; eth1 202.0.0.1<br>
&gt; When Client visit TPROXY Server(202.0.0.1) 80 port, we will redirect<br>
&gt; it to Web Server.<br>
&gt; There is a DNAT rule for it.<br>
&gt;<br>
&gt; iptables -t nat -i eth1 -d 202.0.0.1 -p tcp --dport 80 -j DNAT<br>
&gt; --to-destination 192.168.1.10<br>
&gt;<br>
&gt; tproxy APP listen on port 50080, and the TPROXY target also set<br>
&gt; --on-port 50080 for HTTP.<br>
&gt; Here is the problem:<br>
&gt; 1. Client send SYN to <a href="http://202.0.0.1:80" target="_blank">202.0.0.1:80</a><br>
&gt; 2. TPROXY Server receive it, and TPROXY target will redirect this packet<br>
&gt; &nbsp; &nbsp;to the socket which is listening on port 50080<br>
&gt; 3. TPROXY Server send SYN,ACK to the Client<br>
&gt; 4. Client receive SYN,ACK and send ACK<br>
&gt; 5. TPROXY Server receive ACK, TPROXY target will redirect this packet to the<br>
&gt; &nbsp; &nbsp;socket listening on port 50080<br>
&gt; 6. With DNAT rule, the established socket is 202.0.0.10:port -&gt; <a href="http://192.168.1.10:80" target="_blank">192.168.1.10:80</a><br>
&gt; 7. Client send &quot;GET &quot; request to TPROXY Server<br>
&gt; 8. socket match find this packet doesn&#39;t match any socket. For its<br>
&gt; sip, sport, dip,dport<br>
&gt; &nbsp; &nbsp;is 202.0.0.10:port -&gt; <a href="http://202.0.0.1:80" target="_blank">202.0.0.1:80</a>, while the established socket is<br>
&gt; &nbsp; 202.0.0.10:port -&gt; <a href="http://192.168.1.10:80" target="_blank">192.168.1.10:80</a><br>
&gt;<br>
&gt; So in this case, match can&#39;t work correctly for DNAT rules. Anyone has<br>
&gt; good ideas?<br>
<br>
</div></div>You cannot use DNAT and tproxy on the same connection. What do you want<br>
to achieve?<br>
<br>
If you want to change the target address of the server side connection,<br>
why don&#39;t you DNAT the server connection? That should work.<br>
<font color="#888888"><br>
--<br>
Bazsi<br>
</font><div><div></div><div class="Wj3C7c"><br>
<br>
_______________________________________________<br>
tproxy mailing list<br>
<a href="mailto:tproxy@lists.balabit.hu">tproxy@lists.balabit.hu</a><br>
<a href="https://lists.balabit.hu/mailman/listinfo/tproxy" target="_blank">https://lists.balabit.hu/mailman/listinfo/tproxy</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Arun S.<br>