列出一段时间内或特定日期的 Mac 本地 IP 地址历史记录

列出一段时间内或特定日期的 Mac 本地 IP 地址历史记录

如果您发现自己需要了解分配本地 IP 地址的特定 Mac 的历史记录,您可以从命令行找到这些可能有用的网络信息。此技巧将报告Mac已使用的所有本地IP地址,并且非常有帮助的是,它还将提供给定IP地址分配给Mac的特定日期和时间。是的,此数据跨网络,即使它不再是计算机的活动 IP,也适用。


如果您想知道为什么这会有所帮助,IP 地址历史记录对于网络故障排除目的非常宝贵,例如烦人的相同 IP 错误、系统和网络管理、数字取证以及可能的其他任务。

获取分配给 Mac 的本地 IP 地址列表

以下命令将获取给定 Mac 上所有本地分配的 IP 地址的完整列表:

cat /var/log/wifi.log |grep "Local IP" |less

此类输出的示例如下所示,请记住,输出可能非常长,具体取决于 wifi.log 文件的大小和 Mac 的年龄,从而通过或多或少的方式输送结果以便于阅读。如果要将完整历史记录转储到命令行,请省略最后一个管道“|less”:

Sat Jul 4 15:23:00.296 wl0: setup_keepalive: Local IP: 192.168.1.139
Sat Jul 4 16:24:05.694 wl0: setup_keepalive: Local IP: 192.168.1.139
Sat Jul 4 16:45:32.476 wl0: setup_keepalive: Local IP: 192.168.1.139
Sat Jul 4 20:22:31.770 wl0: setup_keepalive: Local IP: 192.168.1.139
Sun Jul 5 10:38:38.518 wl0: setup_keepalive: Local IP: 192.168.1.139
Sun Jul 5 20:21:48.599 wl0: setup_keepalive: Local IP: 192.168.1.139
Mon Jul 6 02:28:09.715 wl0: setup_keepalive: Local IP: 192.168.1.142
Mon Jul 6 02:43:17.257 wl0: setup_keepalive: Local IP: 192.168.1.142
Mon Jul 6 04:56:42.701 wl0: setup_keepalive: Local IP: 192.168.1.142
Mon Jul 6 05:11:46.536 wl0: setup_keepalive: Local IP: 192.168.1.142
Mon Jul 6 16:59:42.216 wl0: setup_keepalive: Local IP: 192.168.1.142
Mon Jul 6 19:11:29.563 wl0: setup_keepalive: Local IP: 192.168.1.142
Mon Jul 6 19:59:55.667 wl0: setup_keepalive: Local IP: 192.168.1.142
Mon Jul 6 22:11:50.543 wl0: setup_keepalive: Local IP: 192.168.1.142
Mon Jul 6 22:26:56.589 wl0: setup_keepalive: Local IP: 192.168.1.142
Tue Jul 7 00:38:51.855 wl0: setup_keepalive: Local IP: 192.168.1.14
Tue Jul 7 00:53:55.393 wl0: setup_keepalive: Local IP: 192.168.1.14
Tue Jul 7 21:04:15.704 wl0: setup_keepalive: Local IP: 192.168.1.14
Tue Jul 7 22:05:00.573 wl0: setup_keepalive: Local IP: 192.168.1.14
Tue Jul 7 22:06:15.692 wl0: setup_keepalive: Local IP: 192.168.1.14
Tue Jul 7 23:07:00.554 wl0: setup_keepalive: Local IP: 192.168.1.12
Tue Jul 7 23:08:15.577 wl0: setup_keepalive: Local IP: 192.168.1.14
Wed Jul 8 00:27:41.617 wl0: setup_keepalive: Local IP: 192.168.1.14
Wed Jul 8 02:16:26.556 wl0: setup_keepalive: Local IP: 192.168.1.14
Wed Jul 8 02:17:41.587 wl0: setup_keepalive: Local IP: 192.168.1.12
Wed Jul 8 04:06:26.555 wl0: setup_keepalive: Local IP: 192.168.1.14
Wed Jul 8 04:07:41.605 wl0: setup_keepalive: Local IP: 192.168.1.12
Wed Jul 8 05:56:26.566 wl0: setup_keepalive: Local IP: 192.168.1.14
Wed Jul 8 05:57:40.226 wl0: setup_keepalive: Local IP: 192.168.1.12
Wed Jul 8 07:01:33.566 wl0: setup_keepalive: Local IP: 192.168.1.14
Wed Jul 8 08:17:18.563 wl0: setup_keepalive: Local IP: 192.168.1.12
Wed Jul 8 10:59:16.586 wl0: setup_keepalive: Local IP: 192.168.1.14
Wed Jul 8 11:34:45.866 wl0: setup_keepalive: Local IP: 192.168.1.12
Wed Jul 8 20:52:50.550 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 8 22:19:41.216 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 8 22:22:06.838 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 8 22:24:44.172 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 8 22:27:09.892 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 8 22:29:37.016 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 8 22:31:21.625 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 8 23:31:32.612 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 8 23:33:58.271 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 8 23:36:24.034 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 8 23:38:08.778 wl0: setup_keepalive: Local IP: 192.168.0.1
Thu Jul 9 01:22:14.939 wl0: setup_keepalive: Local IP: 192.168.0.1
Thu Jul 9 01:24:40.627 wl0: setup_keepalive: Local IP: 192.168.0.1
Sun Jul 12 00:51:33.181 wl0: setup_keepalive: Local IP: 192.168.0.1
Sun Jul 12 02:40:18.606 wl0: setup_keepalive: Local IP: 192.168.0.1
Sun Jul 12 04:11:02.478 wl0: setup_keepalive: Local IP: 192.168.0.1
Sun Jul 12 05:59:47.615 wl0: setup_keepalive: Local IP: 192.168.0.1
Sun Jul 12 07:00:48.608 wl0: setup_keepalive: Local IP: 192.168.0.1
Sun Jul 12 08:01:33.610 wl0: setup_keepalive: Local IP: 192.168.0.1
Sun Jul 12 09:02:18.613 wl0: setup_keepalive: Local IP: 192.168.0.7
Sun Jul 12 09:18:30.315 wl0: setup_keepalive: Local IP: 192.168.0.2
Sun Jul 12 10:41:23.334 wl0: setup_keepalive: Local IP: 192.168.0.2
Sun Jul 12 11:42:08.615 wl0: setup_keepalive: Local IP: 192.168.0.2
Sun Jul 12 17:18:43.755 wl0: setup_keepalive: Local IP: 192.168.0.2
Sun Jul 12 18:58:09.198 wl0: setup_keepalive: Local IP: 192.168.0.2
Sun Jul 12 20:02:17.617 wl0: setup_keepalive: Local IP: 192.168.0.2
Sun Jul 12 21:30:15.170 wl0: setup_keepalive: Local IP: 192.168.0.2
Sun Jul 12 23:01:01.241 wl0: setup_keepalive: Local IP: 192.168.0.2
Sun Jul 12 23:51:46.368 wl0: setup_keepalive: Local IP: 192.168.0.2
Mon Jul 13 00:52:31.643 wl0: setup_keepalive: Local IP: 192.168.0.7
Mon Jul 13 02:41:16.616 wl0: setup_keepalive: Local IP: 192.168.0.7
Mon Jul 13 04:12:01.890 wl0: setup_keepalive: Local IP: 192.168.0.7
Mon Jul 13 05:57:46.613 wl0: setup_keepalive: Local IP: 192.168.0.7
Mon Jul 13 07:00:52.609 wl0: setup_keepalive: Local IP: 192.168.0.7
Tue Jul 14 16:19:32.460 wl0: setup_keepalive: Local IP: 192.168.0.7
Tue Jul 14 17:20:17.612 wl0: setup_keepalive: Local IP: 192.168.0.7
Tue Jul 14 18:21:02.613 wl0: setup_keepalive: Local IP: 192.168.0.7
Tue Jul 14 19:21:47.610 wl0: setup_keepalive: Local IP: 192.168.0.7
Tue Jul 14 20:01:53.611 wl0: setup_keepalive: Local IP: 192.168.0.7
Tue Jul 14 21:32:38.610 wl0: setup_keepalive: Local IP: 192.168.0.7
Tue Jul 14 22:03:23.452 wl0: setup_keepalive: Local IP: 192.168.0.7
Tue Jul 14 22:35:51.691 wl0: setup_keepalive: Local IP: 192.168.0.7
Tue Jul 14 23:06:56.536 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 15 00:52:40.897 wl0: setup_keepalive: Local IP: 192.168.0.4
Wed Jul 15 02:41:24.535 wl0: setup_keepalive: Local IP: 192.168.0.4
Wed Jul 15 04:12:09.169 wl0: setup_keepalive: Local IP: 192.168.0.4
Wed Jul 15 05:57:54.613 wl0: setup_keepalive: Local IP: 192.168.0.4
Wed Jul 15 07:01:51.680 wl0: setup_keepalive: Local IP: 192.168.0.4
Wed Jul 15 08:02:35.502 wl0: setup_keepalive: Local IP: 192.168.0.4
Wed Jul 15 09:03:20.606 wl0: setup_keepalive: Local IP: 192.168.0.4
Wed Jul 15 10:11:26.677 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 15 12:25:08.484 wl0: setup_keepalive: Local IP: 192.168.0.7
Wed Jul 15 15:09:38.001 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 16 04:11:13.624 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 16 05:59:58.628 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 16 07:01:45.087 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 16 08:02:30.605 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 16 09:03:15.618 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 16 10:04:31.065 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 16 12:44:06.798 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 16 16:10:53.498 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 16 17:39:54.537 wl0: setup_keepalive: Local IP: 192.168.0.7

