Home > Articles > Cisco > CCNA Security

Flexible Packet Matching Concepts and Configuration

A situation can develop when a new attack occurs before a method of detection has been created; these attacks are referred to as zero-day attacks. When these situations occur, it is important that the organization has the ability to setup a series of filters that can isolate the attacking traffic from the production network. This is one of the situations where the Flexible Packet Matching (FPM) feature can be put to use. This article takes a look at the FPM feature, what it can be used for and the basic steps that would be used to configure it.
Like this article? We recommend

On modern networks, there are a number of different methods that an attacker can use to take advantage and break into a network. As time goes, on these methods become more complex, and the ability to detect them mirrors this and must also become more complex. Keeping up with this cycle is the job of attack detection vendors and security specialists. A situation can develop when a new attack occurs before a method of detection has been created; these attacks are referred to as zero-day attacks. When these situations occur, it is important that the organization has the ability to setup a series of filters that can isolate the attacking traffic from the production network. This is one of the situations where the Flexible Packet Matching (FPM) feature can be put to use. This article takes a look at the FPM feature, what it can be used for and the basic steps that would be used to configure it.

Flexible Packet Matching Concepts

The FPM feature offers an extended filtering facility that provides engineers the ability to match based on a number of non-traditionally available methods. FPM removes previous filtering restraints that existed when trying to match based on specific fields in a packet as well as provides the ability to match specific bits in a packet at arbitrary depths. For example, if a signature pattern was found by the organization's information security staff, FPM could be configured to match this pattern regardless of where it existed within the packet.

There are two methods that can be used when implementing FPM to match packets. The first uses a Protocol Header Description File (PHDF), this file is simply an XML file that defines all of the fields within a specific protocol that can be used to match on. For example, one exists for IP, another exists for TCP and yet another one exists for UDP. The second method allows the engineer the ability to match based on a specific length and depth within the packet. With these two abilities combined, the engineer can match almost any possible combination.

There are a few important restrictions that exist with the FPM feature that an engineer must be aware of:

  • FPM is stateless and cannot match based on ongoing traffic flows
  • FPM currently only works with IPv4 unicast traffic
  • FPM does not work with IP traffic that utilizes the options field
  • FPM does not match noninitial fragment traffic

Flexible Packet Matching Configuration

The configuration of the FPM feature utilizes the familiar class-map, policy-map and service-policy command structure. This command structure is used by many of Cisco's features and operates in the same way. The class-map commands are used to classify what traffic is going to be matched, the policy-map commands are used to determine what action will be taken with the matched traffic, and the service-policy command is used to apply the configuration to a specific interface.

The configuration of the FPM class map can be a little confusing as two separate FPM class map types exist depending on the matching criteria that will be used. The stack class map type is used when matching will be based on specific fields that are loaded with the PHDF file. The access-control class-map is used when matching is based on fields defined with the PHDF file and when matching is only based on an arbitrary location within the packet. In an attempt to make this process clear, an example of both will be shown later in the article.

The configuration that is required to set up FPM is shown in Table 1.

Table 1

Step 1

Enter privileged mode


Step 2

Enter global configuration mode

router#configure terminal

Step 3

(Optional) Load the PHDF that will be used to match based on specific packet fields.

router(config)#load protocol location:filename

Note: Many of there are built into IOS, for example, to load the IP PHDF use system:fpm/phdf/ip.phdf.

Step 4

Configure a traffic class

router(config)#class-map type [stack | access-control] [match-all | match-any] class-map-name

Note: The stack class-map type only supports the match-all parameter.

Step 5

Configure matching criteria

router(config-cmap)#match field protocol protocol-field [eq | neq | gt | lt | range range] value next next-protocol


router(config-cmap)#match start [l2-start | l3-start] offset offset size size [eq | neq | gt | lt | range range] value

Step 6

Configure a traffic policy

router(config)#policy-map type access-control policy-map-name

Step 7

Configure a matching class-map

router(config-pmap)#class class-map-name

Step 8

Configure a policy action




Step 9

Apply the policy-map

router(config-if)#service-policy type access-control [input | output] policy-map-name

Flexible Packet Matching Configuration Examples

To ensure that a basic understanding of FPM configuration exists, a couple of examples will be shown that will give a configuration starting point. The first of these examples will use the FPM feature to match traffic based on a one byte string (0xAB) located at offset 200 starting at the layer 3 packet.

router(config)#class-map type access-control match-all sample-class
router(config-cmap)#match start l3-start offset 200 size 1 eq 0xAB
router(config-cmap)#policy-map type access-control sample-policy
router(config-pmap)#class sample-class
router(config-pmap-c)#interface fastethernet0/0
router(config-if)#service-policy type access-control input sample-policy

The second example will take advantage of the PHDF capabilities and match all FTP traffic on port 21 that also has a matching 2 byte string (0x1234) at offset 150 starting at the layer 2 frame boundary.

router(config)#load protocol system:fpm/phdf/ip.phdf
router(config)#load protocol system:fpm/phdf/tcp.phdf

router(config)#class-map type stack match-all sample-stack-class
router(config-cmap)#match field ip protocol eq 0x6 next tcp

router(config-cmap)#class-map type access-control match-all sample-access-control-class
router(config-cmap)#match field tcp dest-port eq 0x15
router(config-cmap)#match start l2-start offset 150 size 2 eq 0x1234

router(config-cmap)#policy-map type access-control sample-nest-policy
router(config-pmap)#class sample-access-control-class

router(config-pmap-c)#policy-map type access-control sample-policy
router(config-pmap)#class sample-stack-class
router(config-pmap-c)#service-policy sample-nest-policy

router(config-pmap-c)#interface fastethernet0/0
router(config-if)#service-policy type access-control input sample-policy


As can be seen from the examples, the FPM feature can be used for a vast number of matching possibilities and should be in the tool bag of any engineer requiring this functionality. It should certainly be a feature that all Cisco security engineers should be aware of, should a situation arise where an attack without a current existing signature is found. Hopefully the information contained within this article will show those unfamiliar with the feature the possibilities that exist and that can be implemented should the need arise.

Pearson IT Certification Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Pearson IT Certification and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Pearson IT Certification products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.pearsonitcertification.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020