免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 4330 | 回复: 18
打印 上一主题 下一主题

【防火墙透明代理配置心得----原创】 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-11-02 11:30 |只看该作者 |倒序浏览
--------------------------------------------------------------------------------

声明:本文章为wangbin原创,互联网上论坛大家可以任意站贴
但是请您注明文章来源 http://www.enhand.net  [wangbin]
印刷报刊,谢绝使用!

原文地址: http://www.enhand.net/bbs/viewtopic.php?p=679#679


本人是一个新手,2002年刚刚学习FreeBSD,在CU上经常受到大家的嘲笑,这次配置
也是饱经曲折,所以我希望的做法能够为后来的朋友有所启示。

单位100M光纤接入互联网,文章中网卡为ed0[202.182.96.2],内网ed2的地址为200.200.1.0/24,其中200.200.1.33是一台web服务器。
要完成的任务是,使所有的互联网微机可以访问200.200.1.33,所有的内网主机可以访问互联网。
规则暂时不考虑,网上相关的文章也很多。



DL# cat ipnat.rules
代码:
map ed0 200.200.1.0/24 ->; 202.182.96.2/32 portmap tcp/udp 1000:6000
map ed0 200.200.1.0/24 ->; 202.182.96.2/32 proxy port ftp ftp/tcp
map ed0 200.200.1.0/24 ->; 202.182.96.2/32
rdr ed0 0.0.0.0/0 port 80 ->; 200.200.1.33 port 80 tcp



DL# cat ipf.rules
代码:
pass in quick on lo0 all
pass out quick  on lo0 all
pass in from any to any
pass out from any to any


/etc/rc.conf

代码:
DL# cat rc.conf
defaultrouter="218.22.205.1"
hostname="DL.net"
network_interfaces="ed0 ed2 lo0"
ifconfig_ed0="inet 202.182.96.2  netmask 255.255.255.248"
ifconfig_ed2="inet 200.200.1.180  netmask 255.255.255.0"
sendmail_enable="NONE"
inetd_enable="NO"
kern_securelevel_enable="NO"
linux_enable="YES"
nfs_reserved_port_only="NO"
sshd_enable="YES"
usbd_enable="NO"
gateway_enable="YES"

#######################IPFILTER###########
ipfilter_enable="YES"
ipfilter_program="/sbin/ipf"
ipfilter_rules="/etc/ipf.rules"
ipfilter_flags=""
ipnat_enable="YES"
ipnat_program="/sbin/ipnat"
ipnat_rules="/etc/ipnat.rules"
ipnat_flags=""

######################IPFW#################
#firewall_enable="YES"
#firewall_script="/etc/rc.firewall"
#firewall_type="open"
#firewall_quiet="NO"
#firewall_logging_enable="YES"
#natd_enable="YES"
#natd_interface="ed0"
#natd_flags="-config /etc/natd.conf"





内核文件,注意 options BRIDGE

代码:
DL# cd /usr/src/sys/i386/conf/
DL# cat DL

machine         i386
cpu             I686_CPU
ident           DL
maxusers        0

options         MATH_EMULATE            #Support for x87 emulation
options         INET                    #InterNETworking
options         FFS                     #Berkeley Fast Filesystem
options         FFS_ROOT                #FFS usable as root device [keep this!]
options         SOFTUPDATES             #Enable FFS soft updates support
options         UFS_DIRHASH             #Improve performance on big directories
options         CD9660_ROOT             #CD-ROM usable as root, CD9660 required
options         PROCFS                  #Process filesystem
options         COMPAT_43               #Compatible with BSD 4.3 [KEEP THIS!]
options         SCSI_DELAY=15000        #Delay (in ms) before probing SCSI
options         UCONSOLE                #Allow users to grab the console
options         USERCONFIG              #boot -c editor
options         VISUAL_USERCONFIG       #visual boot -c editor
options         KTRACE                  #ktrace(1) support
options         SYSVSHM                 #SYSV-style shared memory
options         SYSVMSG                 #SYSV-style message queues
options         SYSVSEM                 #SYSV-style semaphores
options         P1003_1B                #Posix P1003_1B real-time extensions
options         _KPOSIX_PRIORITY_SCHEDULING
options         ICMP_BANDLIM            #Rate limit bad replies
options         KBD_INSTALL_CDEV        # install a CDEV entry in /dev
options         AHC_REG_PRETTY_PRINT    # Print register bitfields in debug
                                        # output.  Adds ~128k to driver.
options         AHD_REG_PRETTY_PRINT    # Print register bitfields in debug

                                        # output.  Adds ~215k to driver.
##################this is ok for ipfw#######
#options        IPFIREWALL
#options        IPFIREWALL_VERBOSE
#options        IPFIREWALL_VERBOSE_LIMIT=90
#options        IPFIREWALL_DEFAULT_TO_ACCEPT
#options        IPDIVERT

####################for bridge############
options         BRIDGE
options         IPFILTER
options         ACCEPT_FILTER_DATA
options         ACCEPT_FILTER_HTTP
options         ICMP_BANDLIM

device          isa
device          eisa
device          pci
options         AUTO_EOI_1
options         RANDOM_IP_ID
options         TCP_DROP_SYNFIN
options         PANIC_REBOOT_WAIT_TIME=0

device          ata0    at isa? port IO_WD1 irq 14
device          ata1    at isa? port IO_WD2 irq 15
device          ata
device          atadisk                 # ATA disk drives
device          atapicd                 # ATAPI CDROM drives
options         ATA_STATIC_ID           #Static device numbering

