Token generation: Tokens are added to the token bucket regularly at the rate of CIR/EIR, and the number of tokens in the bucket is increasing. If the number of tokens in the bucket has reached CBS/EBS, the redundant tokens are discarded. Consume tokens: incoming packets will consume tokens in the bucket. In network transmission, the size of data packets is usually inconsistent. Large packets consume more tokens than small packets. Judging whether it passes or not: the result of the input packet passing through the token bucket includes the output packet and the discarded packet. When the number of tokens in the bucket can meet the demand of the packet for tokens, the packet is output, otherwise the packet is discarded.