netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Redirect mirrored traffic to userspace app.
@ 2010-10-20 21:58 Mateus Caruccio
  2010-10-20 22:21 ` Jan Engelhardt
  2010-10-21 15:02 ` Grant Taylor
  0 siblings, 2 replies; 5+ messages in thread
From: Mateus Caruccio @ 2010-10-20 21:58 UTC (permalink / raw)
  To: netfilter

Hello everyone,

first of all, I'm not an iptables guru (that is why I'm here asking
you for help:)
Also, sorry for my poor english skills.

Well, at office we have 2 major environments: development and production.
In order to test our software in a more realistic condition, we'd like
to run it in production, but without affectig client application
traffic.

So, what I think is a nice solution is to setup a switch port mirror
to copy all traffic going to production server into our development server.

That's how our network topology looks like (simplified):


                        +-------------------+
+------+   [REQUEST]    |      SWITCH       |
|CLIENT|--------------->|PORT1  PORT2->PORT3|
+------+                +-------------------+
                                 |       |
+-----------------+   [REQUEST]  |       | [MIRRORED REQ]  +------------------+
|PROD_SRV:eth0/IP1|<-------------+       +---------------->|DEVEL_SRV:eth0/IP2|
+-----------------+                                        +------------------+

Thanks to this damn GUI world, probably this ascii-art is ruined. Here
is another one:

CLIENT (send req)
   |
   |
   V
 PORT1
SWITCH PORT2---->PROD_SRV:eth0/IP1 (recv req)
 PORT3
   |
   |
   V
DEVEL_SRV:eth0/IP2 (recv mirrored req)


All traffic is UDP port 2077 only. I can not change any config on PROD_SRV.

Our DEVEL_SRV should receive exactly the same packet PROD_SRV
receives, but with destination address modified
so it can reach our userspace application.

tcpdump shows that all requests are being properly mirrored from PORT2 to PORT3.
ifconfig eth0 on DEVEL_SRV does not present any increment on RX
statistics, but if I "ifconfig eth0 promisc", it starts to increment
RX.

I've tried to "DNAT" it, but without success:

 root@DEVEL_SRV# iptables -t nat -A PREROUTING -p udp --dport 2077 -j
DNAT --to-destination $IP2

From DEVEL_SRV point of view, it receives a legitime request.
I've setup a DROP rule so responses do not interfer on client's requests.

If I'm not clear, please fell free to ask anything.

Thanks for helping,

Mateus Caruccio


-- 
# ################ VOTE NULO ################
# Mateus de Oliveira Caruccio <mateus at caruccio dot com>
# Old programmers never die.  They just branch to another namespace

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

end of thread, other threads:[~2010-10-21 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 21:58 Redirect mirrored traffic to userspace app Mateus Caruccio
2010-10-20 22:21 ` Jan Engelhardt
2010-10-21  1:57   ` Mateus Caruccio
2010-10-21  5:45     ` Jan Engelhardt
2010-10-21 15:02 ` Grant Taylor

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).