{"id":337,"date":"2013-01-17T11:01:31","date_gmt":"2013-01-17T05:01:31","guid":{"rendered":"http:\/\/alexeyka.zantsev.com\/?p=337"},"modified":"2015-06-02T17:25:56","modified_gmt":"2015-06-02T12:25:56","slug":"shaping-in-slackware","status":"publish","type":"post","link":"https:\/\/alexeyka.zantsev.com\/?p=337","title":{"rendered":"Shaping in Slackware"},"content":{"rendered":"<p>An <a href=\"http:\/\/mirror.yandex.ru\/slackware\/slackware-14.0\/slackware\/n\/iproute2-3.4.0-i486-2.txz\" target=\"_blank\">&#8216;iproute2&#8217; package<\/a> (<a href=\"http:\/\/mirror.yandex.ru\/slackware\/slackware-14.0\/slackware\/n\/iproute2-3.4.0-i486-2.txt\" target=\"_blank\">description<\/a>) must be installed. Let&#8217;s imagine that we use a default kernel in which &#8216;everything is included but the kitchen sink&#8217;. :)<\/p>\n<p>FIRST. Create \/etc\/rc.d\/rc.shaper with the following code:<\/p>\n<p><code><br \/>\n#!\/bin\/bash<br \/>\nshaper_start() {<br \/>\ntc qdisc add dev eth1 root handle 1:0 htb default 254<\/p>\n<p>tc class add dev eth1 parent 1:0 classid 1:1 htb rate 0.5mbit<br \/>\ntc class add dev eth1 parent 1:0 classid 1:2 htb rate 3.3mbit<br \/>\ntc class add dev eth1 parent 1:0 classid 1:254 htb rate 256kbit<\/p>\n<p>tc filter add dev eth1 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.0.2 flowid 1:1<br \/>\ntc filter add dev eth1 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.0.3 flowid 1:2<br \/>\n}<\/p>\n<p>shaper_stop() {<br \/>\ntc qdisc del dev eth1 root<br \/>\n}<br \/>\nshaper_restart() {<br \/>\nshaper_stop<br \/>\nsleep 1<br \/>\nshaper_start<br \/>\n}<\/p>\n<p>case \"$1\" in<br \/>\n'start')<br \/>\nshaper_start<br \/>\n;;<br \/>\n'stop')<br \/>\nshaper_stop<br \/>\n;;<br \/>\n'restart')<br \/>\nshaper_restart<br \/>\n;;<br \/>\n*)<br \/>\necho \"usage $0 start|stop|restart\"<\/code><\/p>\n<p>SECOND. Make it executable: <code>chmod +x \/etc\/rc.d\/rc.shaper<\/code><\/p>\n<p>THIRD. Add to \/etc\/rc.d\/rc.inet2 these lines:<\/p>\n<p><code><br \/>\nif [ -x \/etc\/rc.d\/rc.shaper ]; then<br \/>\n\/etc\/rc.d\/rc.shaper start<br \/>\nfi<br \/>\n<\/code><\/p>\n<p>Now type <code>\/etc\/rc.d\/rc.shaper start<\/code>. After that your client with 192.168.0.2 IP address will have a 0.5 mbit\/s bandwidth and 192.168.0.3 one will have 3.3 mbit\/s. Any other IPs will have 256 kbit\/s only, as it is set in the default shaping rule.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An &#8216;iproute2&#8217; package (description) must be installed. Let&#8217;s imagine that we use a default kernel in which &#8216;everything is included but the kitchen sink&#8217;. :) FIRST. Create \/etc\/rc.d\/rc.shaper with the following code: #!\/bin\/bash shaper_start() { tc qdisc add dev eth1 root handle 1:0 htb default 254 tc class add dev eth1 parent 1:0 classid 1:1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[109,110,107,63,4,108],"class_list":["post-337","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-iproute","tag-iproute2","tag-shaper","tag-shaping","tag-slackware","tag-tc"],"_links":{"self":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=337"}],"version-history":[{"count":8,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/337\/revisions"}],"predecessor-version":[{"id":835,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/337\/revisions\/835"}],"wp:attachment":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}