所谓单向ICMP,指的是A可以ping通B;但B无法ping同A;
原理:一个完整的A到B的ICMP包括:A到B的ICMP请求(称为echo);B返回给A的ICMP响应(称为echo-reply)。要禁止一个ICMP需要:禁止echo或echo-reply任何一个即可
vlan batch 10 20
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
#
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
interface GigabitEthernet0/0/12
port link-type access
port default vlan 10
interface GigabitEthernet0/0/22
port link-type access
port default vlan 20
#方式1:拒绝VLAN10到VLAN20的ICMP请求;没有说明都允许
acl number 3000
rule 5 deny icmp source 192.168.10.1 0 destination 192.168.20.1 0 icmp-type echo
# 注意 作用于VLAN10的入口
traffic-filter vlan 10 inbound acl 3000
# 方式2:只允许VLAN20到VLAN10的ICMP回复包;其他VLAN20到VLAN10的IP包(包括Ping请求,TCP连接)全部拒绝
acl number 3000
rule 5 permit icmp source 192.168.20.1 0 destination 192.168.10.1 0 icmp-type echo-reply
rule 10 deny ip 192.168.20.0 0.0.0.255 destination 192.168.10.0 0.0.0.255
# 注意 作用于VLAN20的入口
traffic-filter vlan 20 inbound acl 3001
问题:在华为ensp模拟器上交换机没有试出来;路由器可以