Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

DHCP support in LWIP

Hi All

I am trying to use the DHCP client in the lwip package. I've created a new web server project for the EP1C20 evaluation board and I see that there are dhcp.c and dhcp.h files in there, but no one seems to use them, so I don't think that the dhcp client is actually doing what it's supposed to do.

My question is: is there any file or example showing how this client should be activated ?

7 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The factory config for Nios II (respective board) should show it in use.

    It goes out and gets your IP address from a DHCP server.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello Kerri

    When you say: factory config, do you mean the "safe" configuration, because when I try to create a new web server project it uses a fixed ip address for all I can see and does not turn to the DHCP server. If you, can, please point me to a piece of code that does that.

    Nir
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Nios I use the safe config. Nio II uses 'factory_recovery' files.

    Are you on Nios I or II?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by nir@Sep 14 2004, 09:22 PM

    hi all

    i am trying to use the dhcp client in the lwip package. i've created a new web server project for the ep1c20 evaluation board and i see that there are dhcp.c and dhcp.h files in there, but no one seems to use them, so i don't think that the dhcp client is actually doing what it's supposed to do.

    my question is: is there any file or example showing how this client should be activated ?

    --- Quote End ---

    nir,

    If you're using LWIP with MicroC OS II then this is simple. If you look Chapter 9 of the Nios II Software Developers Handbook it explains that you need to implement a function as part of your application called get_ip_addr. This is where you decide what IP address to use, or whether to use DHCP. If you look at one of the networking example designs you will also see that there are example implementations of these functions.

    Hope that helps,
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    What about using DHCP without the MicroC/OS.

    Is this possible? And if so, are there any examples of it out there?

    I use DHCP with MicroC/OS before and it works fine, but now I downloaded the stand-alone version of Lwip and I can&#39;t get DHCP to work... http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif

    Has anyone used DHCP with Lwip and without MicroC/OS?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I never use DHCP because it never works.

    When I used the safe design of Nios I, the time-consuming DHCP trial never succeeded, maybe its my LAN&#39;s fault; so I turned DHCP off.

    In Nios II, I dont use it too, because it still wont work.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The Nios1 and NiosII TCP/IP stacks are completely different. If DHCP is not working for you, I think it&#39;s almost certainly a configuration problem on your network. Do you PCs use DHCP?