邪恶八进制信息安全团队技术讨论组's Archiver

冰血封情 2004-9-25 05:12

[转载]带带宽管理的FreeBSD GNU防火墙解决方案

信息来源:demonalex[at]dark2s.org

1)装好FREEBSD系统。


2)编辑内核,在其中加入:

options      IPFILTER
options      IPFILTER_LOG
options      IPFILTER_DEFAULT_BLOCK
#
options      IPFIREWALL
options      IPFIREWALL_VERBOSE
options      IPFIREWALL_DEFAULT_TO_ACCEPT
options      DUMMYNET

然后config->make depend->make->make install->init 6


3)重启后配置好网络接口的参数,启动路由模式;在/etc/rc.conf加入:

ipfilter_enable="YES"
ipfilter_flags="-Fa -f /etc/ipf.rules"
ipnat_enable="YES"
ipnat_flags="-CF -f /etc/ipnat.rules"
ipmon_enable="YES"
ipmon_flags="-Dsn"
#ipmon的参数解释:
#-D: ipmon作为守护者程序(daemon)加载
#-n: 可能的情况下将IP地址和端口号映射成主机名和服务名
#-s: 将包的信息送到syslogd而不是保存成文件
#
firewall_enable="YES"
firewall_script="/etc/rc.dummynet"
firewall_type="open"
firewall_logging="YES"

在/etc/ipf.rules中加入包过滤规则;在/etc/ipnat.rules中加入NAT规则;init 6。


4)在SHELL中使用下面的语句进行带宽管理:
ipfw add 100 pipe 1 ip from 192.168.0.201 to any  #192.168.0.201是内网所要限制的客户端
ipfw pipe 1 config bw 10Mbit/s              #限制在10Mbit/秒

页: [1]
© 1999-2008 EvilOctal Security Team