flow 配置经验谈

enable 接口netflow ,版本不同,命令也不同

 IOS prior to releases 12.2(14)S, 12.0(22)S, or 12.2(15)T

 Cisco IOS release 12.2(14)S, 12.0(22)S, 12.2(15)T, or later

 ip route-cache flow

 ip flow {ingress | egress}

 

enable 接口netflow ,主接口和子接口,命令也不同

 

 

Enabling NetFlow on an Interface

Enabling NetFlow on a Subinterface

interface fe 0/1
 ip route-cache flow

interface fe 0/1.1
 ip flow ingress


 
要在路由口(routed)开启流采集
即要在配IP地址的接口开启流采集

在未配IP地址的接口开启流采集,相当于对所有的子接口开启流采集
If you enable NetFlow on an interface that contains subinterfaces, all the subinterfaces will be enabled automatically.
interface GigabitEthernet0/1/0
 no ip address                      
 ip route-cache flow sampled input
 
interface GigabitEthernet0/1/0.2
 encapsulation dot1Q 2
 ip address 122.64.0.145 255.255.255.252
!
interface GigabitEthernet0/1/0.996
 encapsulation dot1Q 996
 ip address 122.64.0.185 255.255.255.252

     pppoe口打开 netflow ——要配在三层接口(routed)上,即要配在virutal口上

interface GigabitEthernet2/0/0.10

 encapsulation dot1Q 10

 ip flow egress             

 pppoe enable

!

 

 

不能 配在物理口,要配在virtual-template (三层口)

interface Virtual-Template 1

 ip unnumbered ethernet 0

 encapsulation ppp

 ip flow egress

 




V5 V9
对出入流采集的支持
·   V5 V9
ip route-cache flow肯定都是不采出流的
ip flow-export version 9 peer-as bgp-nexthop
interface FastEthernet2/0
 ip address 10.193.193.21 255.255.255.0
 ip route-cache flow
·  V9 ip flow ingress/egress
肯定是采出流的
·  V5 ip flow ingress/egress
用第4647bytepad2去实现流向了,可以支持出流)
ip flow-export version 5 peer-as bgp-nexthop
interface FastEthernet2/0
 ip address 10.193.193.21 255.255.255.0
 ip flow ingress
 ip flow egress


   ROUTER
有时不支持出入流,v5,v9无关

3800-2(config)ip flow-export version 9 peer-as bgp-nexthop
3800-2(config)#int e0/0.2
3800-2(config-subif)#ip flow ?
  ingress  Enable inbound NetFlow


ip flow-export source loopback0
的用途
 
针对冗余链路造成多个源地址最终在flow分析仪上形成多个设备
 source loopback0
会使多链路显示相同的源,这样可以避免形成多个NDE(export router)设备

 ip flow-export source
的要求
source不能任意设置,必须是可达的,否则flow分析仪会报错,或将接收的flow export扔掉
source
可达不可达,主要在穿NAT防火墙时发生
解决办法:
1
。不设 source,ROUTER自动以朝向ntracker的出接口10.193.193.36source
2.
在防火墙上设static nat : 10.4.193.36 10.193.193.36

  netflow
NAT传的问题——ip flow-export source-interface lo0 ,必须是可访问的。
@  netflow
开启在NAT ROUTER
ip flow-export source
必须用public接口的地址做source ip.
@  netflow
开启在内网ROUTER
ip flow-export source
的地址最好设成能被NAT翻译的地址做源地址

 interface Loopback0
 ip address 10.26.26.26 255.255.255.255
!
ip flow-export source Loopback0

 在防火墙上设
ip nat inside source static 10.26.26.26 10.4.193.26


  ip flow-cache timeout active 1
到底是什么意思?
Active timeout:
一个active 流被监控的最大时间,超过这个时间(缺省30min),这个活动流即使未结束,也要在cache中被aging flash(老化刷新),并作成export包发出,(有点类似OSPF 30分钟路由刷新)
ip flow-cache timeout Active 1
:即对一个长时间保持的流,每隔1分钟1刷新
              
分割活动期长的流为1分钟的片段。这样可以使流量更细化
为了即时生成告警,精确显示故障排除数据,设定active 值为1分钟非常重要。

测准确性时,ip flow-cache timeout active 很重要

 一次性数据
1
18:30
下载一个29M29771296) 大的一个文件
18
35传完

18
36上传一个11.5M大小的一个文件
18: 38
传完

流量分析仪上显示
2009-01-09 18:39  174.88 KB  22.55 KB  197.43 KB  
2009-01-09 18:38  20.44 KB  17.91 KB  38.35 KB  
2009-01-09 18:37  1.27 MB  12.15 MB  13.42 MB
2009-01-09 18:36  35.66 KB  28.87 KB  64.53 KB  
2009-01-09 18:35  25.32 KB  18.86 KB  44.18 KB  
2009-01-09 18:34  31.30 MB  772.46 KB  32.07 MB  
2009-01-09 18:33  29.42 KB  23.10 KB  52.53 KB  
2009-01-09 18:32  26.63 KB  20.60 KB  47.23 KB  
2009-01-09 18:31  30.54 KB  24.12 KB  54.66 KB  
2009-01-09 18:30  1.42 MB  22.69 KB  1.44 MB

 平均性数据
下面是设了active time 1分钟的,明显数据平均多了。不会出现KM交相辉映的情况了

2009-01-12 18:39  8.56 MB  261.11 KB  8.82 MB  
2009-01-12 18:38  10.05 MB  293.90 KB  10.34 MB  
2009-01-12 18:37  8.32 MB  327.06 KB  8.65 MB  
2009-01-12 18:36  6.46 MB  191.01 KB  6.65 MB  
2009-01-12 18:35  8.92 MB  229.88 KB  9.15 MB  
2009-01-12 18:34  15.24 MB  402.34 KB  15.64 MB  
2009-01-12 18:33  9.23 MB  209.79 KB  9.44 MB


   ip flow-cache timeout inactive 15
是什么意思?
 
活动流的失效时间,过了这个时间,流将被判定为inactive,从而被老化移出CACHE,并被做成 export包发出,此TIMER是针对网络动荡和频繁通断下判定一个流是否active的条件。
缺省值为15秒。

   ip flow-cache timeout
语句只支持IOS 路由器,不支持catalyst6500/7600
Catalyst6500
有自己的timer,——MLS timer


   
如何让网络分析仪通过snmp获得接口的名称?

 snmp-server ifdex persist

snmp-server community public ro

persist: 使ifindex固定,不在reboot后改变

 
    snmp ifindex persist
尽管可以用于接口,但不支持子接口,所以还是建议全局配
snmp ifindex persistence interface command cannot be used on subinterfaces.


RFC 2233
    ifIndex
    ifName
    ifDescr

  flow
技术ifindex的特殊性
标准的snmp ifindex4字节32bit
flow七元组中的interface ifindex却是2字节16bit
所以单从flow中获得的interface ifindex是无法直接从32bit MIB库中得到对对应的ifname,ifdescr,需要一些16bit32bit的映射转换

 

你可能感兴趣的:(职场,flow,休闲,配置经验)