华为交换机使用流策略限制客户端ping网关

前言:

我们通过在ACL里面限制ICMP的方式,实现客户端禁止ping网关的目的。

ICMP介绍

ICMP 协议应用在许多网络管理命令中,下面以 ping 和 tracert 命令为例详细介绍 ICMP 协议的应用。 

(1) ping 命令使用 ICMP 回送请求和应答报文

在网络可达性测试中使用的分组网间探测命令 ping 能产生 ICMP 回送请求和应答报文。目的主机收到 ICMP 回送请求报文后立刻回送应答报文,若源主机能收到 ICMP 回送应答报文,则说明到达该主机的网络正常。

(2)路由分析诊断程序 tracert 使用了 ICMP时间超过报文

tracert 命令主要用来显示数据包到达目的主机所经过的路径。通过执行一个 tracert 到对方主机的命令,返回数据包到达目的主机所经历的路径详细信息,并显示每个路径所消耗的时间。

实验拓补

华为交换机使用流策略限制客户端ping网关_第1张图片

实验过程


system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable 
Info: Information center is disabled.
[Huawei]sysname CORE1
[CORE1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[CORE1]interface Vlanif 1	
[CORE1-Vlanif1]ip address 192.168.1.254 24	
[CORE1-Vlanif1]dhcp select interface 	
[CORE1-Vlanif1]dhcp server dns-list 114.114.114.114
[CORE1-Vlanif1]quit 

[CORE1]acl 3000
[CORE1-acl-adv-3000]rule deny icmp source 192.168.1.0 0.0.0.255 destination 192.
168.1.254 0.0.0.0
[CORE1-acl-adv-3000]rule permit icmp source 192.168.1.0 0.0.0.0
[CORE1-acl-adv-3000]quit 

[CORE1]traffic classifier 1
[CORE1-classifier-1]if-match acl 3000
[CORE1-classifier-1]quit 

[CORE1]traffic behavior 2	
[CORE1-behavior-2]deny 	
[CORE1-behavior-2]quit 

[CORE1]traffic policy 3
[CORE1-trafficpolicy-3]classifier 1 behavior 2	
[CORE1-trafficpolicy-3]quit 


[CORE1]vlan 1
[CORE1-vlan1]traffic-policy 3 inbound 

然后我们开始测试:

使用PC1pingPC2的地址 192.168.1.252,结果是通的

华为交换机使用流策略限制客户端ping网关_第2张图片

然后我们使用PC1ping VLANIF1虚拟网关192.168.1.254,结果是不通的

华为交换机使用流策略限制客户端ping网关_第3张图片

从而实现了实验目的

你可能感兴趣的:(【华为华三】)