Receiving IPFIX data by ipfixreceiver [Документация VAS Experts]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:dpi:dpi_components:utilities:oldutility:ipfixreceiver [2019/05/13 17:53] – created kvazikraven:dpi:dpi_components:utilities:oldutility:ipfixreceiver [2024/09/26 15:29] (current) – external edit 127.0.0.1
Line 7: Line 7:
 ==== CentOS6 ==== ==== CentOS6 ====
  
-  - add the VAS Experts repository according to the item 1 of [[en:dpi:dpi_components:platform:dpi_update:dpi_update_10:dpi_10_update:start|DPI installation]] instruction manual.+  - add the VAS Experts repository <code>rpm --import http://vasexperts.ru/centos/RPM-GPG-KEY-vasexperts.ru 
 +rpm -Uvh http://vasexperts.ru/centos/6/x86_64/vasexperts-repo-1-0.noarch.rpm</code>
   - instal the ipfixreceiver:\\ <code>yum install -y ipfixreceiver</code>   - instal the ipfixreceiver:\\ <code>yum install -y ipfixreceiver</code>
   - check for the changes in the configuration files so they to be consistent with ipfixreceiver current version, see the "Important changes" section.   - check for the changes in the configuration files so they to be consistent with ipfixreceiver current version, see the "Important changes" section.
  
 ==== CentOS7 ==== ==== CentOS7 ====
-  - add the VAS Experts repository according to the item 1 of [[en:dpi:dpi_components:platform:dpi_update:dpi_update_10:dpi_10_update:start|DPI installation]] instruction manual.+  - add the VAS Experts repository <code>rpm --import http://vasexperts.ru/centos/RPM-GPG-KEY-vasexperts.ru 
 +rpm -Uvh http://vasexperts.ru/centos/6/x86_64/vasexperts-repo-1-0.noarch.rpm</code>
   - install the epel repository <code>yum -y install epel-release</code>   - install the epel repository <code>yum -y install epel-release</code>
   - install the forencis repository: <code>rpm --import https://forensics.cert.org/forensics.asc   - install the forencis repository: <code>rpm --import https://forensics.cert.org/forensics.asc
 rpm -Uvh https://forensics.cert.org/cert-forensics-tools-release-el7.rpm</code> rpm -Uvh https://forensics.cert.org/cert-forensics-tools-release-el7.rpm</code>
-  - установите ipfixreceiver:\\ <code>yum -y install libfixbuf --disablerepo=forensics+  - install the ipfixreceiver:\\ <code>yum -y install libfixbuf --disablerepo=forensics
 yum -y install  netsa-python netsa_silk yum -y install  netsa-python netsa_silk
 yum -y install ipfixreceiver --disablerepo=forensics</code> yum -y install ipfixreceiver --disablerepo=forensics</code>
Line 24: Line 26:
   - the configuration file has been changed with respect to IP address translation, starting from the 1.0.3 version you should specify ''decodeipv4'', decodeipv6 in the export model, for example:<code>  source_ip4, ''decodeipv4''</code><code>  destination_ip4, decodeipv4</code>   - the configuration file has been changed with respect to IP address translation, starting from the 1.0.3 version you should specify ''decodeipv4'', decodeipv6 in the export model, for example:<code>  source_ip4, ''decodeipv4''</code><code>  destination_ip4, decodeipv4</code>
   - the process of information saving has been allocated to a separate process; remember that when dealing with a large number of sessions (> 25k sessions per second) the process will completely load 2 processor cores. In order to check that the process has time to process the entire data stream the following messages are added in the DEBUG mode:\\ (a)cnt=NNNNN - the buffer has been sent with the given number\\ (b)cnt=YYYYY - the buffer with the given number is saved.   - the process of information saving has been allocated to a separate process; remember that when dealing with a large number of sessions (> 25k sessions per second) the process will completely load 2 processor cores. In order to check that the process has time to process the entire data stream the following messages are added in the DEBUG mode:\\ (a)cnt=NNNNN - the buffer has been sent with the given number\\ (b)cnt=YYYYY - the buffer with the given number is saved.
