Port Mirroring in Linux

This is a discussion on Port Mirroring in Linux within the Linux Networking forums, part of the Linux Forums category; Pascal Hambourg wrote: > David Schwartz a écrit : >> >> A bridge does whatever it's configured to ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 10-31-2007
Markus Rehbach
 
Posts: n/a
Default Re: Port Mirroring in Linux

Pascal Hambourg wrote:

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


True but you could do thomething like this:

ebtables -t nat -A PREROUTING -i eth3 -p 0x0800 -j dnat --to-destination
00:01:12:12:12:12 --dnat-target ACCEPT
Reply With Quote
  #12 (permalink)  
Old 10-31-2007
Pascal Hambourg
 
Posts: n/a
Default Re: Port Mirroring in Linux

Markus Rehbach a écrit :
> Pascal Hambourg wrote:
>
>>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.

>
> True but you could do thomething like this:
>
> ebtables -t nat -A PREROUTING -i eth3 -p 0x0800 -j dnat --to-destination
> 00:01:12:12:12:12 --dnat-target ACCEPT


How is this supposed to help ?
Reply With Quote
  #13 (permalink)  
Old 10-31-2007
Rick Jones
 
Posts: n/a
Default Re: Port Mirroring in Linux

Markus Rehbach <Markus.Rehbach@gmx.de> wrote:
> Rick Jones wrote:
> > 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?


Perhaps, I've never seen tcpbridge.

Actually, I'm surprised that the Linux bridging code doesn't have
support for designating a mirror interface. I'd have thought it was
there already. Although I suspect the argument might be that if you
want to see traffic just sniff the interfaces making-up the bridge.

rick jones
--
a wide gulf separates "what if" from "if only"
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
  #14 (permalink)  
Old 10-31-2007
आशीष Ashish
 
Posts: n/a
Default Re: Port Mirroring in Linux

Pascal Hambourg wrote:

> Markus Rehbach a écrit :
>> Pascal Hambourg wrote:
>>
>>>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.

>>
>> True but you could do thomething like this:
>>
>> ebtables -t nat -A PREROUTING -i eth3 -p 0x0800 -j dnat --to-destination
>> 00:01:12:12:12:12 --dnat-target ACCEPT

>
> How is this supposed to help ?


That'll will redirect all IP (0x0800) traffic to MAC 00:01:12:12:12:12 (which
will be the MAC of other NIC), similar to the DNAT in iptables. But won't this
kill the communication, I mean instead of letting packets go to their preset
destination, this command will alter the destination. So this won't help.

HTH
--
Ashish Shukla
http://wahjava.wordpress.com/
Reply With Quote
  #15 (permalink)  
Old 11-01-2007
David Schwartz
 
Posts: n/a
Default Re: Port Mirroring in Linux

On Oct 31, 10:05 am, Pascal Hambourg <boite-a-s...@plouf.fr.eu.org>
wrote:

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


There is no reason a bridge should even have a MAC address. You can't
send packets to a bridge, only to a device connected to it.

DS

Reply With Quote
  #16 (permalink)  
Old 11-01-2007
Pascal Hambourg
 
Posts: n/a
Default Re: Port Mirroring in Linux

David Schwartz a écrit :
>
> There is no reason a bridge should even have a MAC address. You can't
> send packets to a bridge, only to a device connected to it.


Wireless access points and ethernet switches are bridges and have a MAC
address. Please keep in mind that we're in a Linux networking group, so
we're not talking about the pure bridge theory but about the Linux
implementation of a bridge. A Linux bridge, which is considered as an
ethernet interface which can send and receive packets, has at least one
MAC address inherited from the first bridged interface.
Reply With Quote
  #17 (permalink)  
Old 11-01-2007
Pascal Hambourg
 
Posts: n/a
Default Re: Port Mirroring in Linux

Ashish a écrit :
> Pascal Hambourg wrote:
>
>>>>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.
>>>
>>>True but you could do thomething like this:
>>>
>>>ebtables -t nat -A PREROUTING -i eth3 -p 0x0800 -j dnat --to-destination
>>>00:01:12:12:12:12 --dnat-target ACCEPT

>>
>>How is this supposed to help ?

>
> That'll will redirect all IP (0x0800) traffic to MAC 00:01:12:12:12:12 (which
> will be the MAC of other NIC), similar to the DNAT in iptables.


But why redirect only IPv4 traffic ? And what is that other NIC you're
talking about ?

> But won't this
> kill the communication, I mean instead of letting packets go to their preset
> destination, this command will alter the destination. So this won't help.


I'm afraid so. Unless it is set in promiscuous mode, the bridge
interface will ignore packets originally addressed to it if their
destination MAC address is altered. Besides, the original destination
MAC address is lost although one willing to do port mirroring may
considered it a valuable information.
Reply With Quote
  #18 (permalink)  
Old 11-01-2007
आशीष Ashish
 
Posts: n/a
Default Re: Port Mirroring in Linux

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pascal Hambourg wrote:
[...]
>>
>> That'll will redirect all IP (0x0800) traffic to MAC 00:01:12:12:12:12 (which
>> will be the MAC of other NIC), similar to the DNAT in iptables.

>
> But why redirect only IPv4 traffic ? And what is that other NIC you're
> talking about ?


Well Markus posted this, not me. I just interpreted that. The other NIC is the
one you wanted to redirect your traffic to or simply the sniffer interface.

>> But won't this
>> kill the communication, I mean instead of letting packets go to their preset
>> destination, this command will alter the destination. So this won't help.

>
> I'm afraid so. Unless it is set in promiscuous mode, the bridge
> interface will ignore packets originally addressed to it if their
> destination MAC address is altered. Besides, the original destination
> MAC address is lost although one willing to do port mirroring may
> considered it a valuable information.


True, ethernet interface needs to be set in promiscuous mode in order to become
a good sniffer interface.
- --
Ashish Shukla
http://wahjava.wordpress.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHKW2jHy+EEHYuXnQRAqTYAJ4jmfzFEhW8YbRug+AVrH 76+n8zeACgh0Qe
X05pDFdhK9zs7N4kbG/tl0s=
=ULzW
-----END PGP SIGNATURE-----
Reply With Quote
  #19 (permalink)  
Old 11-01-2007
Pascal Hambourg
 
Posts: n/a
Default Re: Port Mirroring in Linux

Ashish a écrit :
>
>>>That'll will redirect all IP (0x0800) traffic to MAC 00:01:12:12:12:12 (which
>>>will be the MAC of other NIC), similar to the DNAT in iptables.

>>
>>But why redirect only IPv4 traffic ? And what is that other NIC you're
>>talking about ?

>
> Well Markus posted this, not me. I just interpreted that.


Oops, sorry for the mistake.

> The other NIC is the
> one you wanted to redirect your traffic to or simply the sniffer interface.


Isn't a sniffer interface supposed to be in promiscuous mode, so this is
not required ?
Reply With Quote
  #20 (permalink)  
Old 11-01-2007
Ashish Shukla आशीष शà¥à¤•à¥à¤²
 
Posts: n/a
Default Re: Port Mirroring in Linux

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

,--- Pascal Hambourg writes:
| Ashish a écrit :
||

[...]

||| But why redirect only IPv4 traffic ? And what is that other NIC you're
||| talking about ?
||
|| Well Markus posted this, not me. I just interpreted that.

| Oops, sorry for the mistake.

np.

|| The other NIC is the
|| one you wanted to redirect your traffic to or simply the sniffer interface.

| Isn't a sniffer interface supposed to be in promiscuous mode, so this
| is not required ?

If you read my last post, you'll notice that I've already mentioned
that in the end.
- --
Ashish Shukla आशीष शà¥à¤•à¥à¤²
http://wahjava.wordpress.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHKdgEHy+EEHYuXnQRAj4SAKClkV2NFdifKLfVYO9EyT lNEmY8vgCfWh8f
m9ZL4dIq0ubPU5G2WV+9wXw=
=p9+t
-----END PGP SIGNATURE-----
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:06 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0