配置丢弃指定ICMP报文示例

配置丢弃指定ICMP报文示例

组网需求

图1所示,SwitchA作为汇聚设备,下挂企业用户、个人用户以及DSLAM设备连接的用户网络。用户端网络攻击者常会发送大量的TTL为1、带选项的ICMP恶意攻击报文,导致网络流量增大,设备性能降低。为了降低网络流量,提高设备性能,需要在SwitchA上配置丢弃TTL为1、带选项ICMP报文功能,并去使能接收ICMP回显请求报文功能。

图1 配置ICMP安全功能组网图
配置丢弃指定ICMP报文示例

配置思路

配置丢弃指定ICMP报文思路如下:

  • 配置丢弃TTL为1的ICMP报文,防止针对TTL=1的ICMP报文的攻击。
  • 配置丢弃带选项的ICMP报文,防止针对带选项的ICMP报文的攻击。
  • 配置去使能接收ICMP回显请求报文功能。

操作步骤

  1. 配置各接口所属VLAN 

    # 在SwitchA上配置各接口所属VLAN。

    <HUAWEI> system-view
    [~HUAWEI] sysname SwitchA
    [*HUAWEI] commit
    [~SwitchA] vlan batch 100
    [*SwitchA] interface 10ge 1/0/1
    [*SwitchA-10GE1/0/1] port link-type trunk
    [*SwitchA-10GE1/0/1] port trunk allow-pass vlan 100
    [*SwitchA-10GE1/0/1] quit
    [*SwitchA] commit

    # 在SwitchC上配置各接口所属VLAN。

    <HUAWEI> system-view
    [~HUAWEI] sysname SwitchC
    [*HUAWEI] commit
    [~SwitchC] vlan batch 100
    [*SwitchC] interface 10ge 1/0/1
    [*SwitchC-10GE1/0/1] port link-type trunk
    [*SwitchC-10GE1/0/1] port trunk allow-pass vlan 100
    [*SwitchC-10GE1/0/1] quit
    [*SwitchC] commit

     

  2. 配置各VLANIF接口的IP地址 

    # 在SwitchA上配置接口的IP地址。

    [~SwitchA] interface vlanif 100
    [*SwitchA-Vlanif100] ip address 10.1.1.2 24
    [*SwitchA-Vlanif100] quit
    [*SwitchA] commit

     

     

    # 在SwitchC上配置接口的IP地址。

    [~SwitchC] interface vlanif 100
    [*SwitchC-Vlanif100] ip address 10.1.1.1 24
    [*SwitchC-Vlanif100] quit
    [*SwitchC] commit

     

  3. 配置丢弃某些ICMP报文 

    # 配置丢弃TTL为1的所有ICMP报文。

    [~SwitchA] icmp ttl-exceeded drop all
    [*SwitchA] commit

    # 配置丢弃带选项的所有ICMP报文。

    [~SwitchA] icmp with-options drop all
    [*SwitchA] commit

    # 去使能SwitchA接收ICMP回显请求报文功能。

    [~SwitchA] icmp name echo receive disable
    [*SwitchA] commit

     

  4. 验证配置结果 

    # 在SwitchC上执行Ping命令,可以看到SwitchA没有回应任何报文。

    [~SwitchC] ping -r 10.1.1.2
    PING 10.1.1.2: 56  data bytes, press CTRL_C to break
        Request time out
        Request time out
        Request time out
        Request time out
        Request time out
    
      --- 10.1.1.2 ping statistics ---
        5 packet(s) transmitted
        0 packet(s) received
        100.00% packet loss

     

配置文件

  • SwitchA的配置文件
    #
    sysname SwitchA
    #
    vlan batch 100
    #
    icmp name echo receive disable
    icmp ttl-exceeded drop slot 1
    icmp ttl-exceeded drop slot 2 icmp ttl-exceeded drop slot 3
    icmp with-options drop slot 1
    icmp with-options drop slot 2 icmp with-options drop slot 3
    #
    interface Vlanif100
     ip address 10.1.1.2 255.255.255.0  
    #
    interface 10GE1/0/1 
     port link-type trunk 
     port trunk allow-pass vlan 100
    #
    return
  • SwitchC的配置文件
    #
    sysname SwitchC
    #
    vlan batch 100
    #
    interface Vlanif100
     ip address 10.1.1.1 255.255.255.0
    #
    interface 10GE1/0/1 
     port link-type trunk 
     port trunk allow-pass vlan 100
    #
    return
阅读剩余
THE END