动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
电脑书籍下载:程序设计书籍 | 数据库教程书籍 | 平面与多媒体书籍 | 网络通讯书籍 | 系统管理书籍 | 网络安全书籍 | 认证考试书籍
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 操作系统 > FreeBSD教程
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ FreeBSD教程 ]的信息



本月文章推荐
.Zhcon的安装和使用(1).
.FreeBSD目录结构一览.
.FreeBSD ipfw 防火墙基础指南.
.FreeBSD基础点滴.
.FreeBSD handbook中文版 3 Unix .
.FreeBSD 简介.
.FreeBSD中/etc下的文件简介.
.FreeBSD5.3+Apache+ssl认证.
.idled 介绍 (二)设定说明.
.FreeBSD handbook中文版 12 存储.
.FreeBSD SNP 1.装设SNP.
.Ports & Package.
.freebsd5.2.1上安装vmware 3.2.1.
.FreeBSD 安装步骤.
.FreeBSD下有关分区和mount的一些.
.FreeBSD下Apache2.0运行模型分析.
.利用 portupgrade快速更新通过po.
.NFS Server设定.
.如何作package ?.
.在FREEBSD 5.2中使用Pureftpd + .

如何设定防火墙IP Firewall

发表日期:2005-3-28 |


IP Firewall 可以有效的增进系统的安全,但是除非你对 IP Firewall 有 
相当的了解,否则你可能把你的机器弄的无法上网路。 

警告 !!  绝对不要从远端连线设定 IPFW,一定要从 console !! 
         不然设定错误,你的连线可能会被中断 !! 

你必须在 kernel config file 中加入 options IPFIREWALL 及 options 
IPFIREWALL_VERBOSE,再重新编译 kernel。 

在你开始以前,请先 man ipfw。 

1. 编辑 /etc/sysconfig,把 firewall=NO 改成 firewall=YES 
2. 修改 /etc/rc.firewall 
   你可以参照里面的□例,如果看不懂的话,请 man ipfw 
   以下是一个简单的例子: 

echo "IP Firewall Rules ...." 
# true to enable, false to disable 
 
if true; then 
        # basic information 
        net="140.113.139.0" 
        mask="255.255.255.0" 
        mask_b="255.255.0.0" 
        myip="140.113.139.1" 
 
        # flush all rules 
        # FreeBSD-2.2 1996/Sep 以後的版本,请使用 ipfw -f flush (见後 PS) 
        /sbin/ipfw flush 
 
        # Allow all connections at last 
        # IPFW default rule : "65535 deny all from any to any" 
        /sbin/ipfw add 65000 pass all from any to any 
 
        # Allow all connections (the latest match 65000) 本行最後才 match ! 
        /sbin/ipfw add 65000 pass all from any to any 
 
        # Allow all localhost connections (first match) 本行最先 match ! 
        /sbin/ipfw add 1000 pass all from 127.0.0.1 to 127.0.0.1 
        /sbin/ipfw add 1010 pass all from ${myip} to a 
 
        # Friendly sites (fully access rights) 
        # 这些 host 最好用 IP,或是要纪录在 /etc/hosts 中 
        /sbin/ipfw add 1100 pass all from Friend1 to any 
        /sbin/ipfw add 1120 pass all from Server to any 
        /sbin/ipfw add 1130 pass all from FreeBSD.csie.nctu.edu.tw to any 
 
        # deny everything (asshole host) 
        /sbin/ipfw add 2000 deny all from 123.123.123.123:${mask} to any 
 
        # deny remote syslogging to get ride of security problem 
        /sbin/ipfw add 3000 deny udp from any to any 514 
 
        # deny users out of campus from doing "rusers", "rwall" 
        /sbin/ipfw add 4000 pass udp from ${net}:${mask_b} to any 1034,1035 
        /sbin/ipfw add 4010 deny udp from any to any 1034,1035 
 
        # deny most hosts from tcpspray me 
        /sbin/ipfw add 5000 deny tcp from any to any 9 
        /sbin/ipfw add 5010 deny udp from any to any 9 
fi 
 
3. 执行 sh /etc/rc.firewall,然後测试各种网路连线看看 

後记: 
IPFW 一启动後,内定是『拒绝所有连线』!!! 
(IPFW 内定 rule : 65535 deny all from any to any) 
这点要特别注意,因此如果你下了 ipfw flush 指令,你立刻跟网路隔绝, 
连 localhost 也无法连接。 
因此通常我们会在最後一个 rule (如 65534) 允许所有连线,然後把 deny 
的 rules 都放在前面。 

如果你在系统启动之後修改了 /etc/rc.firewall,只要用 
sh /etc/rc.firewall 就可以载入新的 rules。 
如果你在远端控制,要注意新加的 rule 不要把自己给 ban 掉了啊。 

PS. 在 1996/Sep 以後的 ipfw 在执行 ipfw flush 时会询问使用者以求 
    确认 (因为 ipfw flush 会导致连线中断),因此你在撰写 /etc/ 
    rc.firewall 时请使用 ipfw -f flush。 
    你可以打 ipfw -h 看看你的 ipfw 有没有支援 -f 的选项

上一篇:FreeBSD中/etc下的文件简介 人气:11155
下一篇:如何使用IP Alias? 人气:10914
浏览全部FreeBSD的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-7-5 360安全卫士 V4.2.0.1004
2008-7-5 PHPDug v2.0 多国语言版
2008-7-5 乘风电影程序 v3.69 (SQL)
2008-7-5 乘风电影程序 v3.69
2008-7-5 wfTextImage文字图像组件 v1.5
2008-7-5 ZY music! v1.1.0705
2008-7-5 FavShop网店系统 v1.0
2008-7-4 天空网络电影系统SKYUC v2.5.1 B
2008-7-4 Drupal v7.x-dev Build 080704
2008-7-5 AgileMessenger即时通讯工具 v1.
2008-7-5 GoodCalculator2.0版固件计算器
2008-7-5 RepoName源地址搜索工具 v1.21b
2008-7-5 AgileMessenger即时通讯工具 v1.
2008-7-5 TouchCopy多媒体管理软件 v3.13完
2008-7-5 VideosTone视频铃声 v1.1汉化破解
2008-7-5 TouchPad触摸板 v4.44破解版
2008-7-5 VideosTone破解补丁 v1.0
2008-7-5 Feeds GoogleReader客户端 v0.4.3


  发表评论
姓 名: 验证码:
内 容:
[ 汉字翻译拼音 ] [ 广告代码 ] [ 符号对照表 ] [ 进制转换 ] [ 经典小工具 ] [ 个税计算 ] [ 汉字简繁转换 ] [ 普通单位换算 ] [ 公制单位换算 ]
[ 生辰老黄历 ] [ 国内电话区号 ] [ 国家代码与域名缩写 ] [ 文字加密解密 ] [ 健康查询 ] [ 万年历 ] [ 手机号码查询 ] [ ip搜索 ] [ Google PR查询 ]
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報