-  - a new ''buffer_size'' parameter is added; it specifies the size of the clipboard between the process of receiving and writing to a file, it is used in the [dump] section, the default value of the parameter is 100000 records (it is focused on 20 Gbit traffic or 25 000 sessions per second). If the number of sessions per second is considerably less than the mentioned value, then you should to change this parameter proportionally.+  - a new ''buffer_size'' parameter is added; it specifies the size of the i/o buffer between the process of receiving and writing to a file, it is used in the [dump] section, the default value of the parameter is 100000 records (it is focused on 20 Gbit traffic or 25 000 sessions per second). If the number of sessions per second is considerably less than the mentioned value, then you should to change this parameter proportionally.
  
 ===== The files supplied with the ipfixreceiver ===== ===== The files supplied with the ipfixreceiver =====
Line 33: Line 35:
   - auxiliary files:\\ <code>/etc/dpiui/port_proto.txt contains the information on the translation of protocol identifier to its string representation,   - auxiliary files:\\ <code>/etc/dpiui/port_proto.txt contains the information on the translation of protocol identifier to its string representation,
 it is used by the utility to get the protocol text-based name by its identifier</code> it is used by the utility to get the protocol text-based name by its identifier</code>
-  - links to the executable:\\ <code>/usr/local/bin/ipfixreceiver -> link to the /usr/local/lib/ipfixreceiver.d/ipfixreceiver</code>+  - links to the executables:\\ <code>/usr/local/bin/ipfixreceiver -> link to the /usr/local/lib/ipfixreceiver.d/ipfixreceiver</code>
  
 ===== Additional OS settings ===== ===== Additional OS settings =====
Line 52: Line 54:
     postrotate     postrotate
     endscript     endscript
