免费注册 查看新帖 |

Chinaunix

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

[FreeBSD] llzqq进来一下..多谢谢! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-08-11 01:50 |只看该作者 |倒序浏览
ext_if1 = "rl0"    //接网通
ext_if2 = "rl1"    //接电信
ext_gw1 = "218.104.232.1"   //网通网关
ext_gw2 = "61.154.11.254"   //电信网关
loop = "lo0"
service = "{22, 80, 443}"

scrub in all
antispoof for {$ext_if1, $ext_if2} inet

##default deny

block all
block return

##general "pass in" rules for external and loop interfaces

pass quick on $loop all
pass in on $ext_if1 tag cncgroup keep state
pass in on $ext_if2 tag chinanet keep state

##general "pass out" rules for external interfaces

pass out on {$ext_if1, $ext_if2} proto tcp from any to any flags S/SA modulate state
pass out on {$ext_if1, $ext_if2} proto { udp, icmp } from any 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 quick on $ext_if1 route-to ($ext_if2 $ext_gw2) tagged chinanet keep state
pass out quick on $ext_if2 route-to ($ext_if1 $ext_gw1) tagged cncgroup keep state

llzqq
今晚有空没测试了一下你的PF.conf结果不能实现................
刚好有几台电信和网通肉鸡.

[ 本帖最后由 123456sx 于 2007-8-11 02:05 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2007-08-11 07:38 |只看该作者

论坛徽章:
0
3 [报告]
发表于 2007-08-12 16:07 |只看该作者
.说明:

此方案适用于可以使用PF做为防火墙的操作系统,包括FREEBSD/OPENBSD/NETBSD。所谓的策略路由就是在服务器同时连接了两个ISP线路,实现从那个网卡进来的数据包请求,返回给CLIENT时还从那个网卡出去。

2.试验拓扑:

见贴图

图中的『3接口路由器』可以用WIN2K或LINUX系统启动IP转发替代。

3.OPENBSD网络设置:

Fxp0:                192.168.0.100
Ne3:                        192.168.1.100
Gateway:        192.168.0.1

4.PF规则:

# vi /etc/pf.conf
=================================================
if_isp1="fxp0"
if_isp2="ne3"
gw_isp1="192.168.0.1"
gw_isp2="192.168.1.10"

block all

pass quick on lo0 all

pass in quick on $if_isp1 reply-to ( $if_isp1 $gw_isp1 ) proto {tcp,udp,icmp} to any keep state
pass in quick on $if_isp2 reply-to ( $if_isp2 $gw_isp2 ) proto {tcp,udp,icmp} to any keep state

pass out keep state



我和你文章所提及的不一样的地方就是在Gateway:        192.168.0.1
加了route add   N多的国内的网通路由表..事实证明根本不需要
pass in quick on $if_isp1 reply-to ( $if_isp1 $gw_isp1 ) proto {tcp,udp,icmp} to any keep state
pass in quick on $if_isp2 reply-to ( $if_isp2 $gw_isp2 ) proto {tcp,udp,icmp} to any keep state

而且您的是在内部测试的.我想知道的是来自gw_isp1="192.168.0.1"或是gw_isp2="192.168.1.10"的访问
我没有测试成攻.....看来只能搞bind view了......希望有条件的朋友实际测试一下!

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
4 [报告]
发表于 2007-08-12 20:14 |只看该作者
事实上证明,使用PF的策略路由后根本不需要route add N多国内网通路由表.

论坛徽章:
0
5 [报告]
发表于 2007-08-13 02:42 |只看该作者
原帖由 congli 于 2007-8-12 20:14 发表
事实上证明,使用PF的策略路由后根本不需要route add N多国内网通路由表.




汗.了..我没有说清楚.是为了从内部到外部自动选择快速的路由...比如网通和电信两个wan.为什么不需要..
比如网吧.明白.

论坛徽章:
1
寅虎
日期:2013-09-29 23:15:15
6 [报告]
发表于 2007-08-13 08:29 |只看该作者
原帖由 123456sx 于 2007-8-13 02:42 发表




汗.了..我没有说清楚.是为了从内部到外部自动选择快速的路由...比如网通和电信两个wan.为什么不需要..
比如网吧.明白.

不明白的是你,llzpp的例子跟你说的(NAT)是两码事.
我更
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP