组网如下图:业务主机的网关在核心,
请问能否实现把核心交换机1口的流量用qos流镜像的方式镜像到二层交换机的2口,目的只镜像业务主机特定ip段的流量,谢谢!
(0)
最佳答案
跨设备要用三层远程镜像
在一个三层网络中,Device A、Device B、Device C及Server如下图所示连接。其中,Device A通过端口HundredGigE1/0/1连接市场部。
通过配置Tunnel方式三层远程端口镜像,并建立OSPF方式的GRE隧道,使得Server可以通过由GRE隧道传输的镜像报文来监控所有进、出市场部的报文。
图1-11 Tunnel方式三层远程端口镜像配置组网图
(1) 配置IP地址
请按照图1-11配置各接口的IP地址和子网掩码,具体配置过程略。
(2) 配置Device A
# 创建业务环回组1,并配置服务类型为Tunnel。
<DeviceA> system-view
[DeviceA] service-loopback group 1 type tunnel
# 将接口HundredGigE1/0/3加入业务环回组1。
[DeviceA] interface hundredgige 1/0/3
[DeviceA-HundredGigE1/0/3] port service-loopback group 1
All configurations on the interface will be lost. Continue?[Y/N]:y
[DeviceA-HundredGigE1/0/3] quit
# 创建GRE模式的Tunnel接口1,并为其配置IP地址和掩码。
[DeviceA] interface tunnel 1 mode gre
[DeviceA-Tunnel1] ip address 50.1.1.1 24
# 为Tunnel接口1分别指定源地址和目的地址。
[DeviceA-Tunnel1] source 20.1.1.1
[DeviceA-Tunnel1] destination 30.1.1.2
[DeviceA-Tunnel1] quit
# 配置OSPF协议。
[DeviceA] ospf 1
[DeviceA-ospf-1] area 0
[DeviceA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] quit
[DeviceA-ospf-1] quit
# 创建本地镜像组1。
[DeviceA] mirroring-group 1 local
# 配置本地镜像组1的源端口为HundredGigE1/0/1,目的端口为Tunnel1。
[DeviceA] mirroring-group 1 mirroring-port hundredgige 1/0/1 both
[DeviceA] mirroring-group 1 monitor-port tunnel 1
(3) 配置Device B
# 配置OSPF协议。
<DeviceB> system-view
[DeviceB] ospf 1
[DeviceB-ospf-1] area 0
[DeviceB-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] network 30.1.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] quit
[DeviceB-ospf-1] quit
(4) 配置Device C
# 创建业务环回组1,并配置服务类型为Tunnel。
<DeviceC> system-view
[DeviceC] service-loopback group 1 type tunnel
# 将接口HundredGigE1/0/3加入业务环回组1。
[DeviceC] interface hundredgige 1/0/3
[DeviceC-HundredGigE1/0/3] port service-loopback group 1
All configurations on the interface will be lost. Continue?[Y/N]:y
[DeviceC-HundredGigE1/0/3] quit
# 创建GRE模式的Tunnel接口1,并为其配置IP地址和掩码。
[DeviceC] interface tunnel 1 mode gre
[DeviceC-Tunnel1] ip address 50.1.1.2 24
# 为Tunnel接口1分别指定源地址和目的地址。
[DeviceC-Tunnel1] source 30.1.1.2
[DeviceC-Tunnel1] destination 20.1.1.1
[DeviceC-Tunnel1] quit
# 配置OSPF协议。
[DeviceC] ospf 1
[DeviceC-ospf-1] area 0
[DeviceC-ospf-1-area-0.0.0.0] network 30.1.1.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] network 40.1.1.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] quit
[DeviceC-ospf-1] quit
# 创建本地镜像组1。
[DeviceC] mirroring-group 1 local
# 配置本地镜像组1的源端口为HundredGigE1/0/1,目的端口为HundredGigE1/0/2。
[DeviceC] mirroring-group 1 mirroring-port hundredgige 1/0/1 inbound
[DeviceC] mirroring-group 1 monitor-port hundredgige 1/0/2
# 显示Device A上所有镜像组的配置信息。
[DeviceA] display mirroring-group all
Mirroring group 1:
Type: Local
Status: Active
Mirroring port:
HundredGigE1/0/1 Both
Monitor port: Tunnel1
# 显示Device C上所有镜像组的配置信息。
[DeviceC] display mirroring-group all
Mirroring group 1:
Type: Local
Status: Active
Mirroring port:
HundredGigE1/0/1 Inbound
Monitor port: HundredGigE1/0/2
配置完成后,用户可以通过Server监控所有进、出市场部的报文。
在一个三层网络中,Device A、Device B、Device C及Server如下图所示连接。其中,Device A通过端口HundredGigE1/0/1连接市场部。
通过配置封装参数方式三层远程端口镜像,使得Server可以通过由Device C转发过来的镜像报文监控所有进、出市场部的报文。
(1) 配置IP地址
请按照图1-12配置各接口的IP地址和子网掩码,具体配置过程略。
(2) 配置Device A
# 配置OSPF协议。
[DeviceA] ospf 1
[DeviceA-ospf-1] area 0
[DeviceA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[DeviceA-ospf-1-area-0.0.0.0] quit
[DeviceA-ospf-1] quit
# 创建本地镜像组1。
[DeviceA] mirroring-group 1 local
# 配置本地镜像组1的源端口为HundredGigE1/0/1,目的端口为HundredGigE1/0/2,镜像报文的目的IP地址为40.1.1.2,源IP地址为20.1.1.1。
[DeviceA] mirroring-group 1 mirroring-port hundredgige 1/0/1 both
[DeviceA] mirroring-group 1 monitor-port hundredgige 1/0/2 destination-ip 40.1.1.2 source-ip 20.1.1.1
(3) 配置Device B
# 配置OSPF协议。
<DeviceB> system-view
[DeviceB] ospf 1
[DeviceB-ospf-1] area 0
[DeviceB-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] network 30.1.1.0 0.0.0.255
[DeviceB-ospf-1-area-0.0.0.0] quit
[DeviceB-ospf-1] quit
(4) 配置Device C
# 配置OSPF协议。
[DeviceC] ospf 1
[DeviceC-ospf-1] area 0
[DeviceC-ospf-1-area-0.0.0.0] network 30.1.1.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] network 40.1.1.0 0.0.0.255
[DeviceC-ospf-1-area-0.0.0.0] quit
[DeviceC-ospf-1] quit
# 显示Device A上所有镜像组的配置信息。
[DeviceA] display mirroring-group all
Mirroring group 1:
Type: Local
Status: Active
Mirroring port:
HundredGigE1/0/1 Both
Monitor port: HundredGigE1/0/2
Encapsulation: Destination IP address 40.1.1.2
Source IP address 20.1.1.1
Destination MAC address 000f-e241-5e5b
配置完成后,用户可以通过Server监控所有进、出市场部的报文。
(0)
感谢您给出的三层端口镜像案例,我的场景是核心和交换机二层互联,用流镜像能否实现?
用二层镜像,在monitor口做包过滤,只保留想镜像的ip地址就能实现了是吧?
可以
某公司内的各部门之间使用不同网段的IP地址,其中市场部和技术部分别使用192.168.1.0/24和192.168.2.0/24网段,该公司的工作时间为每周工作日的8点到18点。
通过配置流镜像,使Server可以监控技术部访问互联网的WWW流量,以及技术部在工作时间发往市场部的IP流量。
图2-1 流镜像典型配置组网图
# 定义工作时间:创建名为work的时间段,其时间范围为每周工作日的8点到18点。
<Device> system-view
[Device] time-range work 8:00 to 18:00 working-day
# 创建一个编号为3000的IPv4高级ACL,并定义如下规则:匹配技术部访问WWW的报文,以及在工作时间由技术部发往市场部的IP报文。
[Device] acl advanced 3000
[Device-acl-ipv4-adv-3000] rule permit tcp source 192.168.2.0 0.0.0.255 destination-port eq www
[Device-acl-ipv4-adv-3000] rule permit ip source 192.168.2.0 0.0.0.255 destination 192.168.1.0 0.0.0.255 time-range work
[Device-acl-ipv4-adv-3000] quit
# 创建流分类tech_c,并配置报文匹配规则为ACL 3000。
[Device] traffic classifier tech_c
[Device-classifier-tech_c] if-match acl 3000
[Device-classifier-tech_c] quit
# 创建流行为tech_b,并配置流镜像到接口GigabitEthernet1/0/3。
[Device] traffic behavior tech_b
[Device-behavior-tech_b] mirror-to interface gigabitethernet 1/0/3
[Device-behavior-tech_b] quit
# 创建QoS策略tech_p,在策略中为流分类tech_c指定采用流行为tech_b。
[Device] qos policy tech_p
[Device-qospolicy-tech_p] classifier tech_c behavior tech_b
[Device-qospolicy-tech_p] quit
# 将QoS策略tech_p应用到接口GigabitEthernet1/0/4的入方向上。
[Device] interface gigabitethernet 1/0/4
[Device-GigabitEthernet1/0/4] qos apply policy tech_p inbound
[Device-GigabitEthernet1/0/4] quit
配置完成后,用户可以通过Server监控技术部访问互联网的WWW流量,以及技术部在工作时间发往市场部的IP流量。
(0)
您给出的案例没有跨交换机,不是我说的组网场景。
您给出的案例没有跨交换机,不是我说的组网场景。
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
还要过滤流量吗?这个不确定能不能实现也没做过这种方式,应该有个先后的逻辑关系存在