1

I need to make in .NET c# a functionality which is an implementation of IPv4LL as defined in RFC3927, a technology for assigning link-local IP addresses without DHCP server. The same functionality has been available on Windows under the name APIPA. On linux there's such plugin :avahi , avahi-autoipd. But on windows haven't found yet sth similar.

Till now I have only one solution: to send ARP packets on network with link-local IP address within a range, and test them if are free, once I find one free it is assigned as current IP address.

Any suggestion regarding my problem would be much appreciated.

vlad
  • 11
  • 2
  • In Windows, in the Network Adapter Settings, Properties, find the IPv4 item and click Properties. It should be selected for using DHCP. Selec the "Alternate" tab, ensure it is selected for "Automatic Private IP address". APIPA is what Windows calls RFC3972 address assignment. – Jesse Chisholm Feb 12 '15 at 23:41
  • @JesseChisholm just a small correction for all future readers, the RFC in question is RCF3927, as in OP's post, not 3972. :) – That Marc May 27 '20 at 19:48
  • @ThatMarc - I hate when my fingers succumb to lysdexia. https://tools.ietf.org/html/rfc3927 is the link. – Jesse Chisholm May 30 '20 at 04:20

2 Answers2

1

If I were you I would investigate Avahi a little closer, mainly because you can view the source code if you want, but also to see how it works with Mono.

Having said that, I suspect that you need a service quite separate from your application(s) and therefore there is no need to limit yourself to .Net as a technology.

Is that helpful at all ?

Hugh Jones
  • 2,706
  • 19
  • 30
0

According to the RFC that defines IPv4 link-local addressing, http://www.ietf.org/rfc/rfc3927.txt you really do need to send ARP to verify that your randomly selected 169.254.XXX.YYY address is not in use already.

To use ARP in C#, check out the IPHLPAPI.DLL, and call it via P/Invoke. http://www.pinvoke.net/default.aspx/iphlpapi.SendARP

Jesse Chisholm
  • 3,857
  • 1
  • 35
  • 29