QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 790|回复: 1

關於服務網絡流量管理設置

[复制链接]
发表于 2004-11-25 12:35:34 | 显示全部楼层 |阅读模式
在網上各討論linux論壇,發覺這個題目較少人討論, 所以前幾天開始閉關, 埋頭苦讀相關文件.
經過幾天努力,大概知道怎樣用在linux下免費作成服務網絡流量管理設置, 但實現起來不成功

這是我的網絡環境
代码:
[code:1]
                         eth0        eth1
---------Internet----------[firewall]-----------private lan-----------|
[/code:1]

qdisc 配置圖


firewall是用redhat AS 3 U3 搭建的,配合shorewall 來設置firewall rules
private lan 內有台ftp server

在ftp server上 listen port 21, 設置50000:51000 給PASV 連接

shorewall 文件配置
/etc/shorewall/rules
## 意思即在FW dnat port 21 到 ftp server上
DNAT all loc:192.168.103.100 tcp 21,20,50000:51000


##這是服務網絡流量管理設置
/etc/shorewall/tcrules
1 eth0 0.0.0.0/0 tcp - 80
2 eth0 0.0.0.0/0 tcp - 21,20,50000:51000
3 eth0 0.0.0.0/0 tcp all


/etc/shorewall/tcstart
#!/bin/bash

tc qdisc add dev eth0 root handle 1: htb default 30
tc class add dev eth0 parent 1: classid 1:1 htb rate 440kbit burst 15k
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 300kbit
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 56kbit <----- 只給對ftp 56kbit
tc class add dev eth0 parent 1:1 classid 1:30 htb rate 84kbit ceil 440kbit

tc filter add dev eth0 protocol ip parent 1:0 handle 1 fw classid 1:10
tc filter add dev eth0 protocol ip parent 1:0 handle 2 fw classid 1:20
tc filter add dev eth0 protocol ip parent 1:0 handle 3 fw classid 1:30


但用以下指令來看每條queue的情況,發現ftp 沒有分流到 56kbit 這條queue到
tc -s -d class show dev eth0

所以不知到那為有設置linux 的服務網絡流量管理設置經驗? 一起研究下
发表于 2004-11-26 12:40:27 | 显示全部楼层
大概看了一下,初步认为问题出在你的shorewall配置上。 仔细看看 shorewall 的文档吧。

[quote:34dc2b61f2="http://www.shorewall.net/traffic_shaping.htm"]Important

Unlike entries in /etc/shorewall/rules, evaluation of entries in /etc/shorewall/tcrules continues after a match. So the final mark assigned to each packet is determined by the last matching entry in the /etc/shorewall/tcrules file.[/quote]

/etc/shorewall/tcrules 里的顺序改成 3 1 2 试试看。

另,关于Linux 高级路由和流量控制的专门站点在这里: http://lartc.org
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-26 10:23 , Processed in 0.065294 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表