摘要 |
Embodiments of the present invention provide an anti-replay method and apparatus. A same maximum agreed value is set at a transmit end and a receive end, the receive end receives an IPSec packet, where the IPSec packet includes a sequence number, and acquires an upper limit value of an anti-replay sliding window; and if the upper limit value of the anti-replay sliding window is the maximum agreed value, the receive end sets an interval of the anti-replay sliding window to M1 to M2, where M1 is a minimum value of the packet sequence number, and M2 is a sum of M1 and a size of the anti-replay sliding window. When a sequence number of a packet sent by the transmit end reaches a maximum value, a sequence number of a next sent packet starts from the minimum value, thereby resolving a problem that a packet is falsely discarded because of anti-replay. |