这显然是相当多的数据,这就是为什么它通过较少的原因,或者如果您想在其他地方查看它,可以将其重定向到文本文件。

查找特定日期或时间的 Mac IP 地址

另一种选择是专门搜索给定日期使用的本地分配的 IP 地址。用于此格式的格式是 YYY ZZZ XX,其中 YYY 是一天的前三个字母,ZZZ 是月份的前三个字母,XX 是数字日期。例如:

cat /var/log/wifi.log |grep "Local IP" |grep "Thu Jul 23"

这将仅报告与该日期匹配的条目:

$ cat /var/log/wifi.log |grep "Local IP" |grep "Thu Jul 23"
Thu Jul 23 00:07:53.688 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 23 01:56:38.622 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 23 02:23:07.227 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 23 04:11:52.817 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 23 06:00:37.623 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 23 07:01:21.625 wl0: setup_keepalive: Local IP: 192.168.0.7
Thu Jul 23 08:50:06.748 wl0: setup_keepalive: Local IP: 192.168.0.7

如果需要,您可以更具体地搜索分配 IP 地址的时间,如果您要为此使用 grep,请记住使用 24 小时时间,并考虑由本地计算机时区设置确定的时间信息。

为了进一步发现或故障排除,您可以将在wifi中找到的数据进行比较.log与连接的Wi-Fi网络的历史进行比较,以发现更多详细信息,或解决特定路由器的IP问题。

值得注意的是,某些现代版本的MacOS不包含wifi.log中的本地IP信息,但早期版本的MacOS和Mac OS X包含本地IP信息,因此,如果您正在扫描日志文件并且找不到要查找的信息,请考虑正在使用哪个版本的MacOS。

正文完
 0