手机版
你好,游客 登录 注册
背景:
阅读新闻

Bandwidthd完整实战笔记(PostgreSQL)_2

[日期:2013-11-20] 来源:CSDN  作者:ex_net(张建波、梁辉) [字体:大 中 小]

(7)修改 vi /etc/bandwidthd/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 192.168.192.0/24
#subnet 0.0.0.0/0
subnet 10.0.0.0 255.0.0.0
subnet 192.168.0.0 255.255.0.0
subnet 172.16.0.0 255.255.0.0

# Device to listen on
# Bandwidthd listens on the first device it detects
# by default.  Run "bandwidthd -l" for a list of
# devices.

dev "bg1"

###################################################
# Options for postgresql database logging.

# Standard postgres connect string, just like php, see postgres docs for
# details
#pgsql_connect_string "user = someuser dbname = mydb host = localhost"

pgsql_connect_string "user = bandwidthdpgsql password = 123456 dbname = bandwidthdpgsql
 host = localhost"

# Arbitrary sensor name, I recommend the sensors fully qualified domain
# name
#sensor_id "sensor1.localhost.localdomain"

sensor_id "BW"

# Tells Bandwidthd to keep no data and preform no graphing locally
graph false
# If this is set to true Bandwidthd will try to recover the daily log
# into the database.  If you set this true on purpose only do it once.
# Bandwidthd does not track the fact that it has already transferred
# certain records into the database.
recover_cdf false


###################################################
# Options that don't usually get changed

#Put interface in promiscuous mode to score to traffic
#that may not be routing through the host machine.
promiscuous true

#promiscuous false

#Libpcap format filter string used to control what bandwidthd see's
#Please always include "ip" in the string to avoid strange problems
#filter "ip"

记得,顺便把网卡工作模式改为“混杂模式”

promiscuous true

(8)修改网卡配置,让网桥可以再计算机启动的时候自动加载

vi /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto em1
iface em1 inet static
 address 192.168.192.6
 netmask 255.255.255.0
 network 192.168.192.0
 broadcast 192.168.192.255
 gateway 192.168.192.1
 # dns-* options are implemented by the resolvconf package, if installed
 dns-nameservers 222.172.200.68

auto bg1
iface bg1 inet manual
  pre-up ifconfig em2 down
  pre-up ifconfig em3 down
  pre-up brctl addbr bg1
  pre-up brctl addif bg1 em2
  pre-up brctl addif bg1 em3
  pre-up ifconfig em2 0.0.0.0
  pre-up ifconfig em3 0.0.0.0
  pre-up ifconfig bg1 up
  post-down ifconfig em2 down
  post-down ifconfig em3 down
  post-down ifconfig bg1 down
  post-down brctl delif bg1 em2
  post-down brctl delif bg1 em3
  post-down brctl delbr bg1

加入auto bg1 以后的代码。

至此!整个配置全部完毕了。

reboot

重启计算机。5分钟后,打开浏览器。你就可以看到流量了。

看到没害群之马马上就出现了。上传的流量比下载的还大!

贴几张图,秀秀!

三、参考资料

为了方便大家学习,下面把我看过的一些资料贴在下面,供大家交流学习

Bandwidthd安装

http://www.linuxidc.com/Linux/2008-08/15185.htm

http://www.linuxidc.com/Linux/2010-09/28440p2.htm

Postgresql安装

http://www.if-not-true-then-false.com/2010/howto-install-postgresql-8-4-database-server-on-CentOS-Fedora-red-hat/

http://www.postgresql.org/ftp/pgadmin3/release/v1.18.1/win32/

http://www.linuxidc.com/Linux/2013-11/92989.htm

透明网桥 http://wiki.Ubuntu.org.cn/UbuntuHelp:NetworkConnectionBridge

实验笔记汇总:

Bandwidthd完整实战笔记_1  http://www.linuxidc.com/Linux/2013-11/92934.htm

CentOS6.4环境下编译安装Bandwidthd和Postgrsql心得笔记 http://www.linuxidc.com/Linux/2013-11/92932.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款