Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have set up an application that listens constantly to a port for network packets, and I would like to create another one that receives the same network packets ( for use as a test bed). Getting the packets sent to 2 different ports on the machine is not an option, so I was wondering if there is a way to set up a "port-mirror". Basically, is there an easy way to make all traffic received on port XXXXX also copy to port XXXXX + 1?

I know there is a similar question here, but I don't quite understand the suggested solution.

Barring that, is there another easy way to simulate network data to test some code with that I am overlooking?

share|improve this question

closed as unclear what you're asking by Braiam, Anthon, Ramesh, slm Nov 10 at 16:47

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
Have you read Send duplicate packets over two Internet connections and Copying packets from an interface to another ? It won't get easier than typing a few iptables commands. What is your kernel version? –  Gilles Mar 7 '12 at 0:00
    
According to uname -rs, I'm on 2.6.32. –  SuperTron Mar 7 '12 at 20:23
1  
Ok then, have you tried the xtables addon? If you have and ran into problems, tell us how far you got, copy-paste your configuration files and the commands you ran and any error message you got. –  Gilles Mar 7 '12 at 21:02
1  
fclose.com/816/port-forwarding-using-iptables your are looking for port forwarding and not mirroring. I bet your question has dozens of duplicate on unix SO and power user –  Kiwy Jan 13 at 10:41
1  
Have you considered port sniffing? And later maybe tcpreplay? It would not be real-time mirroring though. –  LatinSuD Jun 24 at 10:17

1 Answer 1

You might take a look at nc(1), a network swiss army knife of sorts.

share|improve this answer
3  
How would you manage to get nc duplicate packets? –  lgeorget May 10 '13 at 19:09
1  
It wouldn't. This answer is a red herring. –  Catskul Nov 5 '13 at 23:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.