1. Installation Iproute
The code is as follows:
Yum-y Install Iproute
2, limit the bandwidth of the Eth0 network card to 50kbit
The code is as follows:
/SBIN/TC qdisc add dev eth0 root TBF rate 50kbit Latency 50ms Burst 1000
3, limit the bandwidth of 50kbit, in the Hundred Gigabit lan wget download a large file:
The code is as follows:
[Root@localhost ~]# wget Http://192.168.1.7/test.zip
--19:40:27--Http://192.168.1.7/test.zip
Connecting to 192.168.1.7:80 ... Connected.
HTTP request sent, awaiting response ... OK
length:23862312 (23M) [Application/zip]
Saving to: ' Test.zip '
37% [=======>] 8,994,816 457k/s ETA 27s
Download speed is 457k/s, limit effect reach.
4, the ETH0 network card to remove the bandwidth limit:
The code is as follows:
/SBIN/TC Qdisc del Dev eth0 root TBF
5, Contrast: No bandwidth restrictions, in the Hundred Gigabit lan wget download a large file:
The code is as follows:
[Root@localhost ~]# wget Http://192.168.1.7/test.zip
--19:44:33--Http://192.168.1.7/test.zip
Connecting to 192.168.1.7:80 ... Connected.
HTTP request sent, awaiting response ... OK
length:23862312 (23M) [Application/zip]
Saving to: ' Test.zip '
100%[==========>] 23,862,312 6.14m/s in 3.7s
19:44:36 (6.16 MB/s)-' test.zip ' saved [23862312/23862312]
Download speed is 6.16mb/s.
User questions: Limit bandwidth of 50kbit, why download speed to reach 457k/s?
Reply: The Linux kernel relies on rough timing information for bandwidth retention. In a longer period of time, good precision can be maintained, but the result is very inaccurate in the time period measured in seconds.
Therefore, the actual use of bandwidth needs to be wget download speed, to adjust the TC bandwidth limit.