List a Macs Local IP Address History Over Time or from Specific Dates

May 26, 2023 - 3 Comments

Terminal in Mac OS

If you ever find yourself needing to know a history of a specific Macs assigned local IP addresses, you can find this potentially helpful networking information from the command line. This trick will report all local IP addresses which have been used by a Mac, and, very helpfully, it will also offer the specific date and time a given IP address was assigned to the Mac. Yes, this data spans networks and applies even if it’s no longer the active IP of the machine.


If you’re wondering why this may be helpful, IP address history can be invaluable for network troubleshooting purposes like the annoying same IP error, systems and network administration, digital forensics, and likely other tasks as well.

Get a List of Local IP Addresses Assigned to a Mac

The following command will get a complete list of all locally assigned IP addresses on a given Mac:

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

An example of such output would look something like this, keep in mind the output can be extremely long depending on the size of the wifi.log file and the age of the Mac, thus piping the results through less or more for an easier read. If you want the full history dumped to the command line, leave out the last pipe “|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

This is obviously quite a bit of data, which is why it’s piped through less, or you can redirect it to a text file if you’d like to review it elsewhere.

Finding a Macs IP Address for Specific Date or Time

Another option is to search specifically for local assigned IP addresses used on a given date. The format used for this is YYY ZZZ XX, where YYY is the first three letters of the day, ZZZ is the first three letters of the month, and XX is the numerical date. For example:

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

This would report back entries that match that date only:

$ 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

If desired, you could get even more specific and search for times of day when an IP address was assigned, if you’re going to grep for that, remember to use 24 hour time, and account for the time information being determined by the local machine time zone settings.

Going further for discovery or troubleshooting, you could compare the data found within wifi.log to a history of connected wi-fi networks to uncover further details, or to remedy an IP issue with a specific router.

It’s worth noting that some modern versions of MacOS do not include local IP information in wifi.log, but earlier versions of MacOS and Mac OS X do, so if you are scanning the log files and do not find the information you’re looking for, consider which version of MacOS is in use.

If you know of any other helpful tricks pertaining to local IP address history for a specific machine, let us know in the comments.

.

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS, Tips & Tricks

3 Comments

» Comments RSS Feed

  1. Sam McLeod says:

    The cat in this example is useless, it does the same thing grep does.

    cat /var/log/wifi.log |grep “Local IP” |less

    Should instead be simply

    grep “Local IP” /var/log/wifi.log|less

  2. Bev in TX says:

    Thanks for this info about the Wi-Fi log file, of which I was previously unaware.

    I realize that the main impetus of your article is about that file, not the intricacies of the commands used to garner data from that file. I thought that some might like to see those commands in a shorter form, noting that there are other situations in which a cat command or multiple greps might be required.

    grep “Local IP” /var/log/wifi.log |less

    grep “Thu Jul 23.*Local IP” /var/log/wifi.log

  3. Michael Spurlock says:

    The title of this article should be updated to reflect that this only applies to WiFi addresses.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site