设为首页 收藏本站
查看: 3394|回复: 0

[经验分享] Cisco设备做流量监控得方法

[复制链接]

尚未签到

发表于 2018-7-18 09:49:26 | 显示全部楼层 |阅读模式
方法一:HUB(方法太简单。。。略)  方法二:TAP(太专业了。。还要另外投资)
  方法三:SPAN(就是大家常说得Port Mirror或者Port Monitor)
  1。Cat2900XL/3500XL
  2900XL(config)#interface fastethernet 0/24   //进入接口配置模式下
  2900XL(config)#port monitor fastethernet 0/1  //配置f0/1为被监视得端口
  2900XL(config)#port monitor fastethernet 0/2  //配置f0/2为被监视得端口
  通过上面得配置就可以把进出f0/1和f0/2两个端口得流量镜像到f0/24
  通过
  show port monitor可以参看交换机得SPAN配置情况
  2。Cat2950/3550/3750
  3550(config)#monitor session 1 source interface f0/1 - 3 rx
  //指定SPAN session组号为1,源端口为f0/1-f0/3,对进这三个端口的流量
  //rx-->指明是进端口得流量,tx-->出端口得流量 both 进出得流量
  3550(config)#monitor session 1 destination interface f0/4
  //指定监视端口为f0/4
  3。Cat4000/6500  with CatOS
  set span命令
  cat4k#set span 1/2 1/3
  //把1/2得流量镜像到1/3
  4。Cat4500/6500 with IOS
  同2--Cat2950/3550/3750
  方法四:VACL
  VACL=VLAN ACL=Security ACL
  只能在Cat6500上使用
  CatOS:
  c6509 (enable) set security acl ip MyCap permit tcp any any eq 443
  c6509 (enable) set security acl ip MyCap permit tcp any eq 443 any
  c6509 (enable) set security acl ip MyCap permit ip any any capture
  //排除所有访问443端口的流量,其他流量都是感兴趣的
  c6509 (enable) commit security acl MyCap
  //定义一个security ACL的name
  c6509 (enable) set security acl map MyCap 100,101
  //把security ACL应用到vlan 100和101上
  c6509 (enable) set security acl capture-ports 3/1
  //把capture的流量镜像到3/1端口上
  IOS:
  c6509(config)# access-list 100 permit ip any any
  c6509(config)# vlan access-map MyCap 10
  c6509(config-access-map)# match ip address 100
  c6509(config-access-map)# action forward capture
  c6509(config)# vlan filter MyCap vlan-list 200 , 201
  c6509(config)# interface gi3/1
  c6509(config-if)# switchport capture
  呵呵,我也来一个,主要针对路由器的,加上DragonGo的就可以针对CISCO设备来个流量分析了。非原创,是平时收集的。
  使用路由器作流量检测的几个手段
  一、ip accounting
  1、配置方法
  router(config)#int s 0/0
  router(config-if)#ip accounting output-packets
  router#sh ip accounting output-packets
  Source Destination Packets Bytes
  192.1.1.110 192.1.1.97 5 500
  172.17.246. 128 192.1.1.110 8 704
  Accounting data age is 2d23h
  或者
  router(config)#int s 0/0
  router(config-if)#ip accounting access-violations
  router#sh ip accounting [checkpoint] access-violations
  Source Destination Packets Bytes ACL
  192.1.1.110 224.0.0.5 46 3128 19
  Accounting data age is 7
  2、说明
  ●此方法如果在路由器负载特大的时候请谨慎使用,因其会使系统性能下降
  ● 基于地址对的字节数量及数据包数量统计
  ● 通常只支持outbound的数据包,及被ACL拒绝的数据包(支持IN 和 OUT方向的ACL)
  ● 只统计穿越路由器的流量,源或目的是该路由器的数据包不做统计
  ● 支持所有的switching path,除了Autonomous Switching
  ● 可以通过SNMP来访问统计值,MIB是OLD-CISCO-IP-MIB, lipAccountingTable
  ● ip accounting还支持其他的监测方式,如基于tos,mac-address等
  二、netflow
  1、配置方法
  router (config-if)#ip route-cache flow
  router (config)#ip flow-export destination 172.17.246.225 9996
  router (config)#ip flow-export version 5
  Optional configuration
  router (config)#ip flow-export source loopback 0
  router (config)#ip flow-cache entries
  router (config)#ip flow-cache timeout
  sh ip cache flow

  IP packet>  1-32 64 96 128 160 192 224 256 288 320 352 384 416 448 480
  .000 .191 .024 .009 .010 .006 .005 .008 .003 .005 .003 .003 .002 .001 .001
  512 544 576 1024 1536 2048 2560 3072 3584 4096 4608
  .001 .002 .107 .032 .578 .000 .000 .000 .000 .000 .000
  IP Flow Switching Cache, 278544 bytes
  33 active, 4063 inactive, 7975259 added
  104834714 ager polls, 0 flow alloc failures
  Active flows timeout in 30 minutes
  Inactive flows timeout in 15 seconds
  last clearing of statistics never

  Protocol Total Flows Packets Bytes Packets Active(Sec)>  -------- Flows /Sec /Flow /Pkt /Sec /Flow /Flow
  TCP-Telnet 25378 0.0 12 652 0.0 22.9 15.2
  TCP-FTP 432435 0.1 4 59 0.4 1.2 2.7
  TCP-FTPD 28670 0.0 212 1397 1.4 8.2 1.6
  TCP-WWW 4682530 1.0 15 927 16.4 2.4 4.6
  2、说明
  ● 统计基于流(包括地址对、端口号、协议类型等)的数据量
  ● 只支持inbound的流量
  ● 只支持单播
  ● 只能在主端口配置
  ● 需要和cef或fast switching一起使用
  ● 对路由器性能有影响
  10,000 active flows: 三、NBAR
  1、配置方法
  router(config)# interface FastEthernet 0/1
  router(config-if)# ip nbar protocol discovery
  router# show ip nbar protocol -discovery interface FastEthernet 6/0
  FastEthernet6/0
  Input Output
  Protocol Packet Count Packet Count
  Byte Count Byte Count
  5 minute bit rate (bps) 5 minute bit rate (bps)
  ------------------------ ------------------------ ------------------------
  http 316773 0
  26340105 0
  3000 0
  pop3 4437 7367
  2301891 339213
  3000 0
  snmp 279538 14644
  319106191 673624
  0 0
  …
  Total 17203819 151684936
  19161397327 50967034611
  4179000 6620000
  2、说明
  ● NBAR识别从4层到7层的协议信息
  ●可以基于端口统计input 和output 的bit rate (bps), packet counts, byte counts
  ● 只能在cef或dcef的基础上运行
  ● 不象netflow,没有流的概念。主要是统计目前网络中有那一些应用
  四、access-list log
  1、配置方法
  router(config)# access-list 118 permit ip any any log
  router(config)# interface FastEthernet 0/1
  router(config-if)# ip access-group 118 out
  router# show log
  router>sh log
  Syslog logging: enabled (0 messages dropped, 0 messages rate-limited, 0 flushes,
  0 overruns)
  Console logging: level debugging, 79 messages logged
  Monitor logging: level debugging, 0 messages logged
  Buffer logging: level debugging, 79 messages logged

  Logging Exception>  Trap logging: level informational, 83 message lines logged
  Log Buffer (4096 bytes):
  *May 25 05:27:50: %SEC-6-IPACCESSLOGP: list 118 permitted tcp 10.1.64.71(0) -> 10.0.29.3(0), 1 packet
  *May 25 05:28:59: %SEC-6-IPACCESSLOGP: list 118 permitted tcp 10.1.64.71(0) -> 10.0.28.128(0), 1 packet
  *May 25 05:29:19: %SEC-6-IPACCESSLOGP: list 118 permitted tcp 10.1.64.71(0) -> 10.0.29.3(0), 56 packets
  2、说明
  ● 可以使用于任何端口的input 或者output
  ● 可以看到目前端口上跑的应用
  ● 没有统计信息,只能看到有那一些地址,看不到应用统计

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-538278-1-1.html 上篇帖子: Cisco 从低端到高端的配置大全(二) 下篇帖子: cisco路由器交换机配置大全
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表