-}</code> \\ Обратите внимание на использование метода copytruncate, иначе файл будет пересоздан и запись лога из процесса прекратится.\\ Соответственно в конфигурации ipfixreceiver у вас в разделе [handler_ipfixreceiverlogger] указано следующее:\\ <code>args=('/var/log/dpiuiflow.log', 'a+')</code> +}</code> \\ Please pay attention that the copytruncate method is usedotherwise the file will be recreated and writing the log by the process will stop.\\ Respectively, in the ipfixreceiver configuration file, you have the following settings in the [handler_ipfixreceiverlogger] section: \\ <code>args=('/var/log/dpiuiflow.log', 'a+')</code> 
-  - Настройте удаление старых файловНапример удаление старых архивов (более 31 дняс записями о сессиях запакованных gzip:\\ <code>15 4 * * * /bin/find /var/dump/dpiui/ -name url_\*.dump.gz -cmin +44640 -delete > /dev/null 2>&1</code>\\ Измените строчку под ваши требования и добавьте в файл /var/spool/cron/root.+  - Configure the deleting of old filesFor example, deleting old archives (more than 31 dayscontaining sessions records packed with gzip:\\ <code>15 4 * * * /bin/find /var/dump/dpiui/ -name url_\*.dump.gz -cmin +44640 -delete > /dev/null 2>&1</code>\\ Change the line according to your requirements and add to the /var/spool/cron/root file.
  
-===== Параметры запуска программы ===== +===== Ipfixreceiver startup options ===== 
-Утилита ipfixreceiver имеет следующие параметры запуска :+The ipfixreceiver utility has the following startup options:
 <code>usage: ipfixreceiver start|stop|restart|status|-v [-f <config file>] <code>usage: ipfixreceiver start|stop|restart|status|-v [-f <config file>]
 где где
-  start   запуск в режиме сервиса +  start   start as a service 
-  stop    - останов сервиса +  stop    - service stop 
-  state   состояние работы сервиса +  state   get the service state 
-  restart - перезапуск сервиса +  restart - service restart 
-  -v      - вывести информацию о версии +  -v      - show version info 
-  -f <config file> - указать файл конфигурации для запуска сервиса+  -f <config file> - specify the configuration file for the service to start
  
-Пример:+Example:
   ipfixreceiver start -f /etc/dpiui/ipfixreceiverflow.conf   ipfixreceiver start -f /etc/dpiui/ipfixreceiverflow.conf
 </code> </code>
-===== Конфигурация =====+===== Configuration =====
  
-По умолчанию используется файл конфигурации /etc/dpiui/ipfixreceiver.conf .\\  +The default configuration file is /etc/dpiui/ipfixreceiver.conf.\\  
-:!:Больше информации о конфигурировании логирования можно найти по ссылке [[https://docs.python.org/2.6/library/logging.html | Logging ]]+:!:More information on configuring logging can be found here: [[https://docs.python.org/2.6/library/logging.html | Logging ]]
  
-==== Служебные разделы ==== +==== Service sections ==== 
-  - loggers - определяет используемые лог идентификаторы +  - loggers - specifies the log identifiers used 
-  - handlers - определяет используемые обработчики для сохранения лога +  - handlers - specifies the handlers used to save the log 
-  - formatters - определяет используемые форматы для лога+  - formatters - specifies the formats used for the log
  
 ==== logger_root ==== ==== logger_root ====
-  - level - определяет уровень логирования (верхний уровень)\\ Возможные значения:<code> +  - level - specifies the logging level (upper level)\\ Possible values are: <code> 
-CRITICAL только критические ошибкиминимальный уровень сообщений +CRITICAL only critical errorsminimum message level 
-ERROR     включая ошибки +ERROR     including errors 
-WARNING   включая предупреждения +WARNING   including warnings 
-INFO      - включая информацию +INFO      - including information 
-DEBUG     включая отладочные +DEBUG     including debug messages 
-NOTSET    - Всемаксимальный уровень сообщений (включая все выше перечисленные+NOTSET    - allthe maximum level of messages (including all of the above
-</code>\\ Пример:\\ <code>level=DEBUG</code> +</code>\\ Example:\\ <code>level=DEBUG</code> 
-  - handlers - используемые обработчики сообщений\\ Пример: <code>handlers=ipfixreceiverlogger</code>+  - handlers - message handlers used\\ Example: <code>handlers=ipfixreceiverlogger</code>
 ==== handler_ipfixreceiverlogger ==== ==== handler_ipfixreceiverlogger ====
-  - class - класс обработчика\\ Пример: <code>class=FileHandler</code> +  - class - handler class\\ Example: <code>class=FileHandler</code> 
-  - level - уровень сообщений <code>level=DEBUG</code> +  - level - message level <code>level=DEBUG</code> 
-  - formatter - наименование формата сообщений<code>formatter=ipfixreceiverlogger</code> +  - formatter - message format name<code>formatter=ipfixreceiverlogger</code> 
-  - args - параметры обработчика <code>args=('/var/log/dpiuiflow.log', 'a+')</code>+  - args - handler parameters <code>args=('/var/log/dpiuiflow.log', 'a+')</code>
 ==== formatter_ipfixreceiverlogger ==== ==== formatter_ipfixreceiverlogger ====
-  - format - описание формата сообщения\\ Пример: <code>format=%(asctime)s - %(name)s - %(levelname)s - %(message)s +  - format - message format description\\ Example: <code>format=%(asctime)s - %(name)s - %(levelname)s - %(message)s 
-где +here 
-%(name)s      - имя лога +%(name)s      - log name 
-%(levelname)s - уровень сообщения ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'). +%(levelname)s - message level ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'). 
-%(asctime)s   датапо умолчанию формат “2003-07-08 16:49:45,896” (поле запятаой указаны миллисекунды). +%(asctime)s   datethe default format is “2003-07-08 16:49:45,896” (the comma field corresponds to milliseconds). 
-%(message)s   сообщение+%(message)s   message
 </code> </code>
-  - datefmt - описание формата даты\\ Пример: <code>datefmt='%m-%d %H:%M'</code>+  - datefmt - date format description\\ Example: <code>datefmt='%m-%d %H:%M'</code>
 ==== connect ==== ==== connect ====
-  - protocol - протокол (tcp или udp). <code>protocol=udp</code> +  - protocol - protocl (tcp or udp). <code>protocol=udp</code> 
-  - host - IP или имя сервера. <code>host=localhost</code> +  - host - server IP or its name. <code>host=localhost</code> 
-  - port - номер порта. <code>port=9996</code>+  - port - port number. <code>port=9996</code>
 ==== dump ==== ==== dump ====
-  - rotate_minutes - период в минутахпо прошествии которого временный файл в dumpfiledir/<port>.url.dump будет перемещен в архив (mv) и создан новый временный файл.<code>rotate_minutes=10</code> +  - rotate_minutes is the period in minutesafter which the temporary file in dumpfiledir/<port>.url.dump will be moved to the archive (mv) and a new temporary file will be created. 
-  - processcmd - команда которая будет запущена по окончании ротации файлапараметр имя файла с путем к нему.<code>processcmd=gzip %%s</code> +<code>rotate_minutes=10</code> 
-  - dumpfiledir - директория куда будут сохраняться файлы с принятыми данными. <code>dumpfiledir=/var/dump/dpiui/ipfixflow/</code> +  - processcmd is the command that will be launched at the end of the file rotationthe file name parameter with the path to it.<code>processcmd=gzip %%s</code> 
-  - buffer_size - размер буфера обмена между процессом приема и записи в файлпо умолчанию значение параметра 100000 записей (ориентировано на 20Гбит трафика или 25 000 сессий в сек). Если к-во сессий в секунду значительно меньшето обязательно пропорционально измените данный параметр+  - dumpfiledir is a directory to store the files with data received. <code>dumpfiledir=/var/dump/dpiui/ipfixflow/</code> 
 +  - buffer_size is the size of the i/o buffer between the process of receiving and writing to a fileit is used in the [dump] section, the default value of the parameter is 100000 records (it is focused on 20 Gbit traffic or 25 000 sessions per second). If the number of sessions per second is considerably less than the mentioned valuethen you should to change this parameter proportionally
  
 ==== InfoModel ==== ==== InfoModel ====
-Блок описывает получаемые данные по IPFIX протоколу+The block specifies the data received via the IPFIX protocol
-  - InfoElements - параметр с описанием элементов информационной модели для IPFIX <code>InfoElements =  octetDeltaCount,       0,    1, UINT64, True+  - InfoElements - parameter describing the information model elements for IPFIX<code>InfoElements =  octetDeltaCount,       0,    1, UINT64, True
                 packetDeltaCount,      0,    2, UINT64, True                 packetDeltaCount,      0,    2, UINT64, True
                 protocolIdentifier,    0,    3, UINT8                 protocolIdentifier,    0,    3, UINT8
                 session_id,        43823, 2000, UINT64, True                 session_id,        43823, 2000, UINT64, True
-где+here
-  session_id - наименование поля из описания IPFIX см. разделы +  session_id - is the name of the field from the IPFIX description, for more detail see corresponding sections 
-  43823  - уникальный номер организации (enterprise number) +  43823  - unique organization number (enterprise number) 
-  1      - уникальный номер поля +  1      - unique field number 
-  UINT64 - тип поля +  UINT64 - field type 
-  True   использовать обратный порядок байт (endian). Значения - True или пусто.+  True   use reverse byte order (endian). Possible values are: True or empty.
 </code> </code>
-Типы полей:\\+Field types:\\
 ^ Type      ^ Length       ^ Type IPFIX          ^ ^ Type      ^ Length       ^ Type IPFIX          ^
 | OCTET_ARRAY    | VARLEN     | octetArray        | | OCTET_ARRAY    | VARLEN     | octetArray        |
Line 149: Line 152:
 | IP6ADDR        | 16         | ipv6Address       | | IP6ADDR        | 16         | ipv6Address       |
  
-Наименование полей и описание можно взять по ссылкам:\\ +The field names and their description can be accessed from the following links:\\ 
-  - [[dpi:dpi_options:base_functionality:opt_statistics:statistics_ipfix:start|Шаблон экспорта Netflow в формате IPFIX]] +  - [[en:dpi:dpi_options:opt_statistics:statistics_ipfix|Netflow export template using the IPFIX format]] 
-  - [[dpi:dpi_options:base_functionality:opt_li:li_ipfix:start|Шаблоны экспорта clickstream и SIP]] +  - [[en:dpi:dpi_options:opt_li:li_ipfix|Clickstream and SIP export templates]] 
-  - [[dpi:dpi_components:radius:radmon_acct_ipfix:start|Шаблон экспорта AAA в формате IPFIX]]+  - [[en:dpi:dpi_components:radius:radmon_acct_ipfix|AAA export template using the IPFIX format]]
  
  
-Дополнительная информация:\\+Additional information:\\
 [[https://tools.ietf.org/html/rfc5102.html | Information Model for IP Flow Information Export]] [[https://tools.ietf.org/html/rfc5102.html | Information Model for IP Flow Information Export]]
 ==== ExportModel ==== ==== ExportModel ====
-определяет параметры модели для экспортазарезервировано для будущего использования+specifies the model parameters used for exportis reserved for future use
-  - Mode - тип используемого экспорта <code>Mode = File</code>+  - Mode - the type of export used<code>Mode = File</code>
 ==== ExportModelFile ==== ==== ExportModelFile ====
-Описание модели экспорта File. +Description of the File export model
-  - Delimiter разделитель полей в строке ( \t - табуляцияеще примеры - |,;) <code>Delimiter = \t</code> +  - Delimiter ( \t - tabulationmore examples - |,;) <code>Delimiter = \t</code> 
-  - ExportElements - описание полей которые будут сохранены в файл. <code>ExportElements = timestamp, seconds, %%Y-%%m-%%d %%H:%%M:%%S.000+03+  - ExportElements - description of the fields that will be saved to the file.<code>ExportElements = timestamp, seconds, %%Y-%%m-%%d %%H:%%M:%%S.000+03
                  login                  login
                  source_ip4                  source_ip4
Line 171: Line 174:
                  referal, decodereferer                  referal, decodereferer
                  session_id                  session_id
-где поля в каждой строке+where the fields in each row are the following
-  имя наименование поля из информационной модели [InfoModel] (login, session_id и т.п.) +  name the field name from the information model [InfoModel] (login, session_id and etc.) 
-  обработчик процедура обработки поля перед выводом +  handler field processing procedure before output 
-               seconds       поле в секундахожидается формат +               seconds       field in secondsformat is expected 
-               milliseconds поле в милисекундахмикросекундахнаносекундах ожидается формат +               milliseconds field in millisecondsmicrosecondsnanoseconds format is expected 
-               decodehost    - перекодировать из punycode в UTF-8 +               decodehost    - recode from punycode to UTF-8 
-               decodepath    - перекодировать из urlencoding в UTF-8 +               decodepath    - recode from urlencoding to UTF-8 
-               decodereferer - перекодировать из (punycode,urlencoding) в UTF-8 +               decodereferer - recode from (punycode,urlencoding) to UTF-8 
-               decodeproto   перекодировать идентификатор протокола в строку +               decodeproto   recode the protocol identifier to the string 
-  формат описание формата для seconds, milliseconds.  +  format format description for seconds, milliseconds. 
-           Пример: %%Y-%%m-%%d %%H:%%M:%%S.%%f+0300 +           Example: %%Y-%%m-%%d %%H:%%M:%%S.%%f+0300 
-           Результат: 2016-05-25 13:13:35.621000+0300+           Result: 2016-05-25 13:13:35.621000+0300
 </code> </code>
  
-==== Создаем сервис в Centos7 ==== +==== Creation of systemd ipfixreceiver service in Centos7 ==== 
-Создание сервиса в centos7 по шагамназвание сервиса **ipfix1**, используемая конфигурация **/etc/dpiui/ipfixreceiver.conf**, используемый порт **1500**. \\ +Step-by-step creation of service in Centos 7here the service name is ** ipfix1 **, its configuration is in the **/etc/dpiui/ipfixreceiver.conf** filelistening port is **1500**. \\ 
-Создаем файл /etc/systemd/system/ipfix1.service следующего содержания:+Create the /etc/systemd/system/ipfix1.service file as follows:
 <code> <code>
 [Unit] [Unit]
Line 206: Line 209:
 WantedBy=multi-user.target WantedBy=multi-user.target
 </code> </code>
-Выполняем:+Issue the following commands:
   systemctl enable ipfix1.service   systemctl enable ipfix1.service
   systemctl start ipfix1.service   systemctl start ipfix1.service
   systemctl daemon-reload   systemctl daemon-reload
  
-Проверяем:+Check whether the service is running:
   systemctl status ipfix1.service -l   systemctl status ipfix1.service -l
-:!:**не забудьте проверить поднятие сервиса после перезагрузки**+:!: **Do not forget to check the service status after rebooting!**
  
-===== Проблемы и решения ===== +===== Troubleshooting ===== 
-  - как получить версию утилиты?\\ Используйте следующие команды:\\ <code>ipfixreceiver -v</code><code>yum info ipfixreceiver</code> +  - how to get utility version?\\ You should use the following commands:\\ <code>ipfixreceiver -v</code><code>yum info ipfixreceiver</code> 
-  - можно ли на один порт отправлять IPFIX потоки с разных DPI?\\ ДаЕдинственное в записываемом потоке их будет не различить+  - Is it allowed to send IPFIX flows from different DPI to one port?\\ Yes, it isThe only thing is that they can not be distinguished in the recorded flow
-  - как понять, что утилита работает?\\ a) проверьте, что порт из конфигурации прослушивается утилитойнапример 1500:<code>netstat -nlp | grep 1500</code> b) проверьте лог, нет ли ошибок\\ c) Проверьтечто запись в промежуточный файл происходит, например для 9996 порта (директория для файлов - /var/dump/dpiui/ipfixurl): <code>tail -f /var/dump/dpiui/ipfixurl/9996.url.dump</code> +  - How can I understand that the utility works properly?\\ a) check that the port specified in the configuration file is listened on by the utilityfor example 1500:<code>netstat -nlp | grep 1500</code> b) check the log for errors\\ c) check that the writing to the temporary file occursfor example for port 9996 (directory for dump files: /var/dump/dpiui/ipfixurl): <code>tail -f /var/dump/dpiui/ipfixurl/9996.url.dump</code> 
-  - все провереноно приема сообщений нет?\\ a) забыли открыть порт в iptables.\\ b) инициализировали ipfixreceiver с неверным IP сервера+  - everything is checkedbut the messages are not received?\\ a) it seems you have forgotten to open port in iptables\\ b) it seems you have initialized ipfixreceiver with the wrong server IP. 
-  - с DPI идет большое количество сессий (более млн сессий/мин), при включенном DEBUG режиме видночто счетчик обмена буферами не успевает записать до получения следующего блока записей, что можно сделать?\\ a) удалите преобразование даты в строкуэто уменьшит процессорное время на обработку и дополнительно получите уменьшение объема результирующего файла\\ b) удалите преобразование decodeipv4, не значительно, но так же получите ускорение записи файла\\ c)настройте buffer_size при к-ве сес /сек более 30к совместно с п.d\\ d) увеличьте частоту процессора и объем памяти+  - a huge number of sessions (more than million sessions/minis going from the DPIit can be seen with the DEBUG mode on that the buffer exchange counter does not have time to write before receiving the next block of recordswhat can be done in this case?\\ a) remove the date-to-line conversionthis will reduce the time needed for processing and in addition you will receive reduction the size of resulting file\\ b) remove the decodeipv4 conversion; it will not affect significantlybut you can get the higher speed of writing the file\\ c) configure the ''buffer_size'' when number of sessions per second is more than 30k along with the following item d)\\ d) increase the processor frequency and RAM