FreeBSD 板


嗨: pf 的功能约可分为五部分: (我随便讲的,有错请指正) 1.NAT 2.Load Blancing 3.Alternate Queueing (ALTQ) 4.Firewall 5.Log 我在某个地方弄到两条双向 512k 的 adsl 来玩, 一条是 Hinet,一条是 Seed. 目前大概完成的是 NAT 加 Load Blancing, 我把我的设定公开出来. 目前已知的问题有几个: 1.PF 不能自动侦测对外线路有没断线, 2.虽然是 Load Blancing,不过没办法将两条频宽"视为"一条  (不过如果用多点序传软体也许就可用到两条线路的频宽,  还没试,不知道...) 上面这两个问题可能要从 routed 去做, 不过这就超出 pf 的范围,所以将来再说吧. 接下来我在犹豫是要先做 Firewall 或 ALTQ, 搞 Firewall 还要去偷机器来做被保护的对象, 搞 ALTQ 好像还挺复杂... 如果这个设定档,前辈们有觉得不够漂亮的地方, 恳请指点. 唉,都六月中了,照这样下去,等到全部做完, 要办 OpenBSD 3.3 PF 试乘会(啊,不是,是体验会)时,搞不好 3.4 都出来了 >< 你们有人有兴趣参加吗? 喔,对了,第一本 OpenBSD 专书出来罗 : ) http://www.amazon.com/exec/obidos/tg/detail/-/1886411999/002-3001659-5995218                  ghost 03'06/13 ------------------------- pf.conf: # $OpenBSD: pf.conf,v 1.19 2003/03/24 01:47:28 ian Exp $ # # See pf.conf(5) and /usr/share/pf for syntax and examples. # Required order: options, normalization, queueing, translation, filtering. # Macros and tables may be defined and used anywhere. # Note that translation rules are first match while filter rules are last match. # Macros: define common values, so they can be referenced and changed easily. #external_addr1 = "211.21.32.58" #external_addr2 = "210.64.89.130" ext_if1 = "xl0" # replace with actual external interface name i.e., dc0 ext_if2 = "fxp0"# replace with actual external interface name i.e., dc0 int_if = "dc0" # replace with actual internal interface name i.e., dc1 internal_net = "192.168.1.0/24" # nat subnet ext_gw1 = "a.b.c.d" # your gateway ip of external interface 1 ext_gw2 = "d.e.f.g" # your gateway ip of external interface 2 (这些要跟着你的硬体与网路做变更,照抄若通会见鬼喔.) # Tables: similar to macros, but more flexible for many addresses. #table <foo> { 10.0.0.0/8, !10.1.0.0/16, 192.168.0.0/24, 192.168.1.18 } table <isp1> {168.95.4.0/24, 168.95.195.16, 168.95.1.1 } # Hinet SMTP,NEWS,DNS table <isp2> {139.175.54.240, 139.175.55.249, 139.175.55.244 } # Seed SMTP,NEWS,DNS (这些随着你用的 ISP 不同会有不同,如果两条线路都用同一家 ISP 的,就不需要了.) # Normalization: reassemble fragments and resolve or reduce traffic ambiguities. scrub in all # Translation: specify how addresses are to be mapped or redirected. # nat: packets going out through $ext_if with source address $internal_net will # get translated as coming from the address of $ext_if, a state is created for # such packets, and incoming packets will be redirected to the internal address. nat on $ext_if1 from $internal_net to any -> ($ext_if1) nat on $ext_if2 from $internal_net to any -> ($ext_if2) # rdr outgoing FTP requests to the ftp-proxy rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 port 8081 (这一行要配合在 inetd.conf 做对应的设定) # request Service from isp use the Line which provide by that isp pass in on $int_if route-to ($ext_if1 $ext_gw1) round-robin proto tcp from $internal_net to <isp1> flags S/SA modulate state pass in on $int_if route-to ($ext_if2 $ext_gw2) round-robin proto tcp from $internal_net to <isp2> flags S/SA modulate state (这个与 table 那两行是为了让你可以用该 ISP 所提供的 ADSL 连线去取得该 ISP 提供的服务) # Filtering: the implicit first two rules are pass in all pass out all pass quick on lo0 all # pass all outgoing packets on internal interface pass out on $int_if from any to $internal_net # pass in quick any packets destined for the gateway itself pass in quick on $int_if from $internal_net to $int_if # load balance outgoing tcp traffic from internal network. pass in on $int_if route-to { ($ext_if1 $ext_gw1), ($ext_if2 $ext_gw2) } round-robin proto tcp from $internal_net to any flags S/SA modulate state # load balance outgoing udp and icmp traffic from internal network pass in on $int_if route-to { ($ext_if1 $ext_gw1), ($ext_if2 $ext_gw2) } round-robin proto { udp, icmp } from $internal_net to any keep state # route packets from any IPs on $ext_if1 to $ext_gw1 and the same for # $ext_if2 and $ext_gw2 pass out on $ext_if1 route-to ($ext_if2 $ext_gw2) from $ext_if2 to any pass out on $ext_if2 route-to ($ext_if1 $ext_gw1) from $ext_if1 to any # ICQ Client with Load Blancing pass in on $int_if proto tcp from $internal_net to any port 5190 flags S/SA modulate state (在平衡负载功能作用时,加上这行设定才能让 client 正常的连上 ICQ server.) # FTP Client with Load Blancing pass in on $int_if proto tcp from $internal_net to 127.0.0.1 port 8081 flags S/SA keep state (在平衡负载功能作用时,加上这行设定才能让 client 正常的连上 FTP server.) # general "pass out" rules for external interfaces pass out on $ext_if1 proto tcp from any to any flags S/SA modulate state pass out on $ext_if1 proto { udp, icmp } from any to any keep state pass out on $ext_if2 proto tcp from any to any flags S/SA modulate state pass out on $ext_if2 proto { udp, icmp } from any to any keep state -------------------------- -- *请加入连署抵制使用 RedHat Linux 8.0 後续版本的行动 http://www.slat.org/event/redhat-flag *请支持并参与 Freenix 伺服文件撰写验证计画 http://www.freenix-server.info -- 得 即 高 歌 失 即 休 任 多 悲 愁 也 悠 悠 青 松 影 里 朦 胧 睡 燕 飞 无 楼 月 已 钩       风起云涌II-幽灵







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草
伺服器连线错误,造成您的不便还请多多包涵!
「赞助商连结」






like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:BabyMother站内搜寻

TOP