2009年1月22日 星期四

legacy power save and triggered power save

The WME method does not allow nonperiodic traffic to use triggered power save; it must use legacy power save instead.

Legacy power save is less efficient than triggered power save

A single trigger frame can retrieve multiple frames in triggered power save
One cannot tell which is the right legacy option to use because TIMs do not indicate how much traffic is buffered, leading to greater inefficiency
PS polls are inefficient if long packet bursts are buffered, as a PS poll is needed for every buffered frame
PM bit (exiting and returning to power save mode) is inefficient for independent frames, as it involves two extra frames for each buffered frame
If the wrong legacy option is chosen, the inefficiency of legacy power save is even greater

By enabling all applications (periodic and nonperiodic) to use the new power save, battery life is extended, as in 802.11e

2009年1月16日 星期五

How to generate subnet host list

perl -e 'for (1...254) {print "10.0.1.$_\n"}' |fping -a -q 2>/dev/null

nmap -sP 10.0.1.0/24

ethernet diagnostic tools

1.1 mii-tool 介紹

mii-tool - view, manipulate media-independent interface status
(mii-tool 是查看,管理介質的網絡接口的狀態)
有時網卡需要配置協商方式,比如10/100/1000M的網卡半雙工、全雙工、自動協商的配置。但大多數的網絡設備是不用我們來修改協商,因為大多數網絡設置接入的時候,都採用自動協商來解決相互通信的問題。不過自動協商也不是萬能的,有時也會出現錯誤,比如丟包率比較高,這時就要我們來指定網卡的協商方式 。

mii-tool 就是能指定網卡的協商方式。下面我們說一說mii-tool的用法;

1.2 mii-tool 的用法;

mii-tool 在更改網絡設備通信協商方式的方法比較簡單,用 -v 參數來查看網絡接口的狀態;看下面的例子;

mii-tool 更改網絡接口協商的方法;

[root@localhost ~]# mii-tool --help
usage: mii-tool [-VvRrwl] [-A media,... | -F media] [interface ...]
-V, --version display version information
-v, --verbose more verbose output 註:顯示網絡接口的信息;
-R, --reset reset MII to poweron state 註:重設MII到開啟狀態;
-r, --restart restart autonegotiation 註:重啟自動協商模式;
-w, --watch monitor for link status changes 註:查看網絡接口連接的狀態變化;
-l, --log with -w, write events to syslog 註:寫入事件到系統日誌;
-A, --advertise=media,... advertise only specified media 註:指令特定的網絡接口;
-F, --force=media force specified media technology 註:更改網絡接口協商方式;
media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,
(to advertise both HD and FD) 100baseTx, 10baseT


* 實例一:查看網絡接口的協商狀態;

[root@localhost ~]# mii-tool -v eth0
eth0: negotiated 100baseTx-FD, link ok
product info: vendor 00:00:00, model 0 rev 0
basic mode: autonegotiation enabled
basic status: autonegotiation complete, link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control

註:上面的例子,我們可以看得到是自動協商。注意紅字的部份;

* 實例二:更改網絡接口協商方式;

更改網絡接口的協商方式,我們要用到-F選項,後面可以接 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD等參數;

如果我們想把網絡接口eth0改為 1000Mb/s全雙工的模式應該怎麼辦呢?

[root@localhost ~]# mii-tool -F 100baseTx-FD

[root@localhost ~]#mii-tool -v eth0
eth0: 100 Mbit, full duplex, link ok
product info: vendor 00:00:00, model 0 rev 0
basic mode: 100 Mbit, full duplex
basic status: link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD

註:是不是已經改過來了?當然,我們也一樣用ethtool 工具來更改,比如執行下面的命令;

[root@localhost ~]# ethtool -s eth0 speed 100 duplex full

2、ethtool 工具關於網絡協商功能介紹;


ethtool - Display or change ethernet card settings(ethtool 是用來顯示和更改網卡設置的工具);這個工具比較複雜,功能也特別多。由於洋文比較難懂。所以我們還是把網絡設備協商方式的設置方法說一說。


2.1 ethtool 顯示網絡端口設置功能;

這個功能比較好辦。就是ethtool 後面直接接網絽接口就行;比如下面的例子;

[root@localhost ~]# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: No 註:自動協商關閉
Speed: 100Mb/s 註:速度 100Mb
Duplex: Full 註:全雙工
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes 註:eth0已經激活;

2.2 ethtool 設置網卡的協商模式;

在ethtool的-h幫助中我們查看到有這樣的幫助信息;

ethtool -s DEVNAME \
[ speed 10|100|1000 ] \
[ duplex half|full ] \
[ port tp|aui|bnc|mii|fibre ] \
[ autoneg on|off ] \


* 實例一: 把網卡eth0 速度改為10Mb/s,採用半雙工;

[root@cuc03 beinan]# ethtool -s eth1 speed 10 duplex half
[root@cuc03 beinan]# ethtool eth1
Settings for eth1:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: No
Speed: 10Mb/s 註:速度 10M/s
Duplex: Half 註:半雙工
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: no 註:eth1沒有激活;

* 實例二: 把網卡eth0 速度改為100Mb/s,採用全雙工;

[root@cuc03 beinan]# ethtool -s eth1 speed 100 duplex full
[root@cuc03 beinan]# ethtool eth1
Settings for eth1:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: No
Speed: 100Mb/s 註:速度 100M/s
Duplex: Full 註:全雙工
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: no 註:eth1網卡沒有激活;

Linux tcp/ip tuning - Ipsysctl tutorial 1.0.4

http://ipsysctl-tutorial.frozentux.net/ipsysctl-tutorial.html

TCP Tuning Guide

http://fasterdata.es.net/TCP-tuning/linux.html

2009年1月14日 星期三

linux-tcp-ip-stack-pdf

http://www.siukoon.com/~rickyli/linux-tcp-ip-stack.pdf

An introduction to Linux 2.6 kernel programming

http://www.iks.inf.ethz.ch/publications/files/Silvan_Graf_SA.pdf

cross compile bridge-utils

#autoconf
generate configure
#./configure --with-linux-headers=/opt/s5tools/sa6rel_eabi/release/src.build/include
# revise gcc,prefix in Makefile and subfolders' Makefile

make

depend on kernel module llc.ko

2009年1月13日 星期二

packet injection of ipw3945 and rt73

(63) wireshark
ifconfig rausb0 down
rmmod rt73
modprobe rt73
ifconfig rausb0 up
iwconfig rausb0 mode monitor channel 6

rmmod ipw3945
modprobe ipwraw
ifconfig wlan0 up
iwconfig wlan0 mode monitor channel 6