Vitavonni

Mon, 09 Apr 2007

Visualizing iptables

I've written a small parser for iptables rules in Python, and made it output GraphViz data. Byte counters are translated to line width, packet counters to line color. Dashed lines didn't receive any data so far.

This is the result for my laptop's tiny firewall setup (generated by Pyroman; the double accept/drop/reject rules are mostly for cosmetic purposes, and counting data and packet totals. However the reject rule also does a 'cleaner' reject for TCP connections)

Visualization of a small iptables rule setup

I've ran it on a much larger firewall (~100 chains, ~600 rules; a multi-homed firewall at our university), but it becomes to messy with the dotty layout algorithm. The firewall chains generated by pyroman are pretty flat; it generates one chain per client-server combination, the INPUT etc. chains are filled with source/destination filters, the services are filtered in the second level then. Also most of the traffic is handled by connection tracking, so it boils down to having one big accept line, with little going on beyond that.

So the visualization turned out to be only of partial interest (at least for Pyroman-generated firewalls. It could be useful if someone actually nests chains more levels deep).

Still there is some interesting stuff I might be going to try with the iptables-save parser I've written:

  • pyroman could reload the firewall, keeping traffic counters where possible
  • based on traffic counters for hosts and services, it could reorder entries in the firewall to optimize the firewall slightly (in the pyroman model, hosts and services can be reordered to a certain extend; I'm aware that this is not true for generic iptables rules. It might however be still helpful for some users to get suggestions on how to order their rules. It's also unlikely this will have a large performance impact in general, unless you have one really heavily used service and didn't place it first on your own...)

[P.S. Anyone aware of a GTK/Gnome application or library for visualizing graphs?]

[P.P.S. Bernd Zeimetz has been running it on some really complex firewalls. I guess it really could benefit from a layouting algorithm optimized for this kind of graphs, dotty can become kind of messy. :-) Maybe I'll make an interactive version, where you can see for each chain the incoming and outgoing flows or so, but not try to make such a huge graph.]

[category: /en/linux | Permalink]
Menu
[planet.debian]
[planet.xmlhack]
[planet SELinux]
[munichblogs]
[email]
[RSS 2 feed]
[English RSS 2]
Categories
< April 2007 >
SuMoTuWeThFrSa
1 2 3 4 5 6 7
8 91011121314
15161718192021
22232425262728
2930     
Archives
2010-Mar
2010-Feb
2010-Jan
2009-Dec
2009-Nov
2009-Oct
2009-Sep
2009-Aug
2009-Jul
2009-Jun
2009-May
2009-Apr
2009-Mar
2009-Feb
2009-Jan
2008-Dec
2008-Nov
2008-Oct
2008-Sep
2008-Aug
2008-Jul
2008-May
2008-Apr
2008-Mar
2008-Feb
2008-Jan
2007-Dec
2007-Nov
2007-Oct
2007-Sep
2007-Aug
2007-Jul
2007-Jun
2007-May
2007-Apr
2007-Mar
2007-Feb
2007-Jan
2006-Dec
2006-Nov
2006-Oct
2006-Sep
2006-Aug
2006-Jul
2006-Jun
2006-May
2006-Apr
2006-Mar
2006-Feb
2006-Jan
2005-Dec
2005-Nov
2005-Oct
2005-Sep
2005-Aug
2005-Jul
2005-Jun
2005-May
2005-Apr
2005-Mar
2005-Feb
2005-Jan
2004-Dec
2004-Nov
2004-Oct
2004-Sep
2004-Aug
2004-Jul
Other links:
Swing and the City - Lindy Hop in Munich