[Enterprise SONiC] Rate-limit Follow
Tested model & firmware version:
- Switch model name:
DCS203 (AS7326-56X)
DCS201 (AS5835-54X)
EPS202 (AS4630-54PE)
- Edgecore SONiC version:
202012.2 ~ 202012.4
202111.0 ~ 202111.8
Restriction:
- The command of the rate limit on 202111 is different from the old version. (please refer to this section.)
- The command of the rate limit doesn't support the egress on 202111.
- The feature supports since 202006. The CLI supports since 202006.3. (Before 2020206.3, please modify config_db.json, refer to Appendix)
- ACL and Rate-limit cannot be used at the same time
- AS4630-54PE doesn't support rate-limit for egress.
- This feature is only supported on Broadcom switches.
Ingress rate-limit
Topology:
Pre-configuration:
- Based on default configuration, removing "BGP_NEIGHBOR" and "INTERFACE"
- Down speed to 1G on Ethernet1 and Ethernet5
admin@sonic:~$ sudo config interface breakout Ethernet5 '4x10G[1G]' -y
admin@sonic:~$ sudo config interface speed Ethernet1 1000
admin@sonic:~$ sudo config interface speed Ethernet5 1000
- Created the VLAN and allowed the VLAN member to the port.(refer to [Edgecore SONiC] VLAN & Inter-VLAN Routing)
admin@sonic:~$ show vlan brief
+-----------+--------------+-----------+----------------+---------------+---------------+-------------+-------------+
| VLAN ID | IP Address | Ports | Port Tagging | DHCP Helper | DHCP Source | DHCP Link | Proxy ARP |
| | | | | Address | Interface | Selection | |
+===========+==============+===========+================+===============+===============+=============+=============+
| 100 | | Ethernet1 | untagged | | | | disabled |
| | | Ethernet5 | untagged | | | | |
+-----------+--------------+-----------+----------------+---------------+---------------+-------------+-------------+
Procedure:
202111.1 version:
Step 1: Create the rate limit for ingress to 40mbps on Ethernet1.
admin@sonic:~$ sudo config interface rate-limit add --help
Usage: config interface rate-limit add [OPTIONS] <interface_name>
Options:
--meter-type <meter_type> [required]
--rate <rate> Maximum rate of ingress traffic in kbps or pps.
If meter-type is bytes, it can specify a decimal
number followed by the abbreviation k (1000), m
(1,000,000), or g (1,000,000,000) [required]
--burst-size <burst_size> The burst size in bytes or packets. If meter-type
is bytes, it can specify a decimal number
followed by the abbreviation k (2^10)), m (2^20)
-?, -h, --help Show this message and exit.
admin@sonic:~$ sudo config interface rate-limit add Ethernet1 --meter-type bytes --rate 40m
- "--meter_type": "packets"/"bytes"
- "--rate"
- meter_type = bytes
The format is a decimal number or a decimal number followed by the abbreviation k (1,000), m (1,000,000), or g (1,000,000,000). Minimum: 8 kbps (32 kbps for AS8000 and AS9716-32D). Maximum: 400,000,000 kbps. For example: "10", "10k".
- meter_type = packets
Minimum: 1 pps. Maximum: 148,809,523 pps. - "burst-size:
- meter_type = bytes:
The format is a decimal number of a decimal number followed by the abbreviation k (210), or m (220). Minimum: 2,000 bytes. Maximum: 256,000,000 bytes. For example: "100", "100k".
- meter_typ e= packets
Minimum: 1 pps. Maximum: 536,576 pps.
Step 2: check the status
admin@sonic:~$ show interfaces rate-limit
Interface Meter Type Rate Burst Size
----------- ------------ ------- ------------
Ethernet1 bytes 40 Mbps 48 KiB
202111.0 version:
Step 1: Create the rate limit for ingress to 40mbps on Ethernet1. (40000000/8 bits=5000000 bytes)
admin@sonic:~$ sudo config interface rate-limit add --help
Usage: config interface rate-limit add [OPTIONS] <interface_name> <meter_type>
<pir>
Options:
--burst INTEGER RANGE Maximum bandwidth burst [required]
-h, -?, --help Show this message and exit.
admin@sonic:~$ sudo config interface rate-limit add Ethernet1 bytes 5000000 --burst 8192
- "meter_type": "packets"/"bytes"
- "pir (peak information rate)": max rate in pps (packet per second)
- "PBS (peak burst size)": max burst size in packets
Step 2: check the status
admin@sonic:~$ show interfaces rate-limit
Ethernet1
Profile Meter Type Rate Burst
-------------------- ------------ ------- -------
Ethernet1_rate_limit bytes 5000000 8192
202012 version:
Step 1. Create the scheduler profile, limit the ingress to 40mbps.(40000000/8 bits=5000000 bytes)
admin@sonic:~$ sudo config qos scheduler add --help
Usage: config qos scheduler add [OPTIONS] <profile_name>
Add QoS-Scheduler profile.
Options:
--meter_type [bytes|packets] Meter type
--pir INTEGER RANGE Maximum bandwidth rate [required]
--pbs INTEGER RANGE Maximum bandwidth burst [required]
-h, -?, --help Show this message and exit.
admin@sonic:~$ sudo config qos scheduler add ingress-Ethernet1 --meter_type bytes --pir 5000000 --pbs 8192
- "meter_type": "packets"/"bytes"
- "pir": max rate in pps (packet per second)
- "pbs": max burst size in packets
Step 2. Bind the profile to specific port.
admin@sonic:~$ sudo config interface rate-limit --help
Usage: config interface rate-limit [OPTIONS] <op> <dir> <interface_name>
<profile_name>
Rate limit configuration.
Options:
-q, --queue INTEGER RANGE queue
-?, -h, --help Show this message and exit.
admin@sonic:~$ sudo config interface rate-limit bind in Ethernet1 ingress-Ethernet1
- "op": "bind/unbind"
- "dir": direction("in/out")
Step 3. Send unicast traffic from "Port//8/3" to "Port//8/4".
Result:
- Check the configuration for scheduler profile
admin@sonic:~$ show qos scheduler
Name Meter Type PIR PBS
----------------- ------------ ------- -----
ingress-Ethernet1 bytes 5000000 8192
- Check the scheduler profile binding.
admin@sonic:~$ show qos interface
Interface Ingress Port Rate Limit Egress Port Rate Limit
----------- ------------------------- ------------------------
Ethernet1 ingress-Ethernet1
- Traffic monitor for Steps 3.(40000416/8=5000052)
Egress rate-limit
Restriction:
- 202111 version doesn't support the Egress rate limit.
- AS4630-54PE doesn't support rate-limit for egress.
Pre-configuration:
Based on Ingress rate-limit configuration and unbind the scheduler configuration.
admin@sonic:~$ sudo config interface rate-limit unbind in Ethernet1 ingress-Ethernet1
admin@sonic:~$ sudo config qos scheduler del ingress-Ethernet1
Procedure:
Step 1. Create the scheduler profile, limit the egress to 20mbps.(20000000/8 bits=2500000 bytes)
admin@sonic:~$ sudo config qos scheduler add egress-Ethernet5 --meter_type bytes --pir 2500000 --pbs 8192
Step 2. Bind the profile to specific port.
admin@sonic:~$ sudo config interface rate-limit bind out Ethernet5 egress-Ethernet5
Step 3. Send unicast traffic from "Port//8/3" to "Port//8/4".
Result:
- Check the configuration for scheduler profile
admin@sonic:~$ show qos scheduler
Name Meter Type PIR PBS
---------------- ------------ ------- -----
egress-Ethernet1 bytes 2500000 8192
- Check the scheduler profile binding.
admin@sonic:~$ show qos interface
Interface Ingress Port Rate Limit Egress Port Rate Limit
----------- ------------------------- ------------------------
Ethernet5 egress-Ethernet5
- Traffic monitor for Steps 3.(20001056/8=2500132)
Appendix:
- Ingress-Ethernet1:
admin@sonic:~$ sonic-cfggen -j /etc/sonic/config_db.json --var-json=SCHEDULER
{
"ingress-Ethernet1": {
"meter_type": "bytes",
"pbs": "8192",
"pir": "5000000"
}
}
admin@sonic:~$ sonic-cfggen -j /etc/sonic/config_db.json --var-json=PORT_QOS_MAP
{
"Ethernet1": {
"ing_scheduler": "[SCHEDULER|ingress-Ethernet1]"
},
}
- egress-Ethernet5:
admin@sonic:~$ sonic-cfggen -j /etc/sonic/config_db.json --var-json=SCHEDULER
{
"egress-Ethernet5": {
"meter_type": "bytes",
"pbs": "8192",
"pir": "2500000"
}
}
admin@sonic:~$ sonic-cfggen -j /etc/sonic/config_db.json --var-json=PORT_QOS_MAP
{
"Ethernet5": {
"egr_scheduler": "[SCHEDULER|egress-Ethernet5]"
}
}
Comments
0 comments
Please sign in to leave a comment.