下面是Ethereal幫助中給出的一些簡單的例子:
1. Ethernet: capture all traffic to and from the Ethernet address 08:00:08:15:ca:fe
ether host 08:00:08:15:ca:fe
2. IP: capture all traffic to and from the IP address 192.168.0.10
host 192.168.0.10
3. TCP: capture all traffic to and from the TCP port 80 (http) of all machines
tcp port 80
4. combined: capture all traffic to and from 192.168.0.10 except http
host 192.168.0.10 and not tcp port 80
【注意】上面例子表達式中的IP地址對於IP中嵌套IP來講,僅對外層IP有效,對嵌套在IP包中的IP是無效的。
R6口抓包的例子
表達式:ip[6:2] & 0x1fff = 0
表達式整體的含義爲:從IP包中取出第6和第7(從0字節開始數)這2個字節,和0x1fff相與,如果結果爲0,則抓取該包,否則丟掉。
表達式:ip[2:2] & 0xffff =0x005c
按此表達式抓包,可以抓到所有長度爲92字節的IP包,其它包被過濾掉,抓包文件中只有這些長度爲92字節的PING包。