{"id":359,"date":"2023-06-29T09:39:43","date_gmt":"2023-06-29T01:39:43","guid":{"rendered":"https:\/\/www.wangzheduo.com\/?p=359"},"modified":"2023-06-29T10:20:08","modified_gmt":"2023-06-29T02:20:08","slug":"centos-wondershaper","status":"publish","type":"post","link":"https:\/\/www.wangzheduo.com\/?p=359","title":{"rendered":"centos Wondershaper"},"content":{"rendered":"<p>\u8981\u5728 CentOS 7.6 \u4e0a\u5b89\u88c5\u548c\u4f7f\u7528 Wondershaper\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u5b89\u88c5\u4f9d\u8d56\uff1a\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u5df2\u5b89\u88c5\u4ee5\u4e0b\u4f9d\u8d56\u9879\uff1a\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\"><button class=\"flex ml-auto gap-2\">Copy code<\/button><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs\">sudo yum install -y wget tc<br \/>\n<\/code><\/div>\n<\/div>\n<p>\u8fd9\u5c06\u5b89\u88c5 wget\uff08\u7528\u4e8e\u4e0b\u8f7d\u6587\u4ef6\uff09\u548c tc\uff08Traffic Control \u5de5\u5177\uff09\u3002<\/li>\n<li>\u4e0b\u8f7d Wondershaper \u811a\u672c\uff1a\u4f7f\u7528 wget \u547d\u4ee4\u4e0b\u8f7d Wondershaper \u811a\u672c\u6587\u4ef6\u3002\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash<button class=\"flex ml-auto gap-2\">Copy code<\/button><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-bash\">curl -o wondershaper https:\/\/raw.githubusercontent.com\/magnific0\/wondershaper\/master\/wondershaper<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-bash\">\u6216\u8005<br \/>\nwget https:\/\/github.com\/magnific0\/wondershaper\/raw\/master\/wondershaperu<\/code><\/div>\n<\/div>\n<\/li>\n<li>\u6388\u4e88\u6267\u884c\u6743\u9650\uff1a\u5bf9\u4e0b\u8f7d\u7684\u811a\u672c\u6587\u4ef6\u6388\u4e88\u6267\u884c\u6743\u9650\u3002\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash<button class=\"flex ml-auto gap-2\">Copy code<\/button><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-bash\"><span class=\"hljs-built_in\">chmod<\/span> +x wondershaper<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li>\u79fb\u52a8\u811a\u672c\u6587\u4ef6\uff1a\u5c06\u811a\u672c\u6587\u4ef6\u79fb\u52a8\u5230 <code>\/usr\/sbin<\/code> \u76ee\u5f55\u6216\u4efb\u4f55\u4f60\u559c\u6b22\u7684\u5176\u4ed6\u53ef\u6267\u884c\u6587\u4ef6\u8def\u5f84\u3002\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash<button class=\"flex ml-auto gap-2\">Copy code<\/button><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-bash\">sudo <span class=\"hljs-built_in\">mv<\/span> wondershaper \/usr\/sbin\/<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li>\u4f7f\u7528 Wondershaper \u8fdb\u884c\u5e26\u5bbd\u63a7\u5236\uff1a\u73b0\u5728\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 Wondershaper \u6765\u63a7\u5236\u7f51\u7edc\u63a5\u53e3\u7684\u5e26\u5bbd\u3002\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">php<button class=\"flex ml-auto gap-2\">Copy code<\/button><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-php-template\"><span class=\"xml\">sudo wondershaper <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">interface_name<\/span>&gt;<\/span> <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">download_speed<\/span>&gt;<\/span> <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">upload_speed<\/span>&gt;<\/span><br \/>\n<\/span><\/code><\/div>\n<\/div>\n<p>\u5c06 <code>&lt;interface_name&gt;<\/code> \u66ff\u6362\u4e3a\u4f60\u60f3\u8981\u63a7\u5236\u5e26\u5bbd\u7684\u7f51\u7edc\u63a5\u53e3\u540d\u79f0\uff08\u5982 eth0\u3001enp0s3 \u7b49\uff09\uff1b\u5c06 <code>&lt;download_speed&gt;<\/code> \u66ff\u6362\u4e3a\u671f\u671b\u7684\u4e0b\u8f7d\u901f\u5ea6\uff08\u4ee5 Kbps \u4e3a\u5355\u4f4d\uff09\uff1b\u5c06 <code>&lt;upload_speed&gt;<\/code> \u66ff\u6362\u4e3a\u671f\u671b\u7684\u4e0a\u4f20\u901f\u5ea6\uff08\u4ee5 Kbps \u4e3a\u5355\u4f4d\uff09\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u5c06 eth0 \u7f51\u7edc\u63a5\u53e3\u7684\u4e0b\u8f7d\u901f\u5ea6\u9650\u5236\u4e3a 1024 Kbps\uff0c\u4e0a\u4f20\u901f\u5ea6\u9650\u5236\u4e3a 512 Kbps\uff0c\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">yaml<button class=\"flex ml-auto gap-2\">Copy code<\/button><\/div>\n<div class=\"p-4 overflow-y-auto\">\n<p><code class=\"!whitespace-pre hljs language-yaml\"><code class=\"!whitespace-pre hljs language-yaml\"><span class=\"hljs-string\">sudo<\/span> <span class=\"hljs-string\">wondershaper<\/span> <span class=\"hljs-string\">eth0<\/span> <span class=\"hljs-number\">1024 <\/span><span class=\"hljs-number\">512 \u6216\u8005<\/span><\/code><\/code><\/p>\n<pre class=\"MarkdownCodeBlock_preTag__dDgT9\"><code class=\"MarkdownCodeBlock_codeTag__ipdCC\">sudo wondershaper -a eth0 -d 100 -u 100\r\n\r\n\u7528wondershaper -s -a eth0\u67e5\u770b\u662f\u5426\u8bbe\u7f6e\u6210\u529f\r\n\r\n\u7f51\u5361\u540d\u79f0\u7528 ifconfig \u547d\u4ee4\u67e5\u770b<\/code><\/pre>\n<p><code class=\"!whitespace-pre hljs language-yaml\"><\/code><\/p>\n<\/div>\n<\/div>\n<\/li>\n<li>\u505c\u6b62\u5e26\u5bbd\u63a7\u5236\uff1a\u5982\u679c\u8981\u505c\u6b62\u5e26\u5bbd\u63a7\u5236\u5e76\u6062\u590d\u539f\u59cb\u7f51\u7edc\u5e26\u5bbd\u9650\u5236\uff0c\u53ef\u4ee5\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md\">arduino<button class=\"flex ml-auto gap-2\">Copy code<\/button><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-arduino\">sudo wondershaper clear &lt;interface_name&gt;\u6216\u8005wondershaper -c -a eth0<br \/>\n<\/code><\/div>\n<\/div>\n<p>\u5c06 <code>&lt;interface_name&gt;<\/code> \u66ff\u6362\u4e3a\u4e4b\u524d\u4f7f\u7528\u7684\u7f51\u7edc\u63a5\u53e3\u540d\u79f0\u3002<\/li>\n<\/ol>\n<p>\u8bf7\u6ce8\u610f\uff0c\u5e26\u5bbd\u63a7\u5236\u4ec5\u5728\u8bbe\u7f6e\u7684\u7f51\u7edc\u63a5\u53e3\u4e0a\u751f\u6548\uff0c\u5e76\u4e14\u4ec5\u5728\u5f53\u524d\u4f1a\u8bdd\u671f\u95f4\u6709\u6548\u3002\u5982\u679c\u4f60\u5e0c\u671b\u5728\u7cfb\u7edf\u91cd\u542f\u540e\u4ecd\u7136\u751f\u6548\uff0c\u53ef\u4ee5\u8003\u8651\u5c06\u8bbe\u7f6e\u6dfb\u52a0\u5230\u542f\u52a8\u811a\u672c\u4e2d\u3002<\/p>\n<p>\u8fd9\u4e9b\u6b65\u9aa4\u5c06\u5e2e\u52a9\u4f60\u5728 CentOS 7.6 \u4e0a\u5b89\u88c5\u548c\u4f7f\u7528 Wondershaper \u8fdb\u884c\u5e26\u5bbd\u63a7\u5236\u3002\u8bf7\u786e\u4fdd\u4ee5 root \u6216 sudo \u7528\u6237\u8eab\u4efd\u6267\u884c\u547d\u4ee4\uff0c\u5e76\u6839\u636e\u4f60\u7684\u9700\u6c42\u8fdb\u884c\u76f8\u5e94\u7684\u914d\u7f6e\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u8fd9\u8868\u793a eth0 \u7f51\u7edc\u63a5\u53e3\u7684\u603b\u5e26\u5bbd\u88ab\u9650\u5236\u4e3a 4 Mbps\u3002\u540c\u65f6\uff0c\u4f60\u4e5f\u53ef\u4ee5\u770b\u5230\u4ee5\u4e0b\u4e09\u4e2a\u5b50\u7c7b\u522b\uff0c\u5b83\u4eec\u5206\u522b\u88ab\u9650\u5236\u4e3a 800 Kbps\u30011600 Kbps \u548c 800 Kbps\uff1a<\/p>\n<div>\n<div class=\"MarkdownCodeBlock_codeHeader__5MZpO\">\n<div class=\"MarkdownCodeBlock_languageName__trujB\">angelscript<\/div>\n<p><button class=\"Button_buttonBase__0QP_m Button_flat__1hj0f MarkdownCodeBlock_copyButton__nm6Dw\">Copy<\/button><\/p>\n<\/div>\n<pre class=\"MarkdownCodeBlock_preTag__dDgT9\"><code class=\"MarkdownCodeBlock_codeTag__ipdCC\">class htb 1:10 parent 1:1 leaf 10: prio 1 rate 800Kbit ceil 3800Kbit burst 1600b cburst 1599b \r\nclass htb 1:20 parent 1:1 leaf 20: prio 2 rate 1600Kbit ceil 3800Kbit burst 1600b cburst 1599b \r\nclass htb 1:30 parent 1:1 leaf 30: prio 3 rate 800Kbit ceil 3600Kbit burst 1600b cburst 1599b\r\n<\/code><\/pre>\n<\/div>\n<p>\u8fd9\u4e09\u4e2a\u5b50\u7c7b\u522b\u5206\u522b\u5bf9\u5e94\u4e09\u79cd\u4e0d\u540c\u7684\u6d41\u91cf\u7c7b\u578b\uff0c\u5b83\u4eec\u7684\u4f18\u5148\u7ea7\u4f9d\u6b21\u9012\u51cf\u3002\u4f8b\u5982\uff0c\u5b50\u7c7b\u522b 10 \u7684\u4f18\u5148\u7ea7\u6700\u9ad8\uff0c\u5b83\u7684\u4e0a\u4f20\u548c\u4e0b\u8f7d\u901f\u5ea6\u90fd\u88ab\u9650\u5236\u4e3a 800 Kbps\u3002\u5b50\u7c7b\u522b 20 \u7684\u4f18\u5148\u7ea7\u6b21\u4e4b\uff0c\u4e0a\u4f20\u548c\u4e0b\u8f7d\u901f\u5ea6\u88ab\u9650\u5236\u4e3a 1600 Kbps\u3002\u5b50\u7c7b\u522b 30 \u7684\u4f18\u5148\u7ea7\u6700\u4f4e\uff0c\u4e0a\u4f20\u548c\u4e0b\u8f7d\u901f\u5ea6\u88ab\u9650\u5236\u4e3a 800 Kbps\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u5728 CentOS 7.6 \u4e0a\u5b89\u88c5\u548c\u4f7f\u7528 Wondershaper\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a \u5b89\u88c5\u4f9d\u8d56\uff1a\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u5df2\u5b89\u88c5\u4ee5\u4e0b\u4f9d\u8d56\u9879\uff1a Copy code sudo yum install -&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-359","post","type-post","status-publish","format-standard","hentry","category-yunwei"],"_links":{"self":[{"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/posts\/359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=359"}],"version-history":[{"count":3,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/posts\/359\/revisions"}],"predecessor-version":[{"id":362,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=\/wp\/v2\/posts\/359\/revisions\/362"}],"wp:attachment":[{"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wangzheduo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}