[En-Nut-Discussion] NutNetIfConfig

Harald Kipp harald.kipp at egnite.de
Mon Sep 27 18:28:57 CEST 2004


>
> > first, it is not possible to change the IP address while
> > socket connections are established. This isn't Ethernut
> > specific. On PCs the interface must be switched down and
> > up again with the new IP.
>
>does that mean I can use nutnetifconfig to that the new ip and than
>afterwards reboot with the new ip or does it mean I only can that the Ip
>once?

     NutNetLoadConfig("eth0"); /* If not already loaded. */
     confnet.cdn_cip_addr = inet_addr(my_ip);
     NutNetSaveConfig();

Will store a fixed IP address in EEPROM. If cdn_cip_addr is
zero, DHCP will be used.



> > However, Nut/OS doesn't provide an interface shutdown, so
> > a reboot is required. The problems regarding DHCP are
> > described partly in
> > http://www.ethernut.de/pdf/enswm20e.pdf
> > Page 33 ff.
>
>Is there a way to change the IP over the Ethernet-Inteface or do I have to 
>reflush the device? Are reboot won't matter.

In one case I'm using an "Ethernut Discoverer". It's a tiny
Win32 application sending out an UDP broadcast to a specific
port. Ethernut listens on this port and responds with its
configuration settings. The Win32 user can edit these and
send them back to Ethernut, again to the Ethernut UDP server.
Ethernut writes the new values to its EEPROM and reboots.

I'd publish this tool, but it's full of specialities for
the custom application and difficult to seperate.

The advantage is, that the broadcast will be received
regardless of the current Ethernut IP. Note, that only
UDP can broadcast, TCP can't.

If Ethernut's IP is known and reachable in the current
network, you can of course set the IP address via telnet
or HTTP too. Use the NutNetSaveConfig() to store it in
EEPROM and reboot using the ATmega128 watchdog.

Harald




More information about the En-Nut-Discussion mailing list