Count of Packets by Host Address
This DTrace one-liner counts UDP received packets by host address:
# dtrace -n 'udp:::receive { @[args[2]->ip_saddr] = count(); }'
dtrace: description 'udp:::receive ' matched 5 probes
^C
127.0.0.1 7
fe80::214:4fff:fe8d:59aa 14
192.0.2.35/27 43
192.0.2.14/27 44
192.0.2.45/27 3722
The preceding output shows that 7 UDP packets were received from 127.0.0.1
, 14 UDP packets from the IPv6 host fe80::214:4fff:fe8d:59aa
.