Фильтр tcpdump в маске сети и подсети

Я использую следующую команду tcpdump:

tcpdump -w net75.out -s 0 host 65.207.95.222

Я хочу изменить фильтр на одном хосте для всех адресов в следующей подсети:

65.192.0.0/10

Мне не удалось выяснить, как указать для этого фильтр tcpdump.

Просьба сообщить.

22 голоса | спросил harrije 27 Jam1000000amFri, 27 Jan 2012 03:18:43 +040012 2012, 03:18:43

1 ответ


32

Попробуйте это вместо.

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

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.,
          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 27 Jam1000000amFri, 27 Jan 2012 03:20:49 +040012 2012, 03:20:49

Похожие вопросы

Популярные теги

security × 330linux × 316macos × 2827 × 268performance × 244command-line × 241sql-server × 235joomla-3.x × 222java × 189c++ × 186windows × 180cisco × 168bash × 158c# × 142gmail × 139arduino-uno × 139javascript × 134ssh × 133seo × 132mysql × 132