# SCSI Controllers
device          ahb             # EISA AHA1742 family
device          ahc             # AHA2940 and onboard AIC7xxx devices
device          ahd             # AHA39320/29320 and onboard AIC79xx devices
device          amd             # AMD 53C974 (Tekram DC-390(T))
device          isp             # Qlogic family
device          mpt             # LSI-Logic MPT/Fusion
device          ncr             # NCR/Symbios Logic
device          sym             # NCR/Symbios Logic (newer chipsets)
options         SYM_SETUP_LP_PROBE_MAP=0x40
                                # Allow ncr to attach legacy NCR devices when
                                # both sym and ncr are configured

device          adv0    at isa?
device          adw
device          bt0     at isa?
device          aha0    at isa?
device          aic0    at isa?

device          ncv             # NCR 53C500
device          nsp             # Workbit Ninja SCSI-3
device          stg             # TMC 18C30/18C50

# SCSI peripherals
device          scbus           # SCSI bus (required)
device          da              # Direct Access (disks)
device          cd              # CD
device          pass            # Passthrough device (direct SCSI access)


# atkbdc0 controls both the keyboard and the PS/2 mouse
device          atkbdc0 at isa? port IO_KBD
device          atkbd0  at atkbdc? irq 1 flags 0x1
device          psm0    at atkbdc? irq 12

device          vga0    at isa?

# splash screen/screen saver
pseudo-device   splash

# syscons is the default console driver, resembling an SCO console
device          sc0     at isa? flags 0x100

device          agp             # support several AGP chipsets
device          sc
options         MAXCONS=2 ##
options         SC_DISABLE_REBOOT
options         SC_NO_CUTPASTE #
options         SC_NO_FONT_LOADING #
options         SC_NO_SYSMOUSE

device          npx0    at nexus? port IO_NPX irq 13

# Parallel port
device          ppc0    at isa? irq 7
device          ppbus           # Parallel port bus (required)
device          plip            # TCP/IP over parallel
device          ppi             # Parallel port interface device

device          miibus          # MII bus support
device          rl              # RealTek 8129/8139

#device         ed0     at      isa? port 0x300 net irq 3 iomem 0xd8000 vector edintr  #
device          ed0     at isa? disable port 0x300 irq 3  iomem 0xd8000
device          pty
# Pseudo devices - the number indicates how many units to allocate.
pseudo-device   loop            # Network loopback
pseudo-device   ether           # Ethernet support
pseudo-device   bpf             #Berkeley packet filter

论坛徽章:
0
2 [报告]
发表于 2003-11-02 11:33 |只看该作者

【防火墙透明代理配置心得----原创】

IPFIREWALL方式和IPFILTER方式都可以选择,本文暂时使用IPFILTER方式,如果IPFIREWALL方式试验成功了,会和大家分享!

论坛徽章:
0
3 [报告]
发表于 2003-11-02 11:43 |只看该作者

【防火墙透明代理配置心得----原创】

第一个 掌声 鼓励 。。。。。!

我也刚接触 freebsd 在做 ipfw和 natd时 也是出现问题,网上一些大虾 文章不错 但是需要注意的细节 却不肯 写清楚 一点, 尤其是 natd重复执行这一个方面 也就是 错误 natdnatd: Unable to bind divert socket.: Address already in use 的时候

论坛徽章:
0
4 [报告]
发表于 2003-11-02 11:51 |只看该作者

【防火墙透明代理配置心得----原创】

不过我还是一点不理解
options BRIDGE
是一种网桥的方式,我发现在FreeBSD4.9中,我把下面的代码,加入sysctl.conf和不加的效果一模一样,真有些不能理解。

  1. sysctl net.link.ether.bridge_cfg=ed0:0,ed21:0
  2. sysctl net.link.ether.bridge_ipf=1
  3. sysctl net.link.ether.bridge=1
复制代码

论坛徽章:
0
5 [报告]
发表于 2003-11-02 17:18 |只看该作者

【防火墙透明代理配置心得----原创】

放心,在这没人会笑你
大伙都是鸟鸟过来的

论坛徽章:
0
6 [报告]
发表于 2003-11-03 12:28 |只看该作者

【防火墙透明代理配置心得----原创】

可能只有兄弟你!

论坛徽章:
0
7 [报告]
发表于 2003-11-03 13:44 |只看该作者

【防火墙透明代理配置心得----原创】

原帖由 "wangbin"]S! 发表:

options         SCSI_DELAY=15000        #Delay (in ms) before probing SCSI
options         UCONSOLE                #Allow users to grab the console
options         USERCONFIG              #b..........

老大,这样改很大工程呀,你试通了真的能跳转没有?

论坛徽章:
0
8 [报告]
发表于 2003-11-03 14:18 |只看该作者

【防火墙透明代理配置心得----原创】

当然了,看看这个 http://xc.enhand.net 我同事的机器,但是有时候不开机,只是测试了!

论坛徽章:
0
9 [报告]
发表于 2003-11-03 14:50 |只看该作者

【防火墙透明代理配置心得----原创】

[quote]原帖由 "wangbin"]当然了,看看这个 http://xc.enhand.net 我同事的机器,但是有时候不开机,只是测试了![/quote 发表:
利害,我今晚换系统。哈哈,谢谢你的体验了。

论坛徽章:
0
10 [报告]
发表于 2003-11-03 14:51 |只看该作者

【防火墙透明代理配置心得----原创】

[quote]原帖由 "wangbin"]当然了,看看这个 http://xc.enhand.net 我同事的机器,但是有时候不开机,只是测试了![/quote 发表:
有没有QQ呀你,加我好吗?平时一起研究一下 我的Q113118569
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP