• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

H3C 园区盒式交换机典型配置举例-6W100

目录

45-sFlow典型配置举例

本章节下载 45-sFlow典型配置举例  (185.39 KB)

docurl=/cn/Service/Document_Software/Document_Center/Home/Switches/00-Public/Configure/Typical_Configuration_Example/H3C_CE-B70D022-6W100/202012/1371470_30005_0.htm

45-sFlow典型配置举例


1  简介

本文介绍了sFlow的典型配置举例。

2  配置前提

本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。

本文假设您已了解sFlow特性。

3  使用限制

目前Flow采样的采样模式仅支持随机采样(缺省模式),暂不支持固定采样。

4  sFlow典型配置举例

4.1  组网需求

图1所示,在某园区网中,教务处、实验室/图书馆均可以访问教育网,但是在实际的访问过程中前者比后者的数据访问流量大。现要求在Device A和Device B上配置sFlow功能,使Collector Server(服务端口号为5000)能够对教务处、实验室/图书馆机房网络的出、入方向流量进行采样,从而可以获取流经端口的数据包的相关信息和该端口的报文统计信息。

图1 sFlow典型配置举例

 

4.2  配置思路

·            Flow采样是基于数据包的流采样,用于获取数据包内容的相关信息。在接口数据流量大的网络环境中,为防止采样到数据过多,可以配置较低的Flow采样率;在接口数据流量小的网络环境中,为防止采样到的数据过少,可以配置较高的Flow采样率。

·            Counter采样是基于时间的接口统计信息采样,用于获取接口的报文统计信息。在接口数据流量大的网络环境中,为防止采样过于频繁,可以配置较大的Counter采样时间间隔;在接口数据流量小的网络环境中,为保证采样统计更加精确,可以配置较小的Counter采样时间间隔。

·            为了获取流经端口的数据包内容的相关信息和该端口的报文统计信息,需要同时配置Flow采样和Counter采样功能。

4.3  适用产品及版本

表1 适用产品及版本

产品

软件版本

S5560X-EI系列

Release 63xx系列

S5560X-HI系列

Release 63xx系列

S5500V2-EI系列

Release 63xx系列

MS4520V2-30F

Release 63xx系列

S6520X-HI系列

S6520X-EI系列

Release 63xx系列

S6520X-SI系列

S6520-SI系列

Release 63xx系列

S5000-EI系列

Release 63xx系列

MS4600系列

Release 63xx系列

S5560S-EI系列

S5560S-SI系列

Release 63xx系列

S5130S-HI系列

S5130S-EI系列

S5130S-SI系列

S5130S-LI系列

Release 63xx系列

S5120V2-SI系列

S5120V2-LI系列

Release 63xx系列

S3100V3-EI系列

S3100V3-SI系列

Release 63xx系列

S5110V2系列

Release 63xx系列

S5110V2-SI系列

Release 63xx系列

S5000V3-EI系列

Release 63xx系列

S5000E-X系列

Release 63xx系列

E128C

E152C

E500C系列

E500D系列

Release 63xx系列

MS4520V2系列(除MS4520V2-30F)

Release 63xx系列

MS4320V2系列

MS4300V2系列

MS4320系列

MS4200系列

Release 63xx系列

WS5850-WiNet系列

Release 63xx系列

WS5820-WiNet系列

WS5810-WiNet系列

Release 63xx系列

WAS6000系列

Release 63xx系列

 

S5130S-HI系列、S5130S-EI系列、S3100V3-EI系列、E128C、E152C、E500C系列和E500D系列不支持port link-mode命令,所以4.7  配置文件中不会显示port link-mode bridge。

4.4  配置注意事项

·            进行sFlow相关配置前,请在各设备上配置路由,并确保各间路由可达,具体配置过程略。

·            在设备上配置的sFlow Collector的IP地址和远端的sFlow Collector的IP地址需保持一致,否则会导致远端的sFlow Collector无法收到sFlow报文。

4.5  配置步骤

(1)       Device A的配置

# 创建VLAN 10,并向VLAN 10中添加端口GigabitEthernet1/0/1~GigabitEthernet1/0/3。

<DeviceA> system-view

[DeviceA] vlan 10

[DeviceA-vlan10] port gigabitethernet 1/0/1 to gigabitethernet 1/0/3

[DeviceA-vlan10] quit

# 配置VLAN接口10的IP地址为10.1.1.1/24。请参考此方法配置图1中其它接口的IP地址,配置步骤这里省略。

[DeviceA] interface vlan-interface 10

[DeviceA-Vlan-interface10] ip address 10.1.1.1 255.255.255.0

[DeviceA-Vlan-interface10] quit

# 配置sFlow Agent的IP地址。

[DeviceA] sflow agent ip 10.1.1.1

# 配置sFlow Collector信息:指定sFlow Collector的ID为1,IP地址为30.1.1.2,端口号为5000。

[DeviceA] sflow collector 1 ip 30.1.1.2 port 5000

# 配置Counter采样,以使设备能够获取对应端口的报文统计信息:采样时间间隔为120秒(即每隔120秒对端口的报文统计信息采样一次),且经过Counter采样后,sFlow Agent输出sFlow报文的目的sFlow Collector编号为1。

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] sflow counter interval 120

