Networking Forums

Networking Forums > Computer Networking > Linux Networking > Port Mirroring in Linux

Reply
Thread Tools Display Modes

Port Mirroring in Linux

 
 
jeniffer
Guest
Posts: n/a

 
      10-30-2007, 08:23 AM
Hi

I have to implement port mirroring feature in linux.ie All inbound-
outbound packets of a particular interface are mirrored to another
interface. I need to implement it in both the bridging and routing
paths.Is there any utility in linux which helps to do this?

Please help!


Thanks,
Jeniffer.

 
Reply With Quote
 
 
 
 
david
Guest
Posts: n/a

 
      10-30-2007, 08:50 AM
On Tue, 30 Oct 2007 09:23:52 +0000, jeniffer rearranged some electrons to
say:

> Hi
>
> I have to implement port mirroring feature in linux.ie All inbound-
> outbound packets of a particular interface are mirrored to another
> interface. I need to implement it in both the bridging and routing
> paths.Is there any utility in linux which helps to do this?
>
> Please help!
>
>
> Thanks,
> Jeniffer.


Are you trying to set up a bridge?
http://www.tldp.org/HOWTO/Bridge/index.html

PS Good luck on your homework....
 
Reply With Quote
 
jeniffer
Guest
Posts: n/a

 
      10-30-2007, 11:07 AM
On Oct 30, 2:50 pm, david <n...@nospam.com> wrote:
> On Tue, 30 Oct 2007 09:23:52 +0000, jeniffer rearranged some electrons to
> say:
>
> > Hi

>
> > I have to implement port mirroring feature in linux.ie All inbound-
> > outbound packets of a particular interface are mirrored to another
> > interface. I need to implement it in both the bridging and routing
> > paths.Is there any utility in linux which helps to do this?

>
> > Please help!

>
> > Thanks,
> > Jeniffer.

>
> Are you trying to set up a bridge?http://www.tldp.org/HOWTO/Bridge/index.html
>
> PS Good luck on your homework....


thanks for the reply but No, I dont have to set up a bridge.A bridge
looks at its table's entry and says that packets with the mac 'Mi'
must be forwarding to interface X.Bridge does flooding,learning and
forwarding.
I need a behavior where I say that all packets coming and going on an
interface X must be given to another interface Y.




 
Reply With Quote
 
आशीष Ashish
Guest
Posts: n/a

 
      10-30-2007, 11:56 AM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jeniffer wrote:

> thanks for the reply but No, I dont have to set up a bridge.A bridge
> looks at its table's entry and says that packets with the mac 'Mi'
> must be forwarding to interface X.Bridge does flooding,learning and
> forwarding.
> I need a behavior where I say that all packets coming and going on an
> interface X must be given to another interface Y.


You mean having something like an interface "eth1" which has all the
traffic "eth0" has. So if you wanted to sniff activity on "eth0", you can
simply sniff on "eth1", right...

- --
Ashish Shukla
http://wahjava.wordpress.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHJynoHy+EEHYuXnQRAkZGAKCbZ3spzOVrNFzipNn+Sl ieWrbvVACgrvQM
3tmI9T5iZgcIMG6Lp6/1Zg8=
=/rJJ
-----END PGP SIGNATURE-----
 
Reply With Quote
 
David Schwartz
Guest
Posts: n/a

 
      10-31-2007, 12:15 AM
On Oct 30, 5:07 am, jeniffer <zenith.of.perfect...@gmail.com> wrote:

> thanks for the reply but No, I dont have to set up a bridge.A bridge
> looks at its table's entry and says that packets with the mac 'Mi'
> must be forwarding to interface X.Bridge does flooding,learning and
> forwarding.


Right.

> I need a behavior where I say that all packets coming and going on an
> interface X must be given to another interface Y.


That's what a bridge does. As you said above, it looks at its table's
entry and decides which interfaces to forward a packet to.

You are saying:

1) A bridge takes a packet and forwards it onto the appropriate
interfaces.

2) I want to take packets and forward them to appropriate interfaces.

3) I don't want a bridge.

You do realize that bridges frequently send the same packet to more
than one destination. Consider the obvious case where the bridge has
never seen a packet with that destination MAC before. Consider an ARP
request.

What you want is what bridges do.

DS

 
Reply With Quote
 
Pascal Hambourg
Guest
Posts: n/a

 
      10-31-2007, 08:41 AM
Hello,

David Schwartz a écrit :
> On Oct 30, 5:07 am, jeniffer <zenith.of.perfect...@gmail.com> wrote:
>
>>I need a behavior where I say that all packets coming and going on an
>>interface X must be given to another interface Y.

