filtre tcpdump sur le masque de réseau et de sous-réseau

26

J'utilise la commande tcpdump suivante:

tcpdump -w net75.out -s 0 host 65.207.95.222

Je veux changer le filtre sur l'hôte unique pour qu'il soit toutes les adresses du sous-réseau suivant:

65.192.0.0/10

Je n'ai pas pu comprendre comment spécifier un filtre tcpdump pour ce faire.

S'il vous plaît donnez votre avis.

harrije
la source

Réponses:

42

Essayez plutôt cela.

tcpdump -w net75.out -s 0 net 65.192.0.0/10

filtre pcap homme (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.,
          192.168.1.0), dotted triple (e.g., 192.168.1), dotted pair (e.g,
          172.16),   or   single   number   (e.g.,  10);  the  netmask  is
          255.255.255.255 for a dotted quad (which means that it's  really
          a  host  match),  255.255.255.0 for a dotted triple, 255.255.0.0
          for a dotted pair, or 255.0.0.0 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
          length.

   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.
Zoredache
la source
2
Merci. J'ai seulement regardé la page de manuel de tcpdump, qui n'a pas le filtre net aussi clairement documenté que la page de manuel de pcap-filter.
harrije