expression = qualifier + id
dst host
src host
host
以上的表达式可以在前面增加一个关键字: ip, arp, rarp, ip6; 如: ip host == ether proto ip and host
ether dst - ehost既可以是/etc/ethers里面的名字也可以是一个数字.
ether src
ether host
gateway - 如果这个包使用作为gateway, ethernet的源或者目的地址是, 但是IP的源和目的地址都不是. 必须是一个名字, 并且必须同时被机器的hostname-to-ip和hostname-to-ethernet-address解析/etc/ethers. 等价表达式: ether host <ehost> and not host <host>
名字和数字都可以用在和, 这个语法目前在IPV6-enabled configuration不工作.
dst net
真如果IPV4/V6的包的目的地址有一个network number . 可以是一个来自/etc/networks
中的名字或者一个network number.
IPV4地址可以是点4格式dotted quad(192.168.1.0) - netmask 255.255.255.255, 或者点3格式dottd triple(192.168.1) - netmask 255.255.255.0, 或者点2格式dotted pair(172.16) - netmask 255.255.0.0, 或者单独数字格式single number(10) - netmask 255.0.0.0.
IPV6地址必须写完整, netmask是 ff:ff:ff:ff:ff:ff:ff:ff, 掩码可以用长度来限制.见下面
src net IPV4/V6源地址
net IPV4/V6源或者目的
net mask 真如果IPV4地址满足掩码满足, 可以是源或者目的. 不适用IPV6
net / 真如果IPV4/V6地址匹配, 并且子网掩码满足长度. 可以是源或者目的.
dst port
真如果包是 ip/tcp, ip/udp, ip6/tcp, ip6/udp有一个目的端口. 可以是一个数字或者名字使用在 /etc/services
.
src port
port
dst portrange <port1-port2> 真如果包是ip/tcp, ip/udp, ip6/tcp, ip6/udp并且有一个目的端口值在和之间
src portrange <port1-port2>
portrange <port1-port2>
tcp或udp前缀可以放在前面的端口限制前面, 如 tcp src port <port>
less
真如果包的大小满足小于等于, 等价表达式: len <= <length>
greater , 等价于: len >= <length>
ip proto
真如果IPV4包的类型是, 可以是数字或者以下名字, icmp, icmp6, igmp, igrp, pim, ah, esp, vrrp, udp, 或者tcp. 注意标示符tcp, udp, icmp
也是关键字, 必须使用\
转义, 在c-shell中用\\
.Note that this primitive does not chase the protocol header chain.
ip6 proto , 用于IPV6, Note that this primitive does not chase the protocol header chain.
ip6 protochain 真如果包是IPV6包, 并且contains protocol header with type protocol in its protocol header chain.
ip6 protochain 6