Pular para conteúdo

Integrações

Huawei

origin-as

É importante ressaltar que, para que os ASN (Autonomous System Numbers) sejam exportados, é necessário que o roteador possua pelo menos uma tabela de roteamento completa (full routing).

Netstream

Na caixa (Root/Admin)

slot 0 <0-10>
 ip netstream sampler to slot self
 ipv6 netstream sampler to slot self
Caixa (Root/Admin/VS)
ip netstream export version 9 origin-as bgp-nexthop ttl
ip netstream export template sequence-number fixed
ip netstream export index-switch 32
ip netstream as-mode 32
ip netstream timeout active 1
ip netstream timeout inactive 15
ip netstream export template timeout-rate 1
ip netstream export template option timeout-rate 1
ip netstream export template option application-label
ip netstream sampler fix-packets 1024 inbound
ip netstream sampler fix-packets 1024 outbound
ip netstream export source IP_ORIGEM
ip netstream export host IP_DO_RR_FLOW 3055

ipv6 netstream export version 9 origin-as bgp-nexthop ttl
ipv6 netstream export template sequence-number fixed
ipv6 netstream export index-switch 32
ipv6 netstream as-mode 32
ipv6 netstream timeout active 1
ipv6 netstream timeout inactive 15
ipv6 netstream export template timeout-rate 1
ipv6 netstream export template option timeout-rate 1
ipv6 netstream sampler fix-packets 1024 inbound
ipv6 netstream sampler fix-packets 1024 outbound
ipv6 netstream export source IP_ORIGEM
ipv6 netstream export host IP_DO_RR_FLOW 3055

# Sampling será fixo:
undo ip netstream export template option sampler
undo ipv6 netstream export template option sampler

# Adicione as interfaces de upstream.
interface Virtual-Ethernet0/1/101.408
 description Operadora_1_IPv4
 ip netstream inbound
 ip netstream outbound
interface Virtual-Ethernet0/1/101.409
 description Operadora_1_IPv6
 ipv6 netstream inbound
 ipv6 netstream outbound
interface 40GE0/1/49.2114
 description Operadora_2_IPv4e6
 ip netstream inbound
 ip netstream outbound
 ipv6 netstream inbound
 ipv6 netstream outbound

Se desejar optar em exportar apenas por IPv6 segue como fica os comandos:

ip netstream export host ipv6 IPv6_DO_RR_FLOW 3055
ipv6 netstream export host ipv6 IPv6_DO_RR_FLOW 3055

Para visualizar suas configurações como acima, use o comando:

display netstream all

Se o seu roteador Huawei está configurado para realizar serviços de CGNAT, é possível habilitar o envio de logs. No entanto, observe que o registro detalhado das sessões NAT pode gerar um volume substancial de dados.

Exemplo de configuração:

nat instance INSTANCE-NAME id 1 simple-configuration
 nat log host IP_DO_RR_FLOW 3055 source IP_ORIGEM 3055 name RR_FLOW 
 nat log session enable netstream

É de extrema importância que o horário/UTC do roteador exportador de fluxos esteja devidamente configurado.

display clock
Para ajustar a hora

system-view immediately
UTC para corretamente de sua região exemplo -3
clock timezone 1 minus 03:00:00
Sete manualmente a hora
run clock datetime HH:MM:SS AAAA-MM-DD
run clock datetime 12:10:30 2024-04-24

