Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the following tcpdump command:

tcpdump -w net75.out -s 0 host

I want to change the filter on the single host to be all addresses in the following subnet:

I have not been able to figure out how to specify a tcpdump filter to do this.

Please advise.

share|improve this question
up vote 14 down vote accepted

Try this instead.

tcpdump -w net75.out -s 0 net

man pcap-filter(7)

   dst net net
          True if the IPv4/v6 destination address of the packet has a net-
          work  number of net.  Net may be either a name from the networks
          database (/etc/networks, etc.) or a  network  number.   An  IPv4
          network   number   can  be  written  as  a  dotted  quad  (e.g.,
, dotted triple (e.g., 192.168.1), dotted pair (e.g,
          172.16),   or   single   number   (e.g.,  10);  the  netmask  is
 for a dotted quad (which means that it's  really
          a  host  match), for a dotted triple,
          for a dotted pair, or for a single  number.   An  IPv6
          network  number  must  be  written  out  fully;  the  netmask is
          ff:ff:ff:ff:ff:ff:ff:ff, so IPv6 "network"  matches  are  really
          always  host  matches,  and  a  network match requires a netmask

   src net net
          True if the IPv4/v6 source address of the packet has  a  network
          number of net.

   net net
          True  if either the IPv4/v6 source or destination address of the
          packet has a network number of net.

   net net mask netmask
          True if the IPv4 address matches net with the specific  netmask.
          May  be qualified with src or dst.  Note that this syntax is not
          valid for IPv6 net.

   net net/len
          True if the IPv4/v6 address matches net with a netmask len  bits
          wide.  May be qualified with src or dst.
share|improve this answer
Thanks. I only looked at the man page for tcpdump, which does not have the net filter as clearly documented as the man page for pcap-filter. – harrije Jan 27 '12 at 0:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.