Advertisement
ajcorrea

Tutorial FlowTools

Jul 30th, 2014
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. As dicas foram retiradas da lista GTER, várias sugeridas pelo Rubens K. em outros posts:
  2.  
  3. Utilizando o CENTOS como base, faça:
  4.  
  5. # yum install flow-tools-devel flow-tools flow-tools-rrdtool
  6.  
  7. Instalar tambem os modulos Perl:
  8.  
  9. # yum install perl-Net-Patricia
  10.  
  11. A estrutura de pastas ficou assim:
  12. /netflow
  13. /netflow/data
  14. /netflow/tools
  15. /netflow/tmp
  16.  
  17. Copiar as ferramentas para a pasta tools: (preservar os nomes)
  18. flow-asn.pl -> http://pastebin.com/BRA0Nwdz
  19. gerar_originate.sh -> http://pastebin.com/Rb29X23M
  20. rotate.sh -> http://pastebin.com/dKGFafLX
  21. flow_report.sh -> http://pastebin.com/G1xHNXre
  22.  
  23. Todos dentro da pasta tools !!!!
  24.  
  25. # chmod 755 /netflow/tools/*
  26.  
  27. No arquivo /etc/sysconfig/flow-capture coloque o seguinte (apague o que tiver):
  28.  
  29. OPTIONS="-E 40G -n 287 -N 0 -w /netflow/data -S 5 0/0/5555 -R /netflow/tools/rotate.sh"
  30.  
  31. Coloque no cron o arquivo gerar_originate.sh para ser executado 1 vez por dia:
  32.  
  33. # crontab -e
  34. 0 0 * * * /netflow/tools/gerar_originate.sh >/dev/null 2>&1
  35.  
  36. Libere o firewall para o flow-capture receber os dados:(execute no console)
  37.  
  38. # iptables -t filter -N FLOW
  39. # iptables -t filter -I INPUT -p udp --dport 5555 -j FLOW
  40. # iptables -t filter -A FLOW -s xxx.xxx.xxx.xxx -j ACCEPT
  41. # iptables -t filter -A FLOW -s yyy.yyy.yyy.yyy -J ACCEPT
  42. # iptables -t filter -A DROP
  43.  
  44. Onde xxx e yyy são os roteadores/switchs que vão enviar os flows, adicione mais linhas caso necessário (mas sempre a ultima linha deve ser a DROP).
  45.  
  46. Salvar o iptables: (se usar o padrão do firewall do centos. Caso não use, inclua as linhas acima em seu script).
  47.  
  48. # service iptables save
  49.  
  50. Agora adicione o flow-capture para iniciar com o sistema:
  51.  
  52. # chkconfig --add flow-capture
  53. # chkconfig flow-capture on
  54.  
  55. Vamos acertar as premissões agora:
  56.  
  57. # chown flow-tools:flow-tools /netflow
  58. # chown flow-tools:flow-tools /netflow/* -R
  59. # chmod 740 /netflow/tools/*
  60. # chmod 740 /netflow
  61.  
  62.  
  63. Inicie o flow-capture manualmente para não precisar reiniciar o servidor:
  64.  
  65. # service flow-capture start
  66.  
  67.  
  68. Sistema deve iniciar (verifique os logs caso não), e neste ponto, basta configurar seus roteadores/switches para enviar os dados para o servidor.
  69.  
  70. Para ver os dados:
  71. # /netflow/tools/flow_report.sh /netflow/data/ft-*
  72.  
  73. onde xxxxx é o arquivo de flow. Vai te mostrar estatisticas do flow utilizado, para gerar completo, basta adaptar o script para ler TODOS os flows :
  74.  
  75. # /netflow/tools/flow_report.sh /netflow/data/ft-*
  76.  
  77.  
  78. Grande abraço !!
  79.  
  80. Alexandre Jeronimo Correa - Onda Internet
  81. ajcorrea@gmail.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement