macOS中“任意”伪设备的模拟

问题描述 投票:2回答:1

是否有可能通过tcpdump从MacOS中的所有设备捕获数据包?在Linux中,我将使用'sudo tcpdump -i any'。在我的MacOS中,当我执行“ sudo tcpdump -D”时,看不到“任何”伪设备。

macos capture tcpdump any
1个回答
0
投票

tcpdump在我的测试中接受macOS上的any接口,因此在回答您的问题时,Linux上any的类似物是macOS上的any

bash-5.0 $ sudo tcpdump -i any
tcpdump: data link type PKTAP
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type PKTAP (Apple DLT_PKTAP), capture size 262144 bytes
09:43:57.789302 IP6 dsldevice7.attlocal.net.domain > 2600:1700:a700:7340:6dad:2758:c536:f29f.56483: 4283 1/0/0 SOA (85)
09:43:57.789324 IP6 2600:1700:a700:7341:6dad:2759:c536:f29f > dsldevice7.attlocal.net: ICMP6, destination unreachable, unreachable port, 2600:1700:a700:7340:6ded:2759:c536:f29f udp port 56423, length 141
...

tcpdump应该具有相同的选项(manpage)在macos和linux上都可以使用,下面将详细介绍。如果您有tcpdump的旧版本(我的版本是4.9.3 / Apple版本83.200.3),则可以使用brew install tcpdump更新它。

Macos / Linux Tcpdump的区别

如果有疑问,您仍然应该查看联机帮助页,但这是差异的摘要:

Linux

  • -Q direction:选择发送/接收方向(输入/输出/输入)

Macos

  • -k:控制分组元数据的显示
  • -Q:基于数据包元数据指定过滤器表达式
  • -P:保存到pcapng

Note:与Linux或* BSD不同,Macos does not support -Q direction

© www.soinside.com 2019 - 2024. All rights reserved.