>
> That's what a bridge does. As you said above, it looks at its table's
> entry and decides which interfaces to forward a packet to.
>
> You are saying:
>
> 1) A bridge takes a packet and forwards it onto the appropriate
> interfaces.
>
> 2) I want to take packets and forward them to appropriate interfaces.


But I'm afraid that the OP and a bridge have a slightly different idea
of what "appropriate interfaces" is. To a bridge, it is interfaces that
have seen incoming traffic from the destination MAC address, or all
interfaces if the destination is unknown or broadcast (I skip the
multicast case). To the OP, it is the same *plus* the mirroring interface.

> 3) I don't want a bridge.
>
> You do realize that bridges frequently send the same packet to more
> than one destination. Consider the obvious case where the bridge has
> never seen a packet with that destination MAC before. Consider an ARP
> request.
>
> What you want is what bridges do.


I do not think that the vanilla Linux bridge code can do what the OP
wants. I guess it could if learning could be disabled, so the bridge
floods all traffic on all interfaces.
 
Reply With Quote
 
David Schwartz
Guest
Posts: n/a

 
      10-31-2007, 02:42 PM
On Oct 31, 2:41 am, Pascal Hambourg <boite-a-s...@plouf.fr.eu.org>
wrote:

> But I'm afraid that the OP and a bridge have a slightly different idea
> of what "appropriate interfaces" is. To a bridge, it is interfaces that
> have seen incoming traffic from the destination MAC address, or all
> interfaces if the destination is unknown or broadcast (I skip the
> multicast case). To the OP, it is the same *plus* the mirroring interface.


A bridge does whatever it's configured to do.

> > What you want is what bridges do.


> I do not think that the vanilla Linux bridge code can do what the OP
> wants. I guess it could if learning could be disabled, so the bridge
> floods all traffic on all interfaces.


Simply disabling learning will do exactly what the OP wants.

DS

 
Reply With Quote
 
Pascal Hambourg
Guest
Posts: n/a

 
      10-31-2007, 04:05 PM
David Schwartz a écrit :
>
> A bridge does whatever it's configured to do.


Within the limits of its configuration options and what it is able to do.

> Simply disabling learning will do exactly what the OP wants.


Not exactly. As far as I can see from a quick test, setting the bridge
ageing time to zero (brctl setageingtime <brname> 0) seems to disable
learning, but the bridge still knows its own MAC addresses, so traffic
received on a port destined to one of these MAC address won't be
forwarded to other ports.
 
Reply With Quote
 
Rick Jones
Guest
Posts: n/a

 
      10-31-2007, 04:40 PM
jeniffer <(E-Mail Removed)> wrote:
> I have to implement port mirroring feature in linux.ie All inbound-
> outbound packets of a particular interface are mirrored to another
> interface. I need to implement it in both the bridging and routing
> paths.Is there any utility in linux which helps to do this?


A bit of coding around libpcap to sniff traffic on one or more
interfaces and then just dump them out the desired interface sounds
like it would do the trick. If the mirror interface is also being
sniffed it might require a bit more logic to avoid loops.

rick jones
--
web2.0 n, the dot.com reunion tour...
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
 
Reply With Quote
 
Markus Rehbach
Guest
Posts: n/a

 
      10-31-2007, 05:53 PM
Rick Jones wrote:

> jeniffer <(E-Mail Removed)> wrote:
>> I have to implement port mirroring feature in linux.ie All inbound-
>> outbound packets of a particular interface are mirrored to another
>> interface. I need to implement it in both the bridging and routing
>> paths.Is there any utility in linux which helps to do this?

>
> A bit of coding around libpcap to sniff traffic on one or more
> interfaces and then just dump them out the desired interface sounds
> like it would do the trick. If the mirror interface is also being
> sniffed it might require a bit more logic to avoid loops.


Something like tcpbridge?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mirroring Socket FDs. gary.smith@netactive.co.uk Linux Networking 2 08-11-2007 04:29 PM
mirroring my project Gary Wessle Linux Networking 0 02-17-2007 06:11 AM
Desktop Mirroring over Ad-Hoc connection Jared Wireless Networks 0 09-27-2005 06:24 AM
Mirroring data over WAN David Lewis Windows Networking 2 02-02-2005 04:06 PM
Easy FTP mirroring Xilo Musimene Linux Networking 6 09-03-2003 08:40 AM



1 2 3 4 5 6 7 8 9 10 11