Of course you can edit these with appropriate addresses and numbers. The ones used are just examples. Unlike Wireshark's Display Filter syntax, Capture filters use Berkley Packet Filter syntax. Here are our favorites.
1. host #.#.#.#
Capture only traffic to or from a specific IP address. Example: host 192.168.1.1
2. net #.#.#.#/24 or net #.#.#.# mask 255.255.255.0
Capture traffic to or from (sources or destinations) a range of IP addresses. Example: net 192.168.1.0. The two commands are the same result.
- src net 192.168.1.0/24
Capture traffic with a source range of IP addresses.
- dst net 192.168.1.0/24
Capture traffic with a destination range of IP addresses.
3. ether host ##:##:##:##:##:##
Captures only traffic to or from the MAC address used. Capitalizing hexadecimal letters does not matter. Example: ether host 01:0c:5e:00:53:00
Captures only VLAN traffic.
- vlan and host #.#.#.#
Captures VLAN traffic for a particular host.
- vlan and (host #.#.#.# and port 80)
Captures VLAN traffic for a paticular host and a particular port (HTTP in the example).
5. ip or ip6
Captures only IP (ip is IPv4, ip6 is IPv6) traffic.
Captures only TCP traffic.
7. port xx
Capture single source or destination port traffic. Example: port 80. Another example: port 53 for DNS traffic.
8. host www.myhostname.com and not (port xx or port yy) or www.myhostname.com and not port xx and not port yy
Capture all traffic, exclude specific packets. The two commands above are the same result.
9. tcp portrange 1800-1880
Capture traffic within a range of ports. Example: tcp portrange 20-21 will capture all FTP traffic.
10. not broadcast and not multicast
Capture only Unicast traffic.
Capture PPPOE traffic.
- pppoes and host #.#.#.#
Captures PPPOE traffic for a particular host.
- pppoes and (host #.#.#.# and port 80)
Captures PPPOE traffic for a paticular host and a particular port (HTTP in the example).
12. port sip
Captures all SIP traffic (VoIP).
- tcp port sip
Captures VoIP SIP traffic using TCP.
- udp port sip
Captures VoIP SIP traffic using UDP.
13. dst host ff02::1
Captures all IPv6 traffic within the local network that is multicast (such as Neighbor and Router advertisements). It will include the multicast queries and listenners (MLD) traffic.
14. ip6 and not ip proto 41
Capture IPv6 Native Traffic Only. This will exclude tunnelled IPv6.
15. ip proto 41
Capture only IPv6 over IPv4 Tunnelled Traffic.
Should we have done a top 20? What else would you add?