给FreeBSD加上了防火墙

  早上去给FreeBSD(4.10)加了个防火墙;
  1.   编译内核:进入 /sys/i386/conf ,cp GENERIC 到 Kernel_IPFW ,在Kernle_IPFW中添加

    options     IPFIREWALL
    options     IPFIREWALL_FORWARD
    options     IPFIREWALL_VERBOSE
    options     IPFIREWALL_VERBOSE_LIMIT=100
    options     IPFIREWALL_DEFAULT_TO_ACCEPT


  2. 然后 config Kernel_IPFW (在/sys/i386/conf 目录中的 LINT 有全部内核选项的说明);按照shell的提示编译并安装新的 Kernel_IPFW。

  3. 在 /etc/rc.conf 添加

    firewall_enable="YES"
    firewall_script="/etc/rc.firewall"
    firewall_type="/etc/ipfw.conf"
    firewall_quiet="YES"
    firewall_logging_enable="NO"


  4. 在 /etc/ipfw.conf 中加入

    add 00001 deny log ip from any to any ipopt rr
    add 00002 deny log ip from any to any ipopt ts
    add 00003 deny log ip from any to any ipopt ssrr
    add 00004 deny log ip from any to any ipopt lsrr
    add 00005 deny tcp from any to any in tcpflags syn,fin
    add 65500 allow tcp from any to me setup limit src-addr 8

    #可以比较有效的防止DDOS


  5. 如果要使用SSH需要编辑 /etc/rc.firewall ,这个文件应该仔细阅读,防火墙规则太多可以在这里编辑。

  6. 可以防止一般的 DDOS,扫描,ICMP攻击等等攻击,若要求更高,可以参考运用sysctl,ipfliter等,修改 /etc/rc.firewall 可以实现更多过滤功能,同样也可以把他变成一台比较专业的防火墙(主要参考编辑 /etc/rc.firewall )。

转载于:https://www.cnblogs.com/fred/archive/2005/01/06/87555.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值