Internet Control Message Protocol (ICMP) is a fundamental component of the Internet Protocol suite, responsible for vital diagnostic, operational, and error-reporting mechanisms across IP networks. However, unconstrained ICMP traffic frequently presents security concerns. Attackers leverage ICMP echo requests for network reconnaissance, scanning for live hosts, fingerprinting topology, and conducting volumetric denial-of-service (DoS) attacks such as ping floods.
While securing network boundaries against malicious ICMP activity is a standard hardening task for network engineers, applying an uncalculated, blanket deny rule (deny icmp any any) can severely compromise network health. A flawed filtering strategy can disrupt MTU negotiation, break path diagnostics, and degrade application performance.
Securing a Cisco router against unwanted ICMP requires an architectural approach: knowing which message types to drop, which to keep, and where in the operating system to enforce filtering. This guide covers how to block ICMP on Cisco IOS routers using Extended Access Control Lists (ACLs), production-tested templates, Control Plane Policing (CoPP), Zone-Based Policy Firewalls (ZFW), and official Cisco IOS command references.
Table of Contents
Network Impact: Essential ICMP Types and Path MTU Discovery (PMTUD)
Before placing any deny rule into a production access list, network administrators must distinguish between reconnaissance utilities and critical network control plane feedback loops.
Q: Why is a blanket deny icmp any any rule dangerous?
A blanket deny rule drops both diagnostic probes (such as Echo Requests) and critical error-notification messages generated by transit routers. Dropping all ICMP traffic prevents your router and downstream hosts from learning why packets cannot reach their destination, causing protocols such as TCP to stall, time out, and drop connections silently without actionable feedback.
Q: What is Path MTU Discovery (PMTUD), and how does blocking ICMP break it?
Path MTU Discovery (RFC 1191) is a mechanism that allows endpoints to determine the maximum transmission unit (MTU) size supported along an entire network path. Endpoints send packets with the Don’t Fragment (DF) bit set in the IP header. If an intermediate router encounters an interface where the MTU is smaller than the packet size, it must drop the packet and send back an ICMP Type 3, Code 4 message: Destination Unreachable — Fragmentation Needed and DF Set.
If your Cisco router drops ICMP Type 3 Code 4 messages at an edge interface:
* The sender never receives the notification stating that the packet was too large.
* The sender repeatedly retransmits full-sized packets with the DF bit set.
* Small packets (such as TCP SYN/ACK negotiations) pass through, but large data payloads fail completely.
This condition is known as a PMTU black hole, and it manifests as web applications hanging during SSL/TLS handshakes or large file transfers stalling indefinitely.
Q: Which ICMP types should always be permitted?
To maintain standard network operations while blocking reconnaissance probes, permit the following ICMP messages:
- ICMP Type 3 (Destination Unreachable): Essential for PMTUD (Code 4), port unreachables (Code 3), and host unreachables (Code 1).
- ICMP Type 11 (Time Exceeded): Required for loop detection and standard traceroute operations (Code 0 represents Time to Live expired in transit).
- ICMP Type 0 (Echo Reply): Must be permitted inbound if your internal hosts or the router itself need to ping external endpoints and receive replies.
Q: Which ICMP types can safely be blocked or restricted?
- ICMP Type 8 (Echo Request): Used by
ping. Blocking inbound echo requests prevents remote hosts from determining whether an IP address is active. - ICMP Type 5 (Redirect): Insecure legacy mechanism that instructs hosts to update their routing tables; should virtually always be blocked at internet-facing boundaries.
- ICMP Type 13/14 (Timestamp/Timestamp Reply): Used for host clock synchronization and operating system fingerprinting; safe to block.
- ICMP Type 17/18 (Address Mask Request/Reply): Obsolete subnet discovery messages; safe to block.
Step-by-Step Guide: Blocking ICMP Ping on Cisco IOS Using Extended ACLs
To prevent external scanners from discovering the router while keeping diagnostic and path-discovery functions intact, implement an extended IP access list. Standard ACLs (numbered 1–99) only evaluate source IP addresses and cannot differentiate between protocols or ICMP message types. Extended ACLs (numbered 100–199 or named) allow granular filtering down to specific ICMP types and codes.
Step 1: Access Global Configuration Mode
Log in to your Cisco router through an authorized console or SSH session and elevate privileges:
Router> enable
Router# configure terminal
Step 2: Create a Named Extended Access Control List
Using named ACLs simplifies ongoing administration, revision editing, and readability.
Router(config)# ip access-list extended BLOCK_EXTERNAL_ICMP
Step 3: Define Permitted Diagnostic Traffic Before the Deny Rule
Because access lists operate on a top-down, first-match basis, explicitly permit required ICMP return traffic and PMTUD messages before inserting the deny statements:
Router(config-ext-nacl)# remark Allow Path MTU Discovery and error notifications
Router(config-ext-nacl)# permit icmp any any unreachable
Router(config-ext-nacl)# permit icmp any any time-exceeded
Router(config-ext-nacl)# remark Allow ping replies for outbound traffic initiated from our network
Router(config-ext-nacl)# permit icmp any any echo-reply
Step 4: Add the Deny Rule for ICMP Echo Requests
Block incoming ping requests directed to your router’s interface address or internal subnets:
Router(config-ext-nacl)# remark Block external ping probes
Router(config-ext-nacl)# deny icmp any any echo
Step 5: Permit Remaining IP Traffic
By default, Cisco IOS access lists conclude with an implicit deny ip any any. If you apply this ACL to an external interface without a trailing permit statement, all inbound traffic (web, email, VPN) will drop:
Router(config-ext-nacl)# remark Permit all other standard transit IP traffic
Router(config-ext-nacl)# permit ip any any
Router(config-ext-nacl)# exit
Step 6: Apply the ACL to the Target Interface
Assign the access list to the external, untrusted interface using the ip access-group command in the in direction:
Router(config)# interface GigabitEthernet0/0/0
Router(config-if)# description WAN_UPLINK
Router(config-if)# ip access-group BLOCK_EXTERNAL_ICMP in
Router(config-if)# exit
Step 7: Verify Filtering and Check Match Counters
Validate that the access list is successfully matching and dropping incoming echo requests:
Router# show ip access-lists BLOCK_EXTERNAL_ICMP
The output will display the rule sequence numbers and match counters:
Extended IP access list BLOCK_EXTERNAL_ICMP
10 permit icmp any any unreachable
20 permit icmp any any time-exceeded
30 permit icmp any any echo-reply (14 matches)
40 deny icmp any any echo (284 matches)
50 permit ip any any (19420 matches)
Production-Ready Cisco IOS ICMP Filtering Configuration Templates
The following modular configuration templates cover common deployment scenarios on Cisco routers. Copy and paste the appropriate block into your staging or terminal environment after replacing interface names and IP addresses.
Template 1: Drop Inbound Pings to Router Only (Allow Transit to Internal Subnets)
Use this template when border routers must drop pings directed at their own WAN IP address, while still allowing customers or internal servers to respond to ICMP.
! --- Template 1: Drop Pings to Local Router Interface Only ---
ip access-list extended ACL_EDGE_PROTECT
remark --- Permit PMTUD and Transit Diagnostics ---
permit icmp any any packet-too-big
permit icmp any any unreachable
permit icmp any any time-exceeded
permit icmp any any echo-reply
remark --- Block Ping to Router's Public Interface (Assume WAN IP is 203.0.113.1) ---
deny icmp any host 203.0.113.1 echo
remark --- Permit Remaining Transit Traffic (Including pings to internal servers) ---
permit ip any any
exit
interface GigabitEthernet0/0/0
description Internet_Facing_Interface
ip access-group ACL_EDGE_PROTECT in
exit
Template 2: Comprehensive Border Hardening (Block All Inbound Echo Requests)
This template blocks all inbound echo requests from external networks toward both the router and internal hosts, while permitting internal users to ping internet destinations and receive replies.
! --- Template 2: Comprehensive Inbound ICMP Hardening ---
ip access-list extended ACL_WAN_INBOUND_FILTER
remark --- Permit Essential Control and Diagnostic Messages ---
permit icmp any any unreachable
permit icmp any any time-exceeded
remark --- Allow Return Traffic for Locally-Initiated Pings ---
permit icmp any any echo-reply
remark --- Drop Inbound Pings and Subnet Discovery Probes ---
deny icmp any any echo
deny icmp any any redirect
deny icmp any any mask-request
deny icmp any any timestamp-request
remark --- Allow Authorized Inbound Services (Examples) ---
permit tcp any any established
permit ip any any
exit
interface GigabitEthernet0/0/0
ip access-group ACL_WAN_INBOUND_FILTER in
exit
Template 3: Strict Edge Border Egress Filter
Apply this configuration outbound on the WAN interface to prevent spoofed ICMP messages and network enumeration data from leaking out of your enterprise.
! --- Template 3: Outbound Edge Filtering ---
ip access-list extended ACL_WAN_OUTBOUND_FILTER
remark --- Block Internal RFC 1918 Address Leaks in ICMP Errors ---
deny icmp 10.0.0.0 0.255.255.255 any redirect
deny icmp 172.16.0.0 0.15.255.255 any redirect
deny icmp 192.168.0.0 0.0.255.255 any redirect
remark --- Allow PMTUD and Legitimate Outbound Traffic ---
permit icmp any any unreachable
permit icmp any any packet-too-big
permit icmp any any echo
permit ip any any
exit
interface GigabitEthernet0/0/0
ip access-group ACL_WAN_OUTBOUND_FILTER out
exit
Architectural Comparison: Interface ACLs vs. Control Plane Policing (CoPP)
Applying an access list on a physical interface is the most direct way to filter traffic, but it is not always the best architectural choice for protecting the router itself. Cisco routers divide processing into two distinct paths:
1. Data Plane: Transit traffic traversing the router from one interface to another.
2. Control Plane: Traffic addressed directly to the router’s local IP addresses (routing protocols, SSH, SNMP, and local ICMP processing).
When an attacker sends a high-volume ping flood directly to an interface IP address, the router’s CPU must generate ICMP echo-reply packets. If relying solely on standard interface ACLs, you face an all-or-nothing choice: allow all pings (risking CPU starvation during a DoS attack) or deny all pings (eliminating monitoring capabilities). Control Plane Policing (CoPP) resolves this by rate-limiting control plane traffic rather than dropping it entirely.
| Evaluation Criteria | Interface Extended ACL | Control Plane Policing (CoPP) |
|---|---|---|
| Primary Target | Data Plane (Transit) and Control Plane | Control Plane (Router CPU/Route Processor) |
| Enforcement Point | Physical or logical interfaces (ip access-group) | Control plane interface (service-policy input) |
| Action Capability | Binary action: permit or deny | Rate-limiting (police), transmit, or drop |
| DoS/Flood Mitigation | Completely blocks traffic; no rate-limiting capability | Throttles high-rate ping floods while keeping CPU responsive |
| Impact on Diagnostics | Disables all pings matching the deny statement | Allows periodic monitoring pings; drops excess burst traffic |
| Processing Mechanism | Enforced at the interface/ASIC level (hardware TCAM) | Evaluated before packets are punted to the main CPU |
| Configuration Complexity | Low (standard access list structure) | Moderate to High (requires MQC: class-maps and policy-maps) |
| Risk of PMTUD Breakage | High if configured with an unvetted deny icmp any any | Minimal; transit traffic is not evaluated by CoPP |
Recommended Architectural Approach
- Use Interface ACLs to drop malicious or unauthorized traffic destined for downstream customer networks or internal DMZs.
- Use Control Plane Policing (CoPP) to protect the router’s local infrastructure. By policing ICMP to a modest threshold (e.g., 500 kbps), network management systems can reliably monitor node availability without exposing the Route Processor to volumetric ping attacks.
Implementing ICMP Filtering with Cisco Zone-Based Policy Firewall (ZFW)
In modern enterprise architectures running Cisco IOS-XE, the router often functions as a stateful Zone-Based Policy Firewall (ZFW). ZFW moves beyond stateless ACLs by using the Cisco Modular Policy Framework (Cisco Policy Language – CPL) to inspect connections statefully across defined security boundaries.
When filtering ICMP in ZFW, traffic between interfaces in different zones is dropped by default unless explicitly permitted. Traffic destined for the router itself falls into the special Self Zone.
Step 1: Create a Class Map to Match ICMP
Define a class map that identifies ICMP traffic. You can specify match criteria using standard protocol definitions or access lists.
Router(config)# class-map type inspect match-any CMAP_ICMP
Router(config-cmap)# match protocol icmp
Router(config-cmap)# exit
Step 2: Define the Policy Map and Action
Create a policy map that determines what action to take when traffic matches the class. For stateful security, ZFW supports three primary actions:
* inspect: Stateful packet inspection (automatically permits return traffic).
* pass: Stateless forwarding (requires symmetric rules on the return path).
* drop: Drops the packet silently (or with log for audit trails).
To block ICMP echo requests while logging attempts:
Router(config)# policy-map type inspect PMAP_EXTERNAL_TO_SELF
Router(config-pmap)# class type inspect CMAP_ICMP
Router(config-pmap-c)# drop log
Router(config-pmap-c)# exit
Router(config-pmap)# class class-default
Router(config-pmap-c)# pass
Router(config-pmap-c)# exit
Router(config-pmap)# exit
Step 3: Establish Security Zones and Zone-Pairs
Assign physical interfaces to zones, and bind the policy map to a directional zone-pair linking the untrusted external zone to the local router control plane (self).
! --- Define Zones ---
Router(config)# zone security ZONE_UNTRUSTED
Router(config)# zone security ZONE_INTERNAL
! --- Assign Interfaces to Zones ---
Router(config)# interface GigabitEthernet0/0/0
Router(config-if)# zone-member security ZONE_UNTRUSTED
Router(config-if)# exit
Router(config)# interface GigabitEthernet0/0/1
Router(config-if)# zone-member security ZONE_INTERNAL
Router(config-if)# exit
! --- Create Zone-Pair toward Router CPU ---
Router(config)# zone-pair security ZPAIR_WAN_TO_SELF source ZONE_UNTRUSTED destination self
Router(config-sec-zone-pair)# service-policy type inspect PMAP_EXTERNAL_TO_SELF
Router(config-sec-zone-pair)# exit
Step 4: Verify ZFW ICMP Drops
Verify stateful drops and policy execution using the show policy-map diagnostic command:
Router# show policy-map type inspect zone-pair ZPAIR_WAN_TO_SELF
The output will display the active drop counts and verification statistics:
Zone-pair: ZPAIR_WAN_TO_SELF
Service-policy inspect : PMAP_EXTERNAL_TO_SELF
Class-map: CMAP_ICMP (match-any)
Match: protocol icmp
126 packets, 10584 bytes
Drop log: 126 packets, 10584 bytes
Class-map: class-default (match-any)
Match: any
Pass: 4210 packets, 353640 bytes
Cisco IOS Command Reference: IP Access Lists for ICMP Filtering
Below is the definitive command reference for configuring and parsing ICMP access list statements in Cisco IOS Software releases.
Command Syntax
[sequence-number] {deny | permit} icmp source source-wildcard destination destination-wildcard [icmp-type [icmp-code] | icmp-message] [log | log-input]
Parameter Specifications
sequence-number(Optional): An integer (1 to 2147483647) specifying the order of rule processing. If omitted, IOS assigns increments of 10.deny | permit: Specifies whether matching packets are dropped or forwarded.icmp: Protocol designator (IP protocol number 1).source source-wildcard: Defines the source IP. Can be an IP address with wildcard bits, the keywordany, orhost <ip-address>.destination destination-wildcard: Defines the target IP. Can be an IP address with wildcard bits,any, orhost <ip-address>.icmp-type(Optional): Integer (0–255) specifying the ICMP message type.icmp-code(Optional): Integer (0–255) specifying the sub-code for the declared ICMP type.icmp-message(Optional): Symbolic keyword representing standard ICMP types (see reference table below).log | log-input(Optional): Generates a system logging message when a packet matches the rule.log-inputincludes the incoming interface and source MAC address.
Common Cisco IOS ICMP Keywords
| Keyword | Type / Code | Description | Recommended Policy |
|---|---|---|---|
echo | Type 8 | Echo request (ping probe) | Block on untrusted interfaces |
echo-reply | Type 0 | Echo reply (ping response) | Permit inbound if internal network pings out |
unreachable | Type 3 (All codes) | Destination unreachable | Permit (Critical for error detection) |
packet-too-big | Type 3, Code 4 | Fragmentation needed, DF set | Permit (Mandatory for PMTUD) |
time-exceeded | Type 11 (All codes) | TTL expired in transit | Permit (Required for traceroute) |
redirect | Type 5 (All codes) | Route redirect | Block on perimeter interfaces |
mask-request | Type 17 | Address mask request | Block (Obsolete discovery probe) |
timestamp-request | Type 13 | Timestamp request | Block (Clock identification / fingerprinting) |
Verification and Management Commands
To inspect operational counters and interface assignments:
! View all configured access lists with sequence numbers and hit counts
Router# show ip access-lists
! View access lists bound to an interface and direction of application
Router# show ip interface GigabitEthernet0/0/0
! Clear operational packet match counters for a specific list
Router# clear ip access-list counters BLOCK_EXTERNAL_ICMP
Conclusion
Securing network perimeters against unauthorized reconnaissance does not require blinding your diagnostic systems. While unconstrained ICMP leaves routers vulnerable to scanning and CPU exhaustion, indiscriminate filtering disrupts essential mechanisms like Path MTU Discovery and packet-lifetime error reporting.
To maintain both security and operational integrity:
1. Always explicitly permit ICMP unreachable and time-exceeded messages prior to defining deny rules.
2. Permit echo-reply packets if systems on your internal networks initiate diagnostics to the outside world.
3. Apply standard Extended ACLs to protect edge data planes, while reserving Control Plane Policing (CoPP) to throttle direct volumetric attacks against your router’s processor.
4. On modern Cisco IOS-XE platforms, take advantage of Zone-Based Policy Firewalls to enforce stateful packet filtering.











Comments