Sincronize com servidor de horas ntp.br (https://ntp.br/)

ntp-service server disable
ntp-service ipv6 server disable
ntp-service server source-interface all disable
ntp-service ipv6 server source-interface all disable
ntp-service unicast-peer 200.160.0.8
ntp-service unicast-server 200.160.0.8
ntp-service unicast-server 200.160.7.186
ntp-service unicast-server 200.189.40.8
ntp-service refclock-master 2
ntp-service sync-interval 180
ntp-service source-interface <interface_ip_publico>

Perguntas frequentes

IP_ORIGEM - Normalmente o IP da interface de Loopback.

IP_DO_RR_FLOW Endereço IP do servidor RR Flow que irá receber os dados.

3055 é apenas um exemplo. Use a porta UDP cadastrada para a fonte em Operações > Fontes; ela não é a porta HTTP da interface/API.

Em ambos você pode configurar somente o IPv4 ou IPv6, exemplo:

ip netstream export source 10.50.50.50
ip netstream export host 172.16.0.100 3055
ipv6 netstream export source 10.50.50.50
ipv6 netstream export host 172.16.0.100 3055

Ou

ip netstream export source ipv6 2001:db8:ffff:ffff::ffff
ip netstream export host ipv6 2001:db8:cafe:d0ce::50 3055
ipv6 netstream export source ipv6 2001:db8:ffff:ffff::ffff
ipv6 netstream export host ipv6 2001:db8:cafe:d0ce::50 3055

ip netstream inbound | ip netstream outbound Associar às interfaces com IPv4 configurado que irão enviar os fluxos da interfaces. Normalmente apenas as interfaces de upstream.

interface 40GE0/1/49.32
    vlan-type dot1q 32
    description Operadora_IPv4
    ip address 10.10.10.6 255.255.255.252
    statistic enable
    ip netstream inbound
    ip netstream outbound

ipv6 netstream inbound | ipv6 netstream outbound Associar às interfaces com IPv6 configurado que irão enviar os fluxos da interfaces. Normalmente apenas as interfaces de upstream.

interface 40GE0/1/49.128
    vlan-type dot1q 128
    description Operadora_IPv6
    ipv6 enable
    ipv6 address 2001:DB8:1:1:1::2/64
    statistic enable
    ipv6 netstream inbound
    ipv6 netstream outbound

Se a interfaces possuir IPv4 e IPv6

interface 40GE0/1/49.3264
    vlan-type dot1q 3264
    description Operadora_IPv6
    ip address 10.10.10.6 255.255.255.252
    ipv6 enable
    ipv6 address 2001:DB8:1:1:1::2/64
    statistic enable
    ip netstream inbound
    ip netstream outbound
    ipv6 netstream inbound
    ipv6 netstream outbound

Peer

ADMIN

system-view
flowspec ipv4-fragment-rule switch
flowspec match bras ipv4 enable
y
commit
run save
y

VS ou ADMIN

system-view

ip route-static 192.0.2.1 255.255.255.255 NULL0 description BLACKHOLE
ipv6 route-static 2001:DB8:DEAD:BEEF::1 128 NULL0 description BLACKHOLE

ip ip-prefix   RRFLOW_FULL_ROUTING_IPV4 index 10 permit 0.0.0.0 0 greater-equal 0 less-equal 32
ip ipv6-prefix RRFLOW_FULL_ROUTING_IPV6 index 10 permit :: 0 greater-equal 0 less-equal 128

# Unicast
#
route-policy RRFLOW_IMPORT_UNICAST_IPV4 permit node 10
route-policy RRFLOW_IMPORT_UNICAST_IPV4 deny node 9999
#
route-policy RRFLOW_EXPORT_UNICAST_IPV4 permit node 10
 if-match ip-prefix RRFLOW_FULL_ROUTING_IPV4
#
route-policy RRFLOW_EXPORT_UNICAST_IPV4 deny node 9999
#
#
route-policy RRFLOW_IMPORT_UNICAST_IPV6 permit node 10
route-policy RRFLOW_IMPORT_UNICAST_IPV6 deny node 9999
#
route-policy RRFLOW_EXPORT_UNICAST_IPV6 permit node 10
 if-match ipv6 address prefix-list RRFLOW_FULL_ROUTING_IPV6
#
route-policy RRFLOW_EXPORT_UNICAST_IPV6 deny node 9999
#

# Flowspec
#
route-policy RRFLOW_IMPORT_FLOWSPEC_IPV4 permit node 10
#
route-policy RRFLOW_EXPORT_FLOWSPEC_IPV4 deny node 9999
#
#
route-policy RRFLOW_IMPORT_FLOWSPEC_IPV6 permit node 10
#
route-policy RRFLOW_EXPORT_FLOWSPEC_IPV6 deny node 9999
#


bgp <SEU_ASN>
 peer <IPV4_SERVIDOR_RR_FLOW> as-number <SEU_ASN>
 peer <IPV4_SERVIDOR_RR_FLOW> description RR_FLOW_IPv4
 peer <IPV4_SERVIDOR_RR_FLOW> timer connect-retry 1
 peer <IPV4_SERVIDOR_RR_FLOW> connect-interface <INTERFACE>   # (multhope)

 peer <IPV6_SERVIDOR_RR_FLOW> as-number <SEU_ASN>
 peer <IPV6_SERVIDOR_RR_FLOW> description RR_FLOW_IPv6
 peer <IPV6_SERVIDOR_RR_FLOW> timer connect-retry 1
 peer <IPV6_SERVIDOR_RR_FLOW> connect-interface <INTERFACE>   # (multhope)

 ipv4-family unicast
  peer <IPV4_SERVIDOR_RR_FLOW> enable
  y
  peer <IPV4_SERVIDOR_RR_FLOW> public-as-only
  peer <IPV4_SERVIDOR_RR_FLOW> route-policy RRFLOW_IMPORT_UNICAST_IPV4 import
  peer <IPV4_SERVIDOR_RR_FLOW> route-policy RRFLOW_EXPORT_UNICAST_IPV4 export
  peer <IPV4_SERVIDOR_RR_FLOW> advertise-community
  peer <IPV4_SERVIDOR_RR_FLOW> advertise-ext-community
  peer <IPV4_SERVIDOR_RR_FLOW> advertise-large-community
  peer <IPV4_SERVIDOR_RR_FLOW> capability-advertise add-path send
  peer <IPV4_SERVIDOR_RR_FLOW> advertise add-path path-number <NUMERO_DE_SALTOS_EXPORTADO>
  bestroute add-path path-number <NUMERO_DE_SALTOS_EXPORTADO>

 ipv6-family unicast
  peer <IPV6_SERVIDOR_RR_FLOW> enable
  y
  peer <IPV6_SERVIDOR_RR_FLOW> public-as-only
  peer <IPV6_SERVIDOR_RR_FLOW> route-policy RRFLOW_IMPORT_UNICAST_IPV6 import
  peer <IPV6_SERVIDOR_RR_FLOW> route-policy RRFLOW_EXPORT_UNICAST_IPV6 export
  peer <IPV6_SERVIDOR_RR_FLOW> advertise-community
  peer <IPV6_SERVIDOR_RR_FLOW> advertise-ext-community
  peer <IPV6_SERVIDOR_RR_FLOW> advertise-large-community
  peer <IPV6_SERVIDOR_RR_FLOW> capability-advertise add-path send
  peer <IPV6_SERVIDOR_RR_FLOW> advertise add-path path-number <NUMERO_DE_SALTOS_EXPORTADO>
  bestroute add-path path-number <NUMERO_DE_SALTOS_EXPORTADO>

 ipv4-family flow
  peer <IPV4_SERVIDOR_RR_FLOW> enable 
  y 
  peer <IPV4_SERVIDOR_RR_FLOW> route-policy RRFLOW_IMPORT_FLOWSPEC_IPV4 import
  peer <IPV4_SERVIDOR_RR_FLOW> route-policy RRFLOW_EXPORT_FLOWSPEC_IPV4 export
  peer <IPV4_SERVIDOR_RR_FLOW> redirect ip rfc-compatible
  peer <IPV4_SERVIDOR_RR_FLOW> validation-disable
  peer <IPV4_SERVIDOR_RR_FLOW> advertise-community
  peer <IPV4_SERVIDOR_RR_FLOW> advertise-large-community  
  route validation-mode include-as

 ipv6-family flow
  peer <IPV6_SERVIDOR_RR_FLOW> enable
  y
  peer <IPV6_SERVIDOR_RR_FLOW> route-policy RRFLOW_IMPORT_FLOWSPEC_IPV6 import
  peer <IPV6_SERVIDOR_RR_FLOW> route-policy RRFLOW_EXPORT_FLOWSPEC_IPV6 export
  peer <IPV6_SERVIDOR_RR_FLOW> validation-disable
  peer <IPV6_SERVIDOR_RR_FLOW> advertise-community
  peer <IPV6_SERVIDOR_RR_FLOW> advertise-large-community
  route validation-mode include-as
  y

commit
run save
y
Testes

display bgp flow routing-table verbose
display bgp flow ipv6 routing-table verbose

display bgp flow peer
display bgp flow ipv6 peer

display bgp flow peer <IPV4_SERVIDOR_RR_FLOW> verbose 
display bgp flow ipv6 peer <IPV6_SERVIDOR_RR_FLOW> verbose

dis bgp flow routing-table peer <IPV4_SERVIDOR_RR_FLOW> received-routes 
dis bgp flow ipv6 routing-table peer <IPV6_SERVIDOR_RR_FLOW> received-routes

Junos

Contribuição @Maykbn utilizando MX204.

set services flow-monitoring version-ipfix template ipv4 flow-active-timeout 60
set services flow-monitoring version-ipfix template ipv4 flow-inactive-timeout 15
set services flow-monitoring version-ipfix template ipv4 template-refresh-rate seconds 30
set services flow-monitoring version-ipfix template ipv4 option-refresh-rate seconds 30
set services flow-monitoring version-ipfix template ipv4 ipv4-template
set services flow-monitoring version-ipfix template ipv6 flow-active-timeout 60
set services flow-monitoring version-ipfix template ipv6 flow-inactive-timeout 15
set services flow-monitoring version-ipfix template ipv6 template-refresh-rate seconds 30
set services flow-monitoring version-ipfix template ipv6 option-refresh-rate seconds 30
set services flow-monitoring version-ipfix template ipv6 ipv6-template
set services flow-monitoring version-ipfix template ipv6 flow-key flow-direction

set forwarding-options sampling instance netflow input rate 1024
set forwarding-options sampling instance netflow input run-length 0
set forwarding-options sampling instance netflow family inet output flow-active-timeout 60
set forwarding-options sampling instance netflow family inet output flow-server IP_DESTINO port PORTA_DESTINO
set forwarding-options sampling instance netflow family inet output flow-server IP_DESTINO autonomous-system-type origin
set forwarding-options sampling instance netflow family inet output flow-server IP_DESTINO no-local-dump
set forwarding-options sampling instance netflow family inet output flow-server IP_DESTINO version-ipfix template ipv4
set forwarding-options sampling instance netflow family inet output inline-jflow source-address IP_ORIGEM
set forwarding-options sampling instance netflow family inet6 output flow-active-timeout 60
set forwarding-options sampling instance netflow family inet6 output flow-server IP_DESTINO port PORTA_DESTINO
set forwarding-options sampling instance netflow family inet6 output flow-server IP_DESTINO autonomous-system-type origin
set forwarding-options sampling instance netflow family inet6 output flow-server IP_DESTINO no-local-dump
set forwarding-options sampling instance netflow family inet6 output flow-server IP_DESTINO version-ipfix template ipv6
set forwarding-options sampling instance netflow family inet6 output inline-jflow source-address IP_ORIGEM

set chassis fpc 0 sampling-instance netflow
set chassis fpc 0 inline-services flow-table-size ipv4-flow-table-size 10
set chassis fpc 0 inline-services flow-table-size ipv6-flow-table-size 5

# Adicione as interfaces de upstream.
set interfaces ge-0/0/0 unit 0 family inet sampling input
set interfaces ge-0/0/0 unit 0 family inet sampling output
set interfaces ge-0/0/0 unit 0 family inet6 sampling input
set interfaces ge-0/0/0 unit 0 family inet6 sampling output

Contribuição @charles_barreto utilizando MX104/MX80.

set services flow-monitoring version-ipfix template ipv4 flow-active-timeout 60
set services flow-monitoring version-ipfix template ipv4 flow-inactive-timeout 15
set services flow-monitoring version-ipfix template ipv4 template-refresh-rate seconds 30
set services flow-monitoring version-ipfix template ipv4 option-refresh-rate seconds 30
set services flow-monitoring version-ipfix template ipv4 ipv4-template
set services flow-monitoring version-ipfix template ipv6 flow-active-timeout 60
set services flow-monitoring version-ipfix template ipv6 flow-inactive-timeout 15
set services flow-monitoring version-ipfix template ipv6 template-refresh-rate seconds 30
set services flow-monitoring version-ipfix template ipv6 option-refresh-rate seconds 30
set services flow-monitoring version-ipfix template ipv6 ipv6-template
set services flow-monitoring version-ipfix template ipv6 flow-key flow-direction

set forwarding-options sampling instance netflow input rate 1024
set forwarding-options sampling instance netflow input run-length 0
set forwarding-options sampling instance netflow family inet output flow-active-timeout 15
set forwarding-options sampling instance netflow family inet output flow-server IP_DESTINO port PORTA_DESTINO
set forwarding-options sampling instance netflow family inet output flow-server IP_DESTINO autonomous-system-type origin
set forwarding-options sampling instance netflow family inet output flow-server IP_DESTINO no-local-dump
set forwarding-options sampling instance netflow family inet output flow-server IP_DESTINO version-ipfix template ipv4
set forwarding-options sampling instance netflow family inet output inline-jflow source-address IP_ORIGEM
set forwarding-options sampling instance netflow family inet6 output flow-active-timeout 15
set forwarding-options sampling instance netflow family inet6 output flow-server IP_DESTINO port PORTA_DESTINO
set forwarding-options sampling instance netflow family inet6 output flow-server IP_DESTINO autonomous-system-type origin
set forwarding-options sampling instance netflow family inet6 output flow-server IP_DESTINO no-local-dump
set forwarding-options sampling instance netflow family inet6 output flow-server IP_DESTINO version-ipfix template ipv6
set forwarding-options sampling instance netflow family inet6 output inline-jflow source-address IP_ORIGEM

set chassis afeb slot 0 sampling-instance netflow


# Adicione as interfaces de upstream.
set interfaces xe-2/0/1 unit 0 family inet sampling input
set interfaces xe-2/0/1 unit 0 family inet sampling output
set interfaces xe-2/0/1 unit 1 family inet6 sampling input
set interfaces xe-2/0/1 unit 1 family inet6 sampling output

Cisco

Nos exemplos abaixo, substitua IP_DO_RR_FLOW, IP_ORIGEM e <PORTA_DA_FONTE> pelos valores do seu ambiente. A porta é a UDP cadastrada em Operações > Fontes, não a porta HTTP da interface/API.

Exemplo 1

sampler RR_FLOW_SAMPLER
 mode random 1 out-of 1024
!

flow record RR_FLOW_RECORD_V4
  match ipv4 tos
  match ipv4 protocol
  match ipv4 source address
  match ipv4 destination address
  match transport source-port
  match transport destination-port
  match interface input
  match flow direction
  collect routing source as
  collect routing destination as
  collect routing next-hop address ipv4
  collect ipv4 dscp
  collect ipv4 id
  collect ipv4 source prefix
  collect ipv4 source mask
  collect ipv4 destination mask
  collect transport tcp flags
  collect interface output
  collect flow sampler
  collect counter bytes
  collect counter packets
  collect counter bytes long
  collect timestamp sys-uptime first
  collect timestamp sys-uptime last
!

flow record RR_FLOW_RECORD_V6
  match ipv6 traffic-class
  match ipv6 next-header
  match ipv6 source address
  match ipv6 destination address
  match transport source-port
  match transport destination-port
  match interface input
  match flow direction
  collect routing source as
  collect routing destination as
  collect routing next-hop address ipv6
  collect transport tcp flags
  collect interface output
  collect flow sampler
  collect counter bytes
  collect counter packets
  collect counter bytes long
  collect timestamp sys-uptime first
  collect timestamp sys-uptime last
!

flow exporter RR_FLOW_EXPORTER
  destination IP_DO_RR_FLOW
  source IP_ORIGEM
  transport udp <PORTA_DA_FONTE>
  template data timeout 60
!

flow monitor RR_FLOW_MONITOR_V4
  exporter RR_FLOW_EXPORTER
  cache timeout active 60
  cache timeout inactive 15
  record RR_FLOW_RECORD_V4
!

flow monitor RR_FLOW_MONITOR_V6
  exporter RR_FLOW_EXPORTER
  cache timeout active 60
  cache timeout inactive 15
  record RR_FLOW_RECORD_V6
!

! Aplicar nas interfaces de upstream:
interface GigabitEthernet0/0/0
 ip address 10.0.0.1 255.255.255.252
 ip flow monitor RR_FLOW_MONITOR_V4 input sampler RR_FLOW_SAMPLER
 ip flow monitor RR_FLOW_MONITOR_V4 output sampler RR_FLOW_SAMPLER
!
interface GigabitEthernet0/0/1
 ipv6 address 2001:DB8:ABCD::1/64
 ipv6 flow monitor RR_FLOW_MONITOR_V6 input sampler RR_FLOW_SAMPLER
 ipv6 flow monitor RR_FLOW_MONITOR_V6 output sampler RR_FLOW_SAMPLER
!
interface GigabitEthernet0/0/2
 ip address 10.0.0.1 255.255.255.252
 ipv6 address 2001:DB8:ABCD::1/64
 ip flow monitor RR_FLOW_MONITOR_V4 input sampler RR_FLOW_SAMPLER
 ip flow monitor RR_FLOW_MONITOR_V4 output sampler RR_FLOW_SAMPLER
 ipv6 flow monitor RR_FLOW_MONITOR_V6 input sampler RR_FLOW_SAMPLER
 ipv6 flow monitor RR_FLOW_MONITOR_V6 output sampler RR_FLOW_SAMPLER
!

Exemplo 2

!
flow record RR_FLOW_RECORD_V4
  match ipv4 source address
  match ipv4 destination address
  match transport source-port
  match transport destination-port
  match bgp source-as
  match bgp destination-as
  collect counter bytes long
  collect counter packets long
  collect timestamp sys-uptime first
  collect timestamp sys-uptime last
!
flow record RR_FLOW_RECORD_V6
  match ipv6 source address
  match ipv6 destination address
  match transport source-port
  match transport destination-port
  match bgp source-as
  match bgp destination-as  
  collect counter bytes long
  collect counter packets long
  collect timestamp sys-uptime first
  collect timestamp sys-uptime last
!
!
flow exporter RR_FLOW_EXPORTER
  destination IP_DO_RR_FLOW
  source IP_ORIGEM
  transport udp <PORTA_DA_FONTE>
  template data timeout 60
!
!
flow monitor RR_FLOW_MONITOR_V4
  exporter RR_FLOW_EXPORTER
  cache timeout active 60
  cache timeout inactive 15
  record RR_FLOW_RECORD_V4
!
flow monitor RR_FLOW_MONITOR_V6
  exporter RR_FLOW_EXPORTER
  cache timeout active 60
  cache timeout inactive 15
  record RR_FLOW_RECORD_V6
!
!
! Aplicar o NetFlow às interfaces de upstream, exemplos:
!
!
interface GigabitEthernet0/0/0
  ip address 10.0.0.1 255.255.255.252
  ip flow monitor RR_FLOW_MONITOR_V4 input
  ip flow monitor RR_FLOW_MONITOR_V4 output
!
interface GigabitEthernet0/0/1
  ipv6 address 2001:DB8:ABCD::1/64
  ipv6 flow monitor RR_FLOW_MONITOR_V6 input
  ipv6 flow monitor RR_FLOW_MONITOR_V6 output
!
interface GigabitEthernet0/0/2
  ip address 10.0.0.1 255.255.255.252
  ipv6 address 2001:DB8:ABCD::1/64
  ip flow monitor RR_FLOW_MONITOR_V4 input
  ip flow monitor RR_FLOW_MONITOR_V4 output
  ipv6 flow monitor RR_FLOW_MONITOR_V6 input
  ipv6 flow monitor RR_FLOW_MONITOR_V6 output
!

Exemplo 3

!
flow record RR_FLOW_RECORD_V4
  match ipv4 tos
  match ipv4 protocol
  match ipv4 source address
  match ipv4 destination address
  match transport source-port
  match transport destination-port
  match interface input
  match flow direction
  collect routing source as
  collect routing destination as
  collect routing next-hop address ipv4
  collect ipv4 dscp
  collect ipv4 id
  collect ipv4 source prefix
  collect ipv4 source mask
  collect ipv4 destination mask
  collect transport tcp flags
  collect interface output
  collect flow sampler
  collect counter bytes
  collect counter packets
  collect counter bytes long
  collect timestamp sys-uptime first
  collect timestamp sys-uptime last
!
flow record RR_FLOW_RECORD_V6
  match ipv6 traffic-class
  match ipv6 next-header
  match ipv6 source address
  match ipv6 destination address
  match transport source-port
  match transport destination-port
  match interface input
  match flow direction
  collect routing source as
  collect routing destination as
  collect routing next-hop address ipv6
  collect transport tcp flags
  collect interface output
  collect flow sampler
  collect counter bytes
  collect counter packets
  collect counter bytes long
  collect timestamp sys-uptime first
  collect timestamp sys-uptime last
!
!
flow exporter RR_FLOW_EXPORTER
  destination IP_DO_RR_FLOW
  source IP_ORIGEM
  transport udp <PORTA_DA_FONTE>
  template data timeout 60
!
!
flow monitor RR_FLOW_MONITOR_V4
  exporter RR_FLOW_EXPORTER
  cache timeout active 60
  cache timeout inactive 15
  record RR_FLOW_RECORD_V4
!
flow monitor RR_FLOW_MONITOR_V6
  exporter RR_FLOW_EXPORTER
  cache timeout active 60
  cache timeout inactive 15
  record RR_FLOW_RECORD_V6
!
!
! Aplicar o NetFlow às interfaces de upstream, exemplos:
!
!
interface GigabitEthernet0/0/0
  ip address 10.0.0.1 255.255.255.252
  ip flow monitor RR_FLOW_MONITOR_V4 input
  ip flow monitor RR_FLOW_MONITOR_V4 output
!
interface GigabitEthernet0/0/1
  ipv6 address 2001:DB8:ABCD::1/64
  ipv6 flow monitor RR_FLOW_MONITOR_V6 input
  ipv6 flow monitor RR_FLOW_MONITOR_V6 output
!
interface GigabitEthernet0/0/2
  ip address 10.0.0.1 255.255.255.252
  ipv6 address 2001:DB8:ABCD::1/64
  ip flow monitor RR_FLOW_MONITOR_V4 input
  ip flow monitor RR_FLOW_MONITOR_V4 output
  ipv6 flow monitor RR_FLOW_MONITOR_V6 input
  ipv6 flow monitor RR_FLOW_MONITOR_V6 output
!

Nokia

Configuração do netflow

configure system security source-address application cflowd <IP_ORIGEM>
configure cflowd
    active-flow-timeout 60    
    inactive-flow-timeout 15
    cache-size 102400
    overflow 10
    use-vrtr-if-index
    template-retransmit 60
    sample-profile 1 create
            sample-rate 1024
    exit
    collector <IP_DO_RR_FLOW>:<PORTA_DA_FONTE> version 9
            description "RR_FLOW"
            router Base
            no shutdown
exit

Habilita a coleta das interfaces de Upstream.

configure router interface "UPSTREAM_OPERADORA"
  cflowd-parameters
      sampling unicast type interface direction ingress sample-profile 1

Comandos para debugar

show cflowd status
show cflowd collector
show cflowd collector detail
show cflowd interface

Sugestão para ajustar a Hora (NTP)

configure system time ntp no shutdown
configure system time zone BRT -03
configure system time ntp server 200.160.7.186
configure system time ntp server 201.49.148.135
Hora Manualmente
admin set-time 2025/02/13 12:01:00


Linux

Sem suporte a dados de ASN

Nos exemplos abaixo, softflowd e fprobe não fornecem dados de ASN nos fluxos. Por isso, informações que dependem de ASN não estarão disponíveis nos dashboards.

Para resolver essa limitação, recomenda-se utilizar a funcionalidade Proxyflow, que adiciona os dados de ASN automaticamente.

Ao cadastrar a fonte Linux em Operações > Fontes, defina Amostragem como 1 para os exemplos abaixo, pois eles exportam os fluxos sem amostragem de pacotes. Caso configure amostragem no exportador, informe no RR Flow o fator real utilizado. Consulte Operações > Fontes.

Utilizando softflowd

Instalação

Debian e Ubuntu:

apt update
apt install softflowd

Em outras distribuições, confirme o nome e a disponibilidade do pacote no repositório oficial antes da instalação.

Configuração e Execução

Para iniciar o softflowd monitorando a interface eth0 e exportando os dados para a porta UDP cadastrada na fonte do RR Flow, utilize:

softflowd -i eth0 -v 9 -t general=15s -t maxlife=60s -n <IP_DO_RR_FLOW>:<PORTA_DA_FONTE>

Exemplo:

softflowd -i eth0 -v 9 -t general=15s -t maxlife=60s -n 10.20.30.40:3055

Parâmetros:

  • -i eth0: Especifica a interface de rede a ser monitorada.
  • -v 9: Define a versão do NetFlow para 9.
  • -t general=15s: Define o tempo de inatividade após o qual um fluxo é considerado expirado.
  • -t maxlife=60s: Define a duração máxima de vida de um fluxo.
  • -n <IP_DO_RR_FLOW>:<PORTA_DA_FONTE>: endereço do servidor RR Flow e porta UDP configurada em Operações > Fontes. Não é a porta HTTP da interface/API.

Execução Contínua

Primeiro, verifique se o pacote já fornece e mantém uma instância do serviço:

systemctl status softflowd
systemctl cat softflowd

Se essa unit existir, configure-a conforme o padrão da sua distribuição e não inicie uma segunda instância. Somente quando não houver uma unit utilizável, crie uma com nome próprio para não sobrescrever arquivos do pacote:

  1. Crie o arquivo de serviço:
nano /etc/systemd/system/rr-flow-softflowd.service
  1. Adicione o seguinte conteúdo:
[Unit]
Description=Softflowd NetFlow Exporter
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/sbin/softflowd -d -i eth0 -v 9 -t general=15s -t maxlife=60s -n <IP_DO_RR_FLOW>:<PORTA_DA_FONTE>
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

O parâmetro -d mantém o processo em primeiro plano para que o systemd acompanhe corretamente sua execução. Confirme antes o caminho do binário com command -v softflowd e ajuste ExecStart se necessário.

  1. Salve e saia do editor.

  2. Ative e inicie o serviço:

systemctl daemon-reload
systemctl enable --now rr-flow-softflowd.service

Utilizando fprobe

Instalação

Debian e Ubuntu:

apt update
apt install fprobe

Em outras distribuições, confirme o nome e a disponibilidade do pacote no repositório oficial antes da instalação.

Configuração e Execução

Para iniciar o fprobe monitorando a interface eth0 e exportando os dados para a porta UDP cadastrada na fonte do RR Flow, utilize:

fprobe -i eth0 -f ip -d 15 -e 60 <IP_DO_RR_FLOW>:<PORTA_DA_FONTE>

Exemplo:

fprobe -i eth0 -f ip -d 15 -e 60 10.20.30.40:3055

Parâmetros:

  • -i eth0: Especifica a interface de rede a ser monitorada.
  • -f ip: Filtra pacotes IP.
  • -d 15: Define o intervalo de inatividade após o qual um fluxo é considerado expirado.
  • -e 60: Define a duração máxima de vida de um fluxo.

Execução Contínua

Primeiro, verifique se o pacote já fornece e mantém uma instância do serviço:

systemctl status fprobe
systemctl cat fprobe

Se essa unit existir, configure-a conforme o padrão da sua distribuição e não inicie uma segunda instância. Somente quando não houver uma unit utilizável, crie uma com nome próprio:

  1. Crie o arquivo de serviço:
nano /etc/systemd/system/rr-flow-fprobe.service
  1. Adicione o seguinte conteúdo:
[Unit]
Description=fprobe NetFlow Exporter
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/sbin/fprobe -l 2 -i eth0 -f ip -d 15 -e 60 <IP_DO_RR_FLOW>:<PORTA_DA_FONTE>
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

O parâmetro -l 2 envia o log para a saída padrão e mantém o fprobe em primeiro plano para o systemd. Confirme antes o caminho do binário com command -v fprobe e ajuste ExecStart se necessário.

  1. Salve e saia do editor.

  2. Ative e inicie o serviço:

systemctl daemon-reload
systemctl enable --now rr-flow-fprobe.service

Verificação

Consulte a unit que você efetivamente configurou. Se reutilizou a unit do pacote, verifique softflowd.service ou fprobe.service:

systemctl status softflowd.service
systemctl status fprobe.service

Se criou uma das units próprias mostradas acima, utilize:

systemctl status rr-flow-softflowd.service
systemctl status rr-flow-fprobe.service

Referências


RouterOS

Nos cenários RouterOS homologados pelo RR Flow, o Traffic Flow não fornece os dados de ASN usados por alguns dashboards. Consulte a discussão técnica no fórum da MikroTik.

Para resolver essa limitação, use a funcionalidade Proxyflow, que adiciona os dados de ASN automaticamente.

Configuração

Substitua os valores antes de aplicar

Troque todos os campos entre <...> pelos valores do seu ambiente. Use 9 ou ipfix em <VERSAO>; para eventos de CGNAT, use obrigatoriamente ipfix.

/ip traffic-flow set \
    active-flow-timeout=<INTERVALO_ATIVO> \
    inactive-flow-timeout=15 \
    cache-entries=<TAMANHO_DO_CACHE> \
    enabled=yes \
    interfaces=<INTERFACES_UPSTREAM>

/ip traffic-flow target add \
    dst-address=<IP_DO_RR_FLOW> \
    port=<PORTA_DA_FONTE> \
    src-address=<IP_DE_ORIGEM_DO_ROUTER> \
    version=<VERSAO>

Use, por exemplo, 1m em <INTERVALO_ATIVO> e um valor compatível com o equipamento em <TAMANHO_DO_CACHE> (como 128k a 1M). A porta da fonte é a porta UDP cadastrada em Operações > Fontes, não a porta HTTP da interface/API.

Exemplo RouterOS v7

/ip traffic-flow set \
    active-flow-timeout=1m \
    inactive-flow-timeout=15 \
    cache-entries=512k \
    enabled=yes \
    interfaces=sfp-sfpplus1.406,sfp-sfpplus2.407 \
    packet-sampling=yes \
    sampling-interval=1 \
    sampling-space=1023

/ip traffic-flow target add \
    dst-address=172.16.10.17 \
    port=3055 \
    src-address=10.50.50.6 \
    version=9

Se desejar coletar apenas eventos de CGNAT para reduzir o volume de dados e preservar espaço em disco, ative somente nat-events=yes e desative os demais campos:

O destino deve usar IPFIX

A configuração nat-events abaixo pertence ao template IPFIX. Nesse cenário, configure o alvo de Traffic Flow com version=ipfix; o exemplo NetFlow v9 anterior não exporta esses campos IPFIX.

/ip traffic-flow ipfix set \
    nat-events=yes \
    bytes=no \
    dst-address=no \
    dst-address-mask=no \
    dst-mac-address=no \
    dst-port=no \
    first-forwarded=no \
    gateway=no \
    icmp-code=no \
    icmp-type=no \
    igmp-type=no \
    in-interface=no \
    ip-header-length=no \
    ip-total-length=no \
    ipv6-flow-label=no \
    is-multicast=no \
    last-forwarded=no \
    nat-dst-address=no \
    nat-dst-port=no  \
    nat-src-address=no \
    nat-src-port=no \
    out-interface=no \
    packets=no \
    protocol=no \
    src-address=no \
    src-address-mask=no \
    src-mac-address=no \
    src-port=no \
    sys-init-time=no \
    tcp-ack-num=no \
    tcp-flags=no \
    tcp-seq-num=no \
    tcp-window-size=no \
    tos=no \
    ttl=no \
    udp-length=no

Ajuste da fonte no RR Flow

Cadastre ou edite a fonte em Operações > Fontes:

  • Em Porta, informe o mesmo valor usado em port= no alvo de Traffic Flow do RouterOS.
  • Selecione o tipo NETFLOW e o fornecedor ROUTEROS.
  • Em Amostragem, informe o fator real configurado no roteador. No exemplo acima, sampling-interval=1 com sampling-space=1023 representa amostragem de 1 a cada 1024 pacotes; portanto, use 1024. Se packet-sampling estiver desativado, use 1. Consulte a documentação oficial do Traffic Flow.
  • Se a fonte exportar eventos de CGNAT, habilite CGNAT e selecione o tipo correspondente.
  • O active-flow-timeout controla a frequência de exportação e não deve ser usado como valor de amostragem.

Não é necessário editar arquivos JSON manualmente. Consulte Operações > Fontes para os demais campos.

Hard Offload

Se você estiver usando RouterOS v7 com Hard Offload ativado, o recurso de Traffic Flow (NetFlow) pode não funcionar corretamente.

Com o Hard Offload, o roteador usa o chip de switch (ou NPU) para encaminhar pacotes diretamente no hardware, sem envolver a CPU. Como o Traffic Flow coleta os dados na CPU, qualquer tráfego roteado apenas por hardware não será exportado para o RR Flow.

Peer BGP RouterOS

Para obter os dados via SNMP de peers (apenas v4) no RouterOS é possível a partir da versão 7.10 ou superior.


Proxyflow

O Proxyflow adiciona informações de ASN aos fluxos recebidos de exportadores que não fornecem esses dados, como RouterOS e alguns exportadores Linux. Esse processamento aumenta o consumo de CPU e deve ser habilitado apenas nas fontes que precisam do enriquecimento.

Como habilitar

  1. Acesse Operações > Fontes e adicione ou edite a fonte.
  2. Em Porta, informe a porta para a qual o roteador enviará os fluxos.
  3. Informe o fator correto em Amostragem e habilite Proxyflow.
  4. Salve a fonte. O RR Flow aloca automaticamente uma porta interna para o coletor e mostra no card a relação entre a porta do roteador e a do coletor.

Se, por exemplo, a porta da fonte for 3055, configure o exportador para enviar os fluxos à porta 3055 do RR Flow. Consulte Operações > Fontes.

Limitação em cenários com NAT

O Proxyflow não consegue reconstruir o endereço original anterior ao NAT quando o exportador envia somente o endereço já traduzido. Ele enriquece os endereços presentes no fluxo, mas não cria uma informação que não foi exportada pelo equipamento.


Logs CGNAT

A10 Networks

Registrando logs apenas dos blocos de portas alocados por PBA (Port Block Allocation)

netflow monitor RRFLOW 
  record port-batch-v2-nat44 both 
  destination <IP_DO_RR_FLOW> <PORTA_DA_FONTE>
  source-address ip IP_ORIGEM_DO_A10
!
  • port-batch-v2-nat44
    • both Export both creation and deletion events
    • creation Export only creation events
    • deletion Export only deletion events Exemplo:
      configure terminal
      netflow monitor RRFLOW 
        record port-batch-v2-nat44 both 
        destination 172.16.10.17 3056
        source-address ip 10.10.10.2
      end
      write memory
      

Cisco

!
ip nat log translations flow-export v9 udp destination <IP_DO_RR_FLOW> <PORTA_DA_FONTE> bind-only
! Exemplo
ip nat log translations flow-export v9 udp destination 10.70.70.100 3056 bind-only 
!
Voltar para o topo