# Continue again DHCP after DHCP failure instead of giving up or using AUTO IP(LinkLayer IP-address)

**URL:** <https://forums.freertos.org/t/continue-again-dhcp-after-dhcp-failure-instead-of-giving-up-or-using-auto-ip-linklayer-ip-address/22954>\
**Category:** Libraries\
**Created:** [April 21, 2025, 3:41am UTC](https://forums.freertos.org/t/continue-again-dhcp-after-dhcp-failure-instead-of-giving-up-or-using-auto-ip-linklayer-ip-address/22954 "2025-04-21T03:41:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hane\_vv](https://avatars.discourse-cdn.com/v4/letter/h/e8c25b/32.png) [@hane\_vv](https://forums.freertos.org/u/hane_vv)\
**Post date:** [April 21, 2025, 3:41am UTC](https://forums.freertos.org/t/continue-again-dhcp-after-dhcp-failure-instead-of-giving-up-or-using-auto-ip-linklayer-ip-address/22954/1 "2025-04-21T03:41:52Z")

</div>

Continue again DHCP after DHCP failure instead of giving up or using AUTO IP(LinkLayer IP-address)。  
What do I need to do without changing the FreeRTOS\_TCPIP protocol stack code。  
If the current protocol stack DHCP fails, it will give up or use AUTO IP。

 ![image](https://d2v6vdsk2p900z.cloudfront.net/original/2X/3/35b9f75f164c4e97defc978d7997b9cad0c16b6e.png)

---

<div class="post-metadata">

**Author:** ![tony-josi-aws](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tony-josi-aws](https://forums.freertos.org/u/tony-josi-aws)\
**Post date:** [April 21, 2025, 6:16am UTC](https://forums.freertos.org/t/continue-again-dhcp-after-dhcp-failure-instead-of-giving-up-or-using-auto-ip-linklayer-ip-address/22954/2 "2025-04-21T06:16:38Z")

</div>

@hane_vv

You can try by increasing the [`ipconfigMAXIMUM_DISCOVER_TX_PERIOD`](https://www.freertos.org/Documentation/03-Libraries/02-FreeRTOS-plus/02-FreeRTOS-plus-TCP/06-Configuration#ipconfigmaximum_discover_tx_period), this is the maximum time the DHCP state machine waits till it gets a response for the DISCOVER message. Note that the duration at which the DISCOVER message sent is doubled after every attemtpt here until it reaches `ipconfigMAXIMUM_DISCOVER_TX_PERIOD`:

```auto
            /* It is time to send another Discover. Increase the time
             * period, and if it has not got to the point of giving up - send
             * another discovery. */
            EP_DHCPData.xDHCPTxPeriod <<= 1;

```

---

<div class="post-metadata">

**Author:** ![hane\_vv](https://avatars.discourse-cdn.com/v4/letter/h/e8c25b/32.png) [@hane\_vv](https://forums.freertos.org/u/hane_vv)\
**Post date:** [April 21, 2025, 7:29am UTC](https://forums.freertos.org/t/continue-again-dhcp-after-dhcp-failure-instead-of-giving-up-or-using-auto-ip-linklayer-ip-address/22954/3 "2025-04-21T07:29:02Z")

</div>

I know ipconfigMAXIMUM\_DISCOVER\_TX\_PERIOD can be increased, but the DHCP cycle will become too large, so I want to restart DHCP directly.How should I restart DHCP

---

<div class="post-metadata">

**Author:** ![tony-josi-aws](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tony-josi-aws](https://forums.freertos.org/u/tony-josi-aws)\
**Post date:** [April 21, 2025, 7:59am UTC](https://forums.freertos.org/t/continue-again-dhcp-after-dhcp-failure-instead-of-giving-up-or-using-auto-ip-linklayer-ip-address/22954/4 "2025-04-21T07:59:53Z")

</div>

> [@hane\_vv](#):
>
> DHCP cycle will become too large, so I want to restart DHCP directly

In that case `FreeRTOS_NetworkDown()` might be what you are looking for. It will restart the TCP/IP stack along the DHCP, you can manually call this if the endpoint/network is not up yet with a valid DHCP based IP.

Another option is to add more user control over how the `EP_DHCPData.xDHCPTxPeriod` (maybe with a new macro) is updated while retrying, if you prefer that, please feel free to raise a github PR with changes.

---

<div class="post-metadata">

**Author:** ![hane\_vv](https://avatars.discourse-cdn.com/v4/letter/h/e8c25b/32.png) [@hane\_vv](https://forums.freertos.org/u/hane_vv)\
**Post date:** [April 21, 2025, 12:51pm UTC](https://forums.freertos.org/t/continue-again-dhcp-after-dhcp-failure-instead-of-giving-up-or-using-auto-ip-linklayer-ip-address/22954/5 "2025-04-21T12:51:38Z")

</div>

Can I just modify here? Re DHCP after DHCP failure, rather than giving up or AUTO IP。

 ![1745239703012](https://d2v6vdsk2p900z.cloudfront.net/original/2X/d/d26adccb112148d21fa97ee844410652d6e6662a.png)
