[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Variation in start-up IP address
From: |
Luca Ceresoli |
Subject: |
Re: [lwip-users] Variation in start-up IP address |
Date: |
Thu, 8 Apr 2010 17:31:27 +0200 |
Alex Brophy wrote:
> My application enables DHCP and auto-IP in lwipopts.h. My test
> environment consists of a standalone board connected via ethernet cable
> to a spare ethernet port on a PC. There is no DHCP server involved, so I
> would expect the IP address to always come up as 169.254.254.169. Most
> of the time it does, but occasionally, it comes up as 169.254.254.170 or
> more rarely 169.254.254.171. Why does this happen? Is there a way to
> make the IP address deterministic when DHCP is not available?
By design, AUTOIP-assigned addresses must not be deterministic.
If you're assuming the opposite, you'll have serious troubles as soon as
you'll connect your device to something more than your PC.
From RFC3927:
>1.5. Autoconfiguration Issues
>
> Implementations of IPv4 Link-Local address autoconfiguration MUST
> expect address conflicts, and MUST be prepared to handle them
> gracefully by automatically selecting a new address whenever a
> conflict is detected, as described in Section 2. This requirement to
What you see may happen in the following scenario:
1. The devices acquires IP address X
2. The PC stores address X in the ARP cache
3. The device is rebooted
4. While the device probes for address X, the PC sends an ARP request
for address X (it's legal for the PC to send it at any time)
5. lwIP detects it as a conflict (autoip.c around line 500) and tries
a new address.
Luca