aquaballoon

Bandwidth HTB

May 24th, 2012
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.17 KB | None | 0 0
  1. #http://manngupta.wordpress.com/bandwidth-management-with-htb/
  2.  
  3. cd /usr/local/src
  4.  
  5. wget http://www.udiniqgeek.com/download/HTB-tools-0.3.0a-i486-1.tgz
  6. or, http://downloads.ziddu.com/downloadfile/16666271/HTB-tools-0.3.0a-i486-1.tgz
  7.  
  8. tar -zxvf HTB-tools-0.3.0a-i486-1.tgz
  9.  
  10. cd /usr/local/src/sbin
  11. mv htb /sbin
  12. mv htbgen /sbin
  13. mv q_checkcfg /sbin
  14. mv q_parser /sbin
  15. mv q_show /sbin
  16.  
  17. cd /usr/local/src/etc
  18. mv htb /etc
  19.  
  20. mv /etc/htb/eth0-qos.cfg.new /etc/htb/eth0-qos.cfg
  21. mv /etc/htb/eth1-qos.cfg.new /etc/htb/eth1-qos.cfg
  22.  
  23. cd /usr/local/src/etc/rc.d
  24.  
  25. mv rc.htb.new /etc/init.d/rc.htb
  26.  
  27. chmod 755 /etc/init.d/rc.htb
  28.  
  29. #Then Setting file eth0-qos cfg and eth1-qos cfg bandwidth limit as needed, and here I will explain to limit bandwidth on eth1 (LAN Office) :
  30.  
  31. nano /etc/htb/eth1-qos.cfg
  32. *upload limit(external eth) -> src: /etc/htb/eth0-qos.cfg
  33. *dowload limit(internal eth)-> dst: /etc/htb/eth1-qos.cfg
  34.  
  35. class Internet_Office {
  36. bandwidth 1024;
  37. limit 2048;
  38. burst 2;
  39. priority 1;
  40.  
  41.     client Manager {
  42.     bandwidth 256;
  43.     limit 512;
  44.     burst 2; #NEW 0 = burst automatic calculation
  45.     priority 1;
  46.     dst { 192.168.168.5/32; }; #src
  47.     };
  48.  
  49.     client secretary {
  50.     bandwidth 64;
  51.     limit 256;
  52.     burst 2;
  53.     priority 1;
  54.     dst { 192.168.168.7/32; };
  55.     };
  56.  
  57.     client Staff {
  58.     bandwidth 256;
  59.     limit 512;
  60.     burst 2;
  61.     priority 1;
  62.     dst { 192.168.168.11/32; 192.168.168.12/32; };
  63.     };
  64. };
  65.  
  66. class default { bandwidth 8; };
  67.  
  68. #description:
  69. bandwidth: guaranteed minimum
  70. limit: maximum transfer rate
  71. burst: maximum number of kbits *0 = automatic
  72. priority: 0-7
  73. ----------------
  74. 192.168.100.12/32; - single IP;
  75. 192.168.1.0/24;    - class representation;
  76. 192.168.1.14/32 80 25; - limit the traffic on port 80 and 25 for a single IP;
  77. 192.168.1.0/24 25; - limit tge traffic on port 25 for a class;
  78.  
  79. *dowload
  80. /etc/init.d/rc.htb start_eth1
  81. /etc/init.d/rc.htb show_eth1
  82. /etc/init.d/rc.htb stop_eth1
  83. -----------------------------
  84. *upload
  85. /etc/init.d/rc.htb start_eth0
  86. /etc/init.d/rc.htb show_eth0
  87. /etc/init.d/rc.htb stop_eth0
  88.  
  89. *Run automatically when the PC in rebot, into rc.local
  90. nano /etc/rc.local
  91. /etc/init.d/rc.htb start
  92. or,
  93. /etc/init.d/rc.htb start_eth1
  94. /etc/init.d/rc.htb start_eth0
Advertisement
Add Comment
Please, Sign In to add comment