今日重新讀了 OpenWRT 中付的 qos-scripts,發現它其實高度整合了 IMQL7-Filter 等機制與 HFSC, SFQ, RED scheduling algorithms ,並且使用了新的 UCI 設定介面。

預設的設定是

# QoS configuration for OpenWrt

# INTERFACES:
config interface wan
	option classgroup  "Default"
	option enabled      1
	option overhead     1
	option upload       128
	option download     1024

# RULES:
config classify
	option target       "Bulk"
	option ipp2p        "all"
config classify
	option target       "Bulk"
	option layer7       "edonkey"
config classify
	option target       "Bulk"
	option layer7       "bittorrent"
config classify
	option target       "Priority"
	option ports        "22,53"
config classify
	option target       "Normal"
	option proto        "tcp"
	option ports        "20,21,25,80,110,443,993,995"
config classify
	option target       "Express"
	option ports        "5190"
config default
	option target       "Express"
	option proto        "udp"
	option pktsize      "-500"
config reclassify
	option target       "Priority"
	option proto        "icmp"
config default
	option target       "Bulk"
	option portrange    "1024-65535"
config reclassify
	option target       "Priority"
	option proto        "tcp"
	option pktsize      "-128"
	option mark         "!Bulk"
	option tcpflags     "SYN"
config reclassify
	option target       "Priority"
	option proto        "tcp"
	option pktsize      "-128"
	option mark	        "!Bulk"
	option tcpflags     "ACK"

# Don't change the stuff below unless you
# really know what it means 🙂

config classgroup "Default"
	option classes      "Priority Express Normal Bulk"
	option default      "Normal"

config class "Priority"
	option packetsize  400
	option maxsize     400
	option avgrate     10
	option priority    20
config class "Priority_down"
	option packetsize  1000
	option avgrate     10

config class "Express"
	option packetsize  1000
	option maxsize     800
	option avgrate     50
	option priority    10

config class "Normal"
	option packetsize  1500
	option packetdelay 100
	option avgrate     10
	option priority    5
config class "Normal_down"
	option avgrate     20

config class "Bulk"
	option avgrate     1
	option packetdelay 200

於是系統可以辨識使用的是哪一種協定,且 TCP ACK 跟 SYN 會有比較高的優先值,因此使用非下載的協定如 TELNET 等反應速度會比較快。而 ICMP、ssh、DNS 等協定會有比較高的優先值,接下來是常用的網頁、電子郵件等服務。而 P2P 如 eDonkey, BitTorrent 與其他協定則只能排在最低的優先次序。如此即便上網同時養動物,也可以避免影響到一般的網頁瀏覽與電子郵件使用。

如此的實做跟一般裝在 Windows 系統上的 cFosSpeed (cFosSpeed 原理中文說明) 為異曲同工。跟前幾天見到 Mobile01 上的 AXIMCom P2P Gear 討論 以及 Lantech WL54G-MIMO BR 的討論,應該也是使用相同的技術與原理。FON 所銷售的 Fonera 是基於 OpenWRT 開發,其實也使用同樣的技術來作 QoS,因此若在 User Zone 啟用了這樣的機制,就不用擔心透過 Public ESSID 使用 P2P 軟體所造成的頻寬影響。

Linux 上還有一個比較簡單陽春的實做,是 Wonder Shaper,基本上原理相同,也是避免上下傳封包佔滿小水管,以便讓一般的網路連線可以正常使用。這個 Script 已經被移植到 DebianOpenWRT 中。技術細節可以參考 Linux Advanced Routing & Traffic Control

Thanks to YK, I’m one of the few lucky guys who can take la Fonera home.

Last Sunday, I attended to the Firefox 2 Party at Taiwan, and met Jordi Vallejo and YK again. We shares the new progress of FON.com last few weeks. Finally, FON.com is going to setup a new office in Taipei and sell La Fonera at December. FON.com is linking La Fonera with several services on the internet, and will provide new devices integrated with these creative features. They are also looking for people who can help to port the firmware on the hardware platforms. We exchanged some ideas and development informations on the wireless router, and YK gave me the new Fonera which was showing in the Firefox 2 Party.

Continue reading