Traffic policing, GTS, and rate limit configuration examples
Network requirements
As shown in Figure 11:
The server, Host A, and Host B can access the Internet through Device A and Device B.
The server, Host A, and of Device A are in the same network segment.
Host B and of Device A are in the same network segment.
Perform traffic control for the packets that of Device A receives from the server and Host A using the following guidelines:
Limit the rate of packets from the server to 10240 kbps. When the traffic rate is below 10240 kbps, the traffic is forwarded. When the traffic rate exceeds 10240 kbps, the excess packets are marked with DSCP value 0 and then forwarded.
Limit the rate of packets from Host A to 2560 kbps. When the traffic rate is below 2560 kbps, the traffic is forwarded. When the traffic rate exceeds 2560 kbps, the excess packets are dropped.
Perform traffic control on and of Device B using the following guidelines:
Limit the incoming traffic rate on to 20480 kbps, and the excess packets are dropped.
Limit the outgoing traffic rate on to 10240 kbps, and the excess packets are dropped.
Figure 11: Network diagram
Configuration procedure
Configure Device A:
# Configure ACL 2001 and ACL 2002 to permit the packets from the server and Host A, respectively.
[DeviceA] acl basic 2001 [DeviceA-acl-ipv4-basic-2001] rule permit source 1.1.1.1 0 [DeviceA-acl-ipv4-basic-2001] quit [DeviceA] acl basic 2002 [DeviceA-acl-ipv4-basic-2002] rule permit source 1.1.1.2 0 [DeviceA-acl-ipv4-basic-2002] quit
# Create a traffic class named server, and use ACL 2001 as the match criterion.
[DeviceA] traffic classifier server [DeviceA-classifier-server] if-match acl 2001 [DeviceA-classifier-server] quit
# Create a traffic class named host, and use ACL 2002 as the match criterion.
[DeviceA] traffic classifier host [DeviceA-classifier-host] if-match acl 2002 [DeviceA-classifier-host] quit
# Create a traffic behavior named server, and configure a traffic policing action (CIR 10240 kbps).
[DeviceA] traffic behavior server [DeviceA-behavior-server] car cir 10240 red remark-dscp-pass 0 [DeviceA-behavior-server] quit
# Create a traffic behavior named host, and configure a traffic policing action (CIR 2560 kbps).
[DeviceA] traffic behavior host [DeviceA-behavior-host] car cir 2560 [DeviceA-behavior-host] quit
# Create a QoS policy named car, and associate traffic classes server and host with traffic behaviors server and host in QoS policy car, respectively.
[DeviceA] qos policy car [DeviceA-qospolicy-car] classifier server behavior server [DeviceA-qospolicy-car] classifier host behavior host [DeviceA-qospolicy-car] quit
# Apply QoS policy car to the inbound direction of .
[DeviceA] interface [DeviceA-] qos apply policy car inbound
Configure Device B:
# Create ACL 3001, and configure a rule to match HTTP packets.
<DeviceB> system-view [DeviceB] acl advanced 3001 [DeviceB-acl-adv-3001] rule permit tcp destination-port eq 80 [DeviceB-acl-adv-3001] quit
# Create a traffic class named http, and use ACL 3001 as a match criterion.
[DeviceB] traffic classifier http [DeviceB-classifier-http] if-match acl 3001 [DeviceB-classifier-http] quit
# Create a traffic class named class, and configure the traffic class to match all packets.
[DeviceB] traffic classifier class [DeviceB-classifier-class] if-match any [DeviceB-classifier-class] quit
# Create a traffic behavior named car_inbound, and configure a traffic policing action (CIR 20480 kbps).
[DeviceB] traffic behavior car_inbound [DeviceB-behavior-car_inbound] car cir 20480 [DeviceB-behavior-car_inbound] quit
# Create a traffic behavior named car_outbound, and configure a traffic policing action (CIR 10240 kbps).
[DeviceB] traffic behavior car_outbound [DeviceB-behavior-car_outbound] car cir 10240 [DeviceB-behavior-car_outbound] quit
# Create a QoS policy named car_inbound, and associate traffic class class with traffic behavior car_inbound in QoS policy car_inbound.
[DeviceB] qos policy car_inbound [DeviceB-qospolicy-car_inbound] classifier class behavior car_inbound [DeviceB-qospolicy-car_inbound] quit
# Create a QoS policy named car_outbound, and associate traffic class http with traffic behavior car_outbound in QoS policy car_outbound.
[DeviceB] qos policy car_outbound [DeviceB-qospolicy-car_outbound] classifier http behavior car_outbound [DeviceB-qospolicy-car_outbound] quit
# Apply QoS policy car_inbound to the inbound direction of .
[DeviceB] interface [DeviceB-] qos apply policy car_inbound inbound
# Apply QoS policy car_outbound to the outbound direction of .
[DeviceB] interface [DeviceB-] qos apply policy car_outbound outbound