A rule matching method, comprising: receiving a packet; detecting feature information in content of the packet, and determining whether the detected feature information in the packet conforms to a classification characteristic of one rule group among a plurality of preset rule groups, wherein each rule group in the plurality of rule groups is obtained by grouping one or more rules according to a predetermined classification characteristic, and each rule group after compiling corresponds to one state machine, wherein the state machine is configured to match the packet, wherein a state machine commonly used in matching is stored in an on-chip memory with a relatively high read/write speed, and other state machines are stored in an off-chip memory with a relatively low read/write speed; and when the detected feature information conforms to a classification characteristics of one rule group among the plurality of preset rule groups, determining a state machine corresponding to the one rule group as a first state machine; determining whether the first state machine is stored in the on-chip memory, and if the first state machine is stored in the on-chip memory, using the first state machine to match the packet to obtain a matching result; and if the first state machine is not stored in the on-chip memory, when the off-chip memory stores the first state machine, loading the first state machine from the off-chip memory into the on-chip memory, and using the first state machine to match the packet to obtain a matching result, characterized in that: the grouping according to a predetermined classification characteristic comprises: determining a distinctive feature of each rule in one or more rules so that as many other rules without the distinctive feature as possible exist in the one or more rules, and grouping rules with a same distinctive feature into one group, wherein the distinctive feature is one or more consecutive characters with a predetermined quantity starting from an offset. receiving a packet; detecting feature information in content of the packet, and determining whether the detected feature information in the packet conforms to a classification characteristic of one rule group among a plurality of preset rule groups, wherein each rule group in the plurality of rule groups is obtained by grouping one or more rules according to a predetermined classification characteristic, and each rule group after compiling corresponds to one state machine, wherein the state machine is configured to match the packet, wherein a state machine commonly used in matching is stored in an on-chip memory with a relatively high read/write speed, and other state machines are stored in an off-chip memory with a relatively low read/write speed; and when the detected feature information conforms to a classification characteristics of one rule group among the plurality of preset rule groups, determining a state machine corresponding to the one rule group as a first state machine; determining whether the first state machine is stored in the on-chip memory, and if the first state machine is stored in the on-chip memory, using the first state machine to match the packet to obtain a matching result; and if the first state machine is not stored in the on-chip memory, when the off-chip memory stores the first state machine, loading the first state machine from the off-chip memory into the on-chip memory, and using the first state machine to match the packet to obtain a matching result, characterized in that: the grouping according to a predetermined classification characteristic comprises: determining a distinctive feature of each rule in one or more rules so that as many other rules without the distinctive feature as possible exist in the one or more rules, and grouping rules with a same distinctive feature into one group, wherein the distinctive feature is one or more consecutive characters with a predetermined quantity starting from an offset. the grouping according to a predetermined classification characteristic comprises: determining a distinctive feature of each rule in one or more rules so that as many other rules without the distinctive feature as possible exist in the one or more rules, and grouping rules with a same distinctive feature into one group, wherein the distinctive feature is one or more consecutive characters with a predetermined quantity starting from an offset. determining a distinctive feature of each rule in one or more rules so that as many other rules without the distinctive feature as possible exist in the one or more rules, and grouping rules with a same distinctive feature into one group, wherein the distinctive feature is one or more consecutive characters with a predetermined quantity starting from an offset.