0

I have a testing scenario where our device will be plugged into network without having a static IP and no DHCP server in the network.

The aim is to create the scenario for the device to auto config itself to a random Local Link Address - 169.254.x.x

But the RFC says that "if in case DHCP is enabled in your device and there is no DHCP server and no static IP available - the device should opt for Link Local address"

I know how to enable DHCP in my device - but how can one assure that there is no DHCP server in network running?

  • I know how to enable DHCP in my device - but how can one assure that there is no DHCP server in network running? - Plug your DHCP enabled device into the network and see if it acquires a non-Link Local address. – joeqwerty Jun 19 '18 at 13:20
  • Simply get a (cheap) desktop switch and plug in your device there if your normal network does have a DHCP server – HBruijn Jun 19 '18 at 13:22
  • Sorry I need to catch the event to write up a test case - I mean is there a timer or a trigger point that when there is no response from a DHCP server now take auto IP configuration Link Local address – Programmer Jun 19 '18 at 13:25
  • So is your question really meant as "How long should a program wait for a DHCP response before failing back to a link local address?". Is that correct? – Cory Knutson Jun 19 '18 at 13:56
  • Well yes - actually I am not sure if the program has to wait for a response / timeout from DHCP server or how many messages it should send and then timeout - but yes the event / state to capture is when no DHCP server is available in network (i.e. no response) which perhaps in other words would mean "How long should a program wait for a DHCP response before failing back to a link local address?". – Programmer Jun 19 '18 at 15:21
0

I really have no best practice at hand, but I know that clients usually take multiple approaches to reach out for a DHCP Server via a DHCP-Discover Packet. Maybe you want to perform a packet capture with wireshark (other products are available) in order to determine the amount of approaches taken / the time elapsed.

Are you trying to write your own DHCP client? Because other ways you could periodically fetch for the IP address assigned to the interface in question. If the client is being told to perform DHCP it usually has no IP address assigned until either one of two events take place

  1. There is a DHCP Server and it successfully assigned you with an IP address
  2. Your client is unable to obtain an IP address by a DHCP server and thus assigns itself a link-local IP address

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.