免费注册 查看新帖 |

Chinaunix

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

[FreeBSD] freebsd ipfw+ipnat+dummynet 网速慢 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-16 15:09 |只看该作者 |倒序浏览
同学们帮我看看 我做的freebsd7.0 ipfw+ipnat+dummynet  

下面是IPFW的规则
#add deny log ip from any to any ipoptions rr
#add deny log ip from any to any ipoptions ts
#add deny log ip from any to any ipoptions ssrr
#add deny log ip from any to any ipoptions lsrr
#add deny tcp from any to any in tcpflags syn,fin
#########re1 == WAN
#########re0 == LAN
add divert 8668 ip from any to any via re1  #WAN PORT
#add allow tcp from any to me 80
#add allow tcp from any to me 443
#add allow tcp from any to me 25
#add allow tcp from any to me 110
#######dummynet
pipe 1 config bw 50KByte/s
pipe 2 config bw 50KByte/s
add pipe 1 ip from 192.168.1.191 to any out
add pipe 2 ip from any to 192.168.1.191 in

### 192.168.10.2 # 3-4#
pipe 3 config bw 50KByte/s
pipe 4 config bw 50KByte/s
add pipe 3 ip from 192.168.10.2 to any out
add pipe 4 ip from any to 192.168.10.2 in

### 192.168.10.3 # 5-6#
pipe 5 config bw 50KByte/s
pipe 6 config bw 50KByte/s
add pipe 5 ip from 192.168.10.3 to any out
add pipe 6 ip from any to 192.168.10.3 in
。。。。
。。。。
。。。。
#######private network
add allow all from any to any via lo0
############lan #############
############ dns ###########
add allow udp from any 53 to me in recv x10
add allow udp from any 53 to 124.193.200.70
add allow udp from any to any out
add allow udp from any to any in
############
add check-state
add allow tcp from any to any out setup keep-state
add allow tcp from any to any out
add allow udp from any to any out
add allow gre from any to any out setup keep-state
add allow gre from any to any out
add allow udp from any 53 to any
add allow icmp from any to any
add allow all from any to 192.168.10.0/24
add allow all from 192.168.10.0/24 to any
add 65534 deny all from any to any
#add allow icmp from any to any icmptypes 3,4
#add allow icmp from any to any icmptypes 8 out
#add allow icmp from any to any icmptypes 0,11 in
用公司其他机器测试,下载速度在50K左右,但打开某些网页速度很慢,而且还有没限制的机器上网也很慢,不知道是不是和规则有关,请高手指点

论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
2 [报告]
发表于 2008-10-16 17:49 |只看该作者
1、都用ipfw了,为什么还要用ipnat?
2、divert natd的两个方向最好分开。
3、192.168.10.3和192.168.10.4,192.168.1.191配置基本上差不多,为什么不合到一块去?
4、限速时,最好指明xmit和recv。
5、内网有点乱,估计65534规则没什么用途。因为基本上都allow了。
6、内网中,就别用keep-state了,对你的规则好像没什么用途。

论坛徽章:
0
3 [报告]
发表于 2008-10-17 10:38 |只看该作者
用ipnat做内网服务器的端口映射,用ipfw做流量控制和过滤,但是做了流量控制后延时增大到50ms左右,特别是当打开网站的时候,网速特别慢,删除策略后恢复正常,请问是什么原因导致延时增大?使用的策略是否有问题?
# ping www.sina.com
PING jupiter.sina.com.cn (202.108.33.32): 56 data bytes
64 bytes from 202.108.33.32: icmp_seq=0 ttl=241 time=45.074 ms
64 bytes from 202.108.33.32: icmp_seq=1 ttl=241 time=45.916 ms
64 bytes from 202.108.33.32: icmp_seq=2 ttl=241 time=47.338 ms
64 bytes from 202.108.33.32: icmp_seq=3 ttl=241 time=45.575 ms
64 bytes from 202.108.33.32: icmp_seq=4 ttl=241 time=45.087 ms

论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
4 [报告]
发表于 2008-10-17 11:20 |只看该作者
限速增大延时正常,因为每个流量都要通过一个管道或队列。

网速慢不正常。

看你的ipfw规则,也用ipfw做nat了,所以哪个地方肯定出问题。

现在的ipfw nat性能也不错,ipnat和ipfw没有很大的优势,既然用了ipfw,可以考虑不用ipnat了。

论坛徽章:
0
5 [报告]
发表于 2008-10-17 11:38 |只看该作者
这是我做的NAT 请问在ipfw 里怎么做单独的内网IP端口映射呀?我不想把整个IP映射出去
# cat natd.conf
same_ports                      yes
use_sockets                     yes
redirect_port tcp 192.168.10.208:443 124.193.X.X:443
redirect_port tcp 192.168.10.208:25 124.193.X.X:25
redirect_port tcp 192.168.10.208:110 124.193.X.X:110
redirect_port tcp 192.168.10.250:53 124.193.X.X:53
redirect_port udp 192.168.10.250:53 124.193.X.X:53
redirect_port tcp 192.168.10.250:80 124.193.X.X:80
#

论坛徽章:
0
6 [报告]
发表于 2008-10-17 11:40 |只看该作者
你有MSN吗? 可以加MSN吗? robinzhao518@hotmail.com

论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
7 [报告]
发表于 2008-10-17 18:10 |只看该作者
还是看看ipfw的man吧。

http://blog.chinaunix.net/u1/38866/showart_1149636.html

虽然现在流行pf,但是由于我一开始用ipfw,所以也不想换了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP