Improved Bridging for Monitoring in FreeBSD

FreeBSD developer Christian S.J. Peron wrote to me about two commits that improve support for bonding interfaces for use with network taps. He writes:


Let's say that you have a GigE copper tap, and you have the two monitor cables coming into the FreeBSD network analyzer on interfaces em0 and em1. You can aggregate the two links into one logical bridge interface to monitor them:

ifconfig bridge0 create
ifconfig bridge0 addm em0 addm em1 up
tcpdump -i bridge0

This basically turns em0 and em1 into switch ports. If you want to use this bridge specifically to aggregate one or more network interfaces and pass the packets off to BPF and return, then you can turn off the bridging functionality.

ifconfig bridge0 monitor

This prevents the bridge code from looking up which port a certain hardware address is attached to, or broadcasting packets out all ports in the event it doesn't know. Essentially, it short circuits the bridging code, which saves a number of mutex acquisitions, list traversals, reducing the load.

We have done this in places which use firewall clusters, I.E. 2 or 3 different PIX firewalls running VRRP

ifconfig bridge0 create
ifconfig bridge0 addm em0 addm em1 addm em2 addm em3 addm em4 addm em5 up monitor

snort -i bridge0

This way, snort works regardless of which firewall has failed over. The bridge is in monitor mode, so it's not actually trying to TX packets out the other interfaces, it just passes the packets it receives to BPF and returns.


This is neat. We won't see it in FreeBSD 6.1, but probably 6.2. Before 6.2, these features will appear in STABLE.

Comments

Anonymous said…
another worthy note on Christian Peron's work is the packet capturing/analyzing tool ipex (pkg_add -r ipex), the 2.x branch allows for a -t option which lets your specify capture times ie -t 3600 = 1hr pcap. not to mention analysis of the packet using regex with the -E option. very cool apps coming from this guy!
The bridging is done to make multiple passive NICs look like one passive NIC to the applications. STP is not involved. If this box dies the network never knows. This is a method to combine outputs from passive taps.
Anonymous said…
Nice. I don't like netgraph.

BTW, Open and Net BSDs have supported this for some time. I wonder why this took so long to get into Free. I wonder if FreeBSD will also include brconfig ?
Jeraklo,

I don't know.

Joe,

FreeBSD has had bridge0 like Open and Net for a while. I think the innovation here is the "short circuit" of the bridging code for monitoring uses.

Popular posts from this blog

Zeek in Action Videos

New Book! The Best of TaoSecurity Blog, Volume 4

MITRE ATT&CK Tactics Are Not Tactics