[En-Nut-Discussion] DCHP timeout/set IP address by ARP/PING command

Michel Hendriks michel at stream-it.nl
Thu Nov 17 15:20:39 CET 2005


Hi Christian,

> I'd like to configure my ethernut application by DHCP server 
> like it is done in many of the example applications. I did 
> this with NutDhcpIfConfig("eth0", 0, 10000), because I 
> thought 10 seconds should be enough for the simple process of 
> obtaining an IP address.
> This always worked in our company network (Linux server). But 
> now I tested a configuration with a Netgear WLAN router and 
> the 10 seconds seem to be to short!
> Dedicated Windows DHCP server applications sometimes run into 
> trouble, too. Is this behaviour normal or have I done 
> something wrong? I saw that the timeout value in the Ethernut 
> examples is 60 seconds - one minute seems to be quite long, though!

We've been using 20 seconds for a long, long time now in all sorts of
environments and it seems to be long enough.
 
> Another question: In the hardware manual of my ethernut board 
> is explained how the board can be configured without a DHCP 
> server and without a saved IP configuration in the EEPROM. It 
> is basically a manual ARP entry (with known MAC address and 
> desired IP address) followed by a PING request to that 
> desired IP address. Is this method outdated or should it still work? 
> I remember that old ethernut applications used 
> NutNetAutoConfig(). Did that function refer to the ARP/PING method?

Set the confnet members to the values you need and use them as follows if
you want to use static IP:
        if (NutNetIfConfig(szIfName, confnet.cdn_mac, confnet.cdn_cip_addr,
confnet.cdn_ip_mask) == 0)
        {
            NUTDEVICE *dev;
            if ((dev = NutDeviceLookup(szIfName)) != 0 && dev->dev_type ==
IFTYP_NET)
            {
                NutIpRouteAdd(0, 0, confnet.cdn_gateway, dev);
            }
        }

 
> Regards,
> 
> Christian

Greetings,
Michel




More information about the En-Nut-Discussion mailing list