{"id":36924125,"url":"https://github.com/georg-jung/ArpLookup","last_synced_at":"2026-01-19T18:00:45.344Z","repository":{"id":36497452,"uuid":"227900638","full_name":"georg-jung/ArpLookup","owner":"georg-jung","description":"A .Net Standard 2.0 library supporting ARP lookups on Windows and Linux to find the MAC address corresponding to an IP address.","archived":false,"fork":false,"pushed_at":"2025-11-06T09:40:58.000Z","size":89,"stargazers_count":36,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-21T18:09:17.390Z","etag":null,"topics":["arp","csharp","dotnet","dotnet-standard","mac"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/ArpLookup/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/georg-jung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-13T18:36:40.000Z","updated_at":"2025-11-06T09:51:33.000Z","dependencies_parsed_at":"2024-06-21T05:43:18.025Z","dependency_job_id":"92c8c498-fe44-4a70-95d9-1b6ce7b44c7d","html_url":"https://github.com/georg-jung/ArpLookup","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/georg-jung/ArpLookup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georg-jung%2FArpLookup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georg-jung%2FArpLookup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georg-jung%2FArpLookup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georg-jung%2FArpLookup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/georg-jung","download_url":"https://codeload.github.com/georg-jung/ArpLookup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georg-jung%2FArpLookup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28578952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T17:42:58.221Z","status":"ssl_error","status_checked_at":"2026-01-19T17:40:54.158Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arp","csharp","dotnet","dotnet-standard","mac"],"created_at":"2026-01-12T19:00:25.487Z","updated_at":"2026-01-19T18:00:45.338Z","avatar_url":"https://github.com/georg-jung.png","language":"C#","funding_links":[],"categories":["C# #"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.nuget.org/packages/ArpLookup/\"\u003e\n    \u003cimg\n      alt=\"ArpLookup\"\n      src=\"https://raw.githubusercontent.com/georg-jung/ArpLookup/master/doc/logo.svg\"\n      width=\"100\"\n    /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# ArpLookup\n\n[![Build Status](https://dev.azure.com/georg-jung/ArpLookup/_apis/build/status/georg-jung.ArpLookup?branchName=master)](https://dev.azure.com/georg-jung/ArpLookup/_build/latest?definitionId=1\u0026branchName=master)\n[![NuGet version (ArpLookup)](https://img.shields.io/nuget/v/ArpLookup.svg?style=flat)](https://www.nuget.org/packages/ArpLookup/)\n\nArpLookup is a .Net Standard 2.0 library that provides `Lookup` and `LookupAsync` methods to find the MAC address corresponding to an IP address on Windows and Linux.\n\nThis library is feature-complete according to the current planning. So no frequent updates are expected, although it is actively maintained.\n\n## Download\n\n* [NuGet Package](https://www.nuget.org/packages/ArpLookup/)\n  * `PM\u003e Install-Package ArpLookup` or `dotnet add package ArpLookup`\n* [GitHub Releases](https://github.com/georg-jung/ArpLookup/releases/latest) for the `.nupkg` and `.snupkg` files.\n\n## Usage\n\nThis library currently provides one single, simple to use function (once sync, once async; only truly async on Linux, see below):\n\n```csharp\nusing System.Net.NetworkInformation;\nusing ArpLookup;\n\n// ...\n\nPhysicalAddress mac = Arp.Lookup(IPAddress.Parse(\"1.2.3.4\"));\n\nPhysicalAddress mac = await Arp.LookupAsync(IPAddress.Parse(\"1.2.3.4\"));\n```\n\nTo detect if the current platform is supported, check as follows. Lookups on unsupported platforms throw `PlatformNotSupportedException`s.\n\n```csharp\nvar linuxOrWindows = Arp.IsSupported;\n```\n\n## Further information\n\nOn Windows an API call to IpHlpApi.SendARP is used. Beware that this implementation is not truly async but just returns a finished task containing the result. Consider calling wrapped in `Task.Run` if the sync executing is not acceptable in your use case.\n\nOn Linux the `/proc/net/arp` file, which contains system's the arp cache, is read. If the IP address is found there the corresponding MAC address is returned directly.\nOtherwise, an ICMP ping is sent to the given IP address and the arp cache lookup is repeated afterwards. This implementation uses async file IO and the framework's async ping implementation.\n\nBy default, the library waits for ping responses for up to 750ms on Linux platforms. Technically, the responses are not required, as the arp protocol and the arp cache have nothing to do with the pings. Rather, the pings are an easy way to force the OS to figure out and provide the information we are looking for. I did not do extensive tests how long is reasonable to wait to be quite sure, the arp cache is updated. 750ms should be much more than needed in many cases - it is more of the safe option. Note that if you do recieve a ping response, the wait might be much shorter. The timeout comes into effect if the host is not available or does not respond to the ping. If you want to request many addresses or are facing other time-limiting aspects, you may want to reconfigure this default:\n\n```csharp\nArp.LinuxPingTimeout = TimeSpan.FromMilliseconds(125);\n```\n\n## Local NIC's MAC addresses\n\nPlease note that this library was designed to determine the MAC addresses of remote devices. Under certain circumstances, the Lookup or LookupAsync function may return the MAC addresses of local NICs as well. However, this behavior varys across different platforms. To lookup local MAC addresses, a library like this is not necessary, but existing APIs of .Net can be used:\n\n```csharp\nusing System.Net;\nusing System.Net.NetworkInformation;\n```\n\nList all NICs and their IPv4s and MAC addresses:\n\n```csharp\nforeach (\n    var nic in NetworkInterface\n      .GetAllNetworkInterfaces()\n      .Where(nic =\u003e nic.OperationalStatus == OperationalStatus.Up\n                    \u0026\u0026 nic.NetworkInterfaceType != NetworkInterfaceType.Loopback)\n    )\n{\n    var ips = nic.GetIPProperties().UnicastAddresses\n        .Where(adr =\u003e adr.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)\n        .Select(adr =\u003e adr.Address.ToString());\n    Console.WriteLine($\"{string.Join(\", \", ips)} {nic.GetPhysicalAddress()} {nic.Name}\");\n}\n```\n\nLookup one MAC address by IPv4 address:\n\n```csharp\nvar ip = IPAddress.Parse(\"192.168.1.2\");\n\nvar nic2 = NetworkInterface\n    .GetAllNetworkInterfaces()\n    .Where(nic =\u003e nic.OperationalStatus == OperationalStatus.Up\n                  \u0026\u0026 nic.NetworkInterfaceType != NetworkInterfaceType.Loopback)\n    .Where(nic =\u003e nic.GetIPProperties().UnicastAddresses.Any(adr =\u003e adr.Address.Equals(ip)))\n    .FirstOrDefault();\n\nConsole.WriteLine($\"HWAddr for IP {ip} is {nic2?.GetPhysicalAddress()?.ToString() ?? \"UNKNOWN\"}\");\n```\n\n## Supported platforms\n\n* Windows (tested)\n* Linux\n  * Debian (tested)\n  * Android\n  * **not** WSL 1 (tested)\n  * [WSL 2](https://github.com/Microsoft/WSL/issues/2279)\n\nNote that the used method does not work in WSL 1 and might not work on every Linux distribution. Checking the `Arp.IsSupported` property accounts for this (though it does not check if you are actually allowed to access `/proc/net/arp`). In WSL 2 this library will work as on most \"real\" Linux distributions as [this issue describes](https://github.com/Microsoft/WSL/issues/2279). While I did not test this library on Android/Xamarin I have read in different places that reading `/proc/net/arp` is possible (given the right permissions).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorg-jung%2FArpLookup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeorg-jung%2FArpLookup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorg-jung%2FArpLookup/lists"}