Limit the bandwidth of NICs in Linux

Source: Internet
Author: User
Article title: Linux limits the bandwidth of the NIC. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Linux limits the bandwidth of the NIC, which can be used to simulate the depletion of the server bandwidth, so as to test the access performance of the server at this time.

1. install iproute

Yum-y install iproute
2. limit the bandwidth of the eth0 Nic to 50 kbit:

/Sbin/tc qdisc add dev eth0 root tbf rate 50 kbit latency 50 ms burst 1000.

3. after the bandwidth limit is 50 kbit, download a large file from wget in the MB Lan:

[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... 200 OK
Length: 23862312 (23 M) [application/zip]
Saving to: 'test.zip'

37% [======>] 8,994,816 457 K/s eta 27 s

The download speed is 457 K/s.

4. remove the bandwidth limit of the eth0 Nic:

/Sbin/tc qdisc del dev eth0 root tbf

5. Comparison: if the bandwidth limit is not set, download a large file from wget in the MB Lan:

[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... 200 OK
Length: 23862312 (23 M) [application/zip]
Saving to: 'test.zip'

100% [==========>] 23,862,312 6.14 3.7 M/s in s

19:44:36 (6.16 MB/s)-'test.zip 'saved [23862312/23862312]

The download speed is 6.16 MB/s.

Http://blog.s135.com/post/380.htma

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.