[DeviceA-GigabitEthernet1/0/1] sflow counter collector 1

[DeviceA-GigabitEthernet1/0/1] quit

[DeviceA] interface gigabitethernet 1/0/2

[DeviceA-GigabitEthernet1/0/2] sflow counter interval 120

[DeviceA-GigabitEthernet1/0/2] sflow counter collector 1

[DeviceA-GigabitEthernet1/0/2] quit

# 配置Flow采样,以使设备能够获取流经端口的数据包的相关信息:采样率为100000(即在100000个报文中抽取一个报文进行采样),且经过Flow采样后,sFlow Agent输出sFlow报文的目的sFlow Collector编号为1。

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] sflow sampling-rate 100000

[DeviceA-GigabitEthernet1/0/1] sflow flow collector 1

[DeviceA-GigabitEthernet1/0/1] quit

[DeviceA] interface gigabitethernet 1/0/2

[DeviceA-GigabitEthernet1/0/2] sflow sampling-rate 100000

[DeviceA-GigabitEthernet1/0/2] sflow flow collector 1

[DeviceA-GigabitEthernet1/0/2] quit

(2)       Device B的配置

# 创建VLAN 20,并向VLAN 20中添加端口GigabitEthernet1/0/1和端口GigabitEthernet1/0/2。

<DeviceB> system-view

[DeviceB] vlan 20

[DeviceB-vlan20] port gigabitethernet 1/0/1 to gigabitethernet 1/0/2

[DeviceB-vlan20] quit

# 配置VLAN接口20的IP地址为20.1.1.1/24。

[DeviceB] interface vlan-interface 20

[DeviceB-Vlan-interface20] ip address 20.1.1.1 255.255.255.0

[DeviceB-Vlan-interface20] quit

# 配置sFlow Agent的IP地址。

[DeviceB] sflow agent ip 20.1.1.1

# 配置sFlow Collector信息:指定sFlow Collector的ID、IP地址和端口号。

[DeviceB] sflow collector 1 ip 30.1.1.2 port 5000

# 配置Counter采样,以使设备能够获取对应端口的报文统计信息:采样时间间隔为30秒,且经过Counter采样后,sFlow Agent输出sFlow报文的目的sFlow Collector编号为1。

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] sflow counter interval 30

[DeviceB-GigabitEthernet1/0/1] sflow counter collector 1

# 配置Flow采样,以使设备能够获取流经端口的数据包的相关信息:采样率为20000(即在20000个报文中抽取一个报文进行采样),且经过Flow采样后,sFlow Agent输出sFlow报文的目的sFlow Collector编号为1。

[DeviceB-GigabitEthernet1/0/1] sflow sampling-rate 20000

[DeviceB-GigabitEthernet1/0/1] sflow flow collector 1

[DeviceB-GigabitEthernet1/0/1] quit

4.6  验证配置

# 以Device A为例,使用命令display sflow查看各sFlow的配置信息。

[DeviceA] display sflow

sFlow datagram version: 5

Global information:

Agent IP: 10.1.1.1(CLI)

Source address:

Collector information:

ID    IP              Port  Aging      Size VPN-instance Description

1     30.1.1.2         5000  N/A        1400              CLI Collector

Port information:

Interface      CID   Interval(s) FID   MaxHLen Rate       Mode          Status

GE1/0/1         1    120         1     128     100000     random        Active

GE1/0/2         1    120         1     128     100000     random        Active

以上信息表明,接口GigabitEthernet1/0/1和接口GigabitEthernet1/0/2已开启sFlow功能并处于“Active”状态,sFlow功能正在正常运行,并且Counter采样的时间间隔为120秒,Flow采样的报文采样率为100000。

4.7  配置文件

·            Device A:

#

vlan 10

#

interface Vlan-interface10

 ip address 10.1.1.1 255.255.255.0

#

 sflow agent ip 10.1.1.1

 sflow collector 1 ip 30.1.1.2 port 5000 description "CLI Collector"

#

interface GigabitEthernet1/0/1

 port link-mode bridge

 port access vlan 10

 sflow flow collector 1

 sflow sampling-rate 100000

 sflow counter collector 1

 sflow counter interval 120

#

interface GigabitEthernet1/0/2

 port link-mode bridge

 port access vlan 10

 sflow flow collector 1

 sflow sampling-rate 100000

 sflow counter collector 1

 sflow counter interval 120

#

interface GigabitEthernet1/0/3

 port link-mode bridge

 port access vlan 10

#

·            Device B:

#

vlan 20

#

interface Vlan-interface20

 ip address 20.1.1.1 255.255.255.0

#

 sflow agent ip 20.1.1.1

 sflow collector 1 ip 30.1.1.2 port 5000 description "CLI Collector"

#

interface GigabitEthernet1/0/1

 port link-mode bridge

 port access vlan 20

 sflow flow collector 1

 sflow sampling-rate 20000

 sflow counter collector 1

 sflow counter interval 30

#

interface GigabitEthernet1/0/2

 port link-mode bridge

 port access vlan 20

#

 

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们