通过交换机、服务器、Bandwidthd的有机配合,可以对全网进行监控。后面我将为大家介绍将Bandwidthd的流量监控信息存储到数据库中,例如MySQL
四、完善
最后在安装以下软件包
yum install ntp
ntpdate ntp.fudan.edu.cn
yum install setuptool ntsysv system-config-firewall
把服务器自动对对时间,安装一些方便管理的工具,把httpd 设置为自动启动,然后再把防火墙彻底关闭
让bandwidthd可以自动启动
vi /etc/rc.local
加入/usr/local/bandwidthd/bandwidthd
修改配置bandwidthd
vi /usr/local/bandwidthd/etc/bandwidthd.conf
####################################################
# Bandwidthd.conf
#
# Commented out options are here to provide
# documentation and represent defaults
# Subnets to collect statistics on. Traffic that
# matches none of these subnets will be ignored.
# Syntax is either IP Subnet Mask or CIDR
#subnet 10.0.0.0 255.0.0.0
#subnet 192.168.0.0/16
#subnet 172.16.0.0/12
subnet 10.0.0.0 255.255.0.0
subnet 10.1.0.0 255.255.0.0
subnet 10.2.0.0 255.255.0.0
subnet 10.3.0.0 255.255.0.0
subnet 10.4.0.0 255.255.0.0
subnet 10.5.0.0 255.255.0.0
subnet 192.168.0.0/16
subnet 172.16.25.0/24
subnet 172.16.10.0/24
subnet 172.16.11.0/24
subnet 172.16.12.0/24
subnet 172.16.13.0/24
subnet 172.16.14.0/24
subnet 172.16.15.0/24
subnet 172.16.16.0/24
subnet 172.16.17.0/24
subnet 172.16.18.0/24
subnet 172.16.19.0/24
subnet 172.16.20.0/24
subnet 172.16.31.0/24
subnet 172.16.32.0/24
subnet 172.16.33.0/24
subnet 172.16.34.0/24
subnet 172.16.35.0/24
subnet 172.16.36.0/24
# Device to listen on
# Bandwidthd listens on the first device it detects
# by default. Run "bandwidthd -l" for a list of
# devices.
dev "eth1"
###################################################
# Options that don't usually get changed
# An interval is 2.5 minutes, this is how many
# intervals to skip before doing a graphing run
#skip_intervals 0
# Graph cutoff is how many k must be transfered by an
# ip before we bother to graph it
graph_cutoff 1024
#Put interface in promiscuous mode to score to traffic
#that may not be routing through the host machine.
promiscuous true
#Log data to cdf file htdocs/log.cdf
output_cdf true
#Read back the cdf file on startup
recover_cdf true
#Libpcap format filter string used to control what bandwidthd see's
#Please always include "ip" in the string to avoid strange problems
filter "ip"
#Draw Graphs - This default to true to graph the traffic bandwidthd is recording
#Usually set this to false if you only want cdf output or
#you are using the database output option. Bandwidthd will use very little
#ram and cpu if this is set to false.
graph true
#Set META REFRESH seconds (default 150, use 0 to disable).
meta_refresh 150
reboot 重启服务器后,用 ps -aux 查看进程
可以看到bandwidthd和httpd 已经自动启动了。
至此!全部成功了。