1.安裝apache2並啟動
yum install httpd mod_ssl
chkconfig httpd on
service httpd start
chkconfig httpd on
service httpd start
2.安裝相關元件
yum install gcc gcc-c++ libpng libpng-devel gd gd-devel elinks libpcap-devel gnuplot
3.下載bandwidthd原始碼
cd /usr/local/src
elinks bandwidthd.sourceforge.net
下載bandwidthd-2.0.1.tgzelinks bandwidthd.sourceforge.net
4.解壓縮bandwidthd
tar -xzvf bandwidthd-2.0.1.tgz
5.修改bandwidthd上限(預設為20,修改為100)
cd /usr/local/src/bandwidthd-2.0.1
vim graph.c
vim graph.c
Top20修改為Top100 (有三個)
Counter < 21修改為Counter < 101 (有兩個)
6.安裝bandwidthd
cd /usr/local/src/bandwidthd-2.0.1
./configure
make install
./configure
make install
◎如有發生libpcap錯誤,請安裝libpcap
rpm -i http://isoredirect.centos.org/centos/5/os/i386/CentOS/libpcap-devel-0.9.4-8.1.i386.rpm
rpm -i http://isoredirect.centos.org/centos/5.1/os/i386/CentOS/libpcap-devel-0.9.4-11.el5.i386.rpm
rpm -i http://isoredirect.centos.org/centos/5.1/os/i386/CentOS/libpcap-devel-0.9.4-11.el5.i386.rpm
7.修改bandwidthd設定檔
vim /usr/local/bandwidthd/etc/bandwidthd.conf
subnet 192.168.1.0/24
dev "eth0"
dev "eth0"
8.建立bandwidthd連結
cd /var/www/html
ln -s /usr/local/bandwidthd/htdocs bandwidthd
ln -s /usr/local/bandwidthd/htdocs bandwidthd
9.建立bandwidthd啟動
vim /etc/rc.local
加入/usr/local/bandwidthd/bandwidthd
10.網頁
http://主機IP/bandwidthd