В статье "Monitoring Net Traffic with OpenBSD's Packet Filter" описано как создать несложную систему учета трафика используя пакетный фильтр pf и perl (без использования SQL через DBD::SQLite, для рисования графика применяется GD::Graph).
/etc/pf.conf (пример организации счетчиков):
pass quick on lo0 keep state
pass in log label "other-inbound" keep state
pass out log label "other-outbound" keep state
pass in to label "geekcruises-inbound" keep state
pass out from label "geekcruises-outbound" keep state
pass in to label "redcat-inbound" keep state
pass out from label "redcat-outbound" keep state
pass in to label "webstonehenge-inbound" keep state
pass out from label "webstonehenge-outbound" keep state
pass in to label "stonehenge-inbound" keep state
pass out from label "stonehenge-outbound" keep state
Дамп статистики через pfctl -zvsl
|