ipfw 架设单机防火墙

2009-05-13 11:01:50来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

一、内核配置
/usr/src/sys/i386/conf/MYKERNEL

CODE:
options                IPFIREWALL
options                IPFIREWALL_DEFAULT_TO_ACCEPT
options                IPDIVERT                        #  IPDIVERT enables the divert IP sockets, used by ''ipfw divert''
options                IPFIREWALL_VERBOSE
options                IPFIREWALL_VERBOSE_LIMIT=30
#options        IPFILTER                        #ipfilter support
#options        IPFILTER_LOG                #ipfilter logging
# traffic shaper, bandwidth manager and delay emulator
options                DUMMYNET                        # enables the "dummynet" bandwidth limiter. You need IPFIREWALL as well.
# Statically Link in accept filters for a web server on this box
options                ACCEPT_FILTER_DATA
options                ACCEPT_FILTER_HTTP
options                IPSTEALTH                        #To hide firewall from traceroute
options                TCP_DROP_SYNFIN                #To hide from nmap OS fingerprint, remove if create web server
当然如果不做NAT的话。也可以不在重新编译内核的情况下启用ipfw 以下摘自freebsd handbook中的内容

IPFW 是基本的 FreeBSD 安装的一部分, 以单独的可加载内核模块的形式提供。 如果在 rc.conf 中加入 firewall_enable="YES" 语句, 就会自动地加载对应的内核模块。 除非您打算使用由它提供的 NAT 功能, 一般情况下并不需要把 IPFW 编进 FreeBSD 的内核。
  如果将 firewall_enable="YES" 加入到 rc.conf 中并重新启动系统, 则下列信息将在启动过程中,以高亮的白色显示出来:
ipfw2 initialized, divert disabled, rule-based forwarding disabled, default to deny, logging disabled
  可加载内核模块在编译时加入了记录日志的能力。 要启用日志功能,并配置详细日志记录的限制, 需要在 /etc/sysctl.conf 中加入一些配置。 这些设置将在重新启动之后生效:
net.inet.ip.fw.verbose=1
net.inet.ip.fw.verbose_limit=5


二、rc.conf配置
/etc/rc.conf

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:FreeBSD,我来了-FreeBSD的介绍(学习笔记二)

下一篇:FreeBSD软件安装卸载工具–Ports和Packages详解