This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DHCP failure discovery - mcb2300

I wonder if there is any way to get information about failed dhcp process?
I need to start dhcp, and if it's not succeeded, disable dhcp and use a default local ip (case of a direct connect to a pc).
I understand, that i can monitor local ip, but is there a better way?
Also when dhcp is not succesful, the mcb2300_debug complains that retransmit timeout is too big.

Thanks,
Gennady

Parents
  • DHCP client tries to obtain a valid IP. It uses exponential backoff retransmission on timeout. After 30 seconds, DHCP client is restarted. This process repeats indefinetly or until a valid IP is obtained.
    There is no such function to check if a DHCP has failed.

    You can monitor the IP address as you have figured out. However I see no reason for doing this. For example a PC can be configured either to use a DHCP or a static IP, but not both at the same time.

Reply
  • DHCP client tries to obtain a valid IP. It uses exponential backoff retransmission on timeout. After 30 seconds, DHCP client is restarted. This process repeats indefinetly or until a valid IP is obtained.
    There is no such function to check if a DHCP has failed.

    You can monitor the IP address as you have figured out. However I see no reason for doing this. For example a PC can be configured either to use a DHCP or a static IP, but not both at the same time.

Children
  • After 30 seconds, DHCP client is restarted.

    Maybe you can check this restart somehow and allow the DHCP client to try for only x*30 seconds? After that you could disable the DHCP client and set your own fixed IP.
    I don't know this specific client so I don't really know what I'm talking about anyway :-)

    I don't suppose you have the source code of the client?

    Regards,
    Joost Leeuwesteijn

  • Actually I have a similar requirement to "fall back" to a fixed IP address if DCHP negotiation fails. This is the scenario:

    1. The device can be connected to a network with a dhcp server. It is expected to negotiate an address with no user intervention.

    or...

    2. The device is connected to a PC using an ethernet crossover cable. The PC has been configured with a static IP address. It expects to find the device at a well known IP address (say, 192.168.0.1). This is similar to the configuration scheme for many dsl routers.

    Dave

  • According to the RFC2131, there are should be 4 attempts to retransmit DHCP_DISCOVER with delays 4,8,16,32 seconds.
    According what I see in a debug mode, TCPnet uses 2 attempts (4 and 8 seconds).
    On the next delay double (16 seconds), TCPnet considers delay too big (that is where the error message comes from), reverts to the INIT state and starts the DHCP process over.

    In my situation the device has no means to be configured for the use of static IP or DHCP. If it's connected to the network with DHCP server, it should use DHCP, if it's connected directly to the pc, it should use a static IP.

    So according to the retransmittion algorithm used by TCPnet, when would it be a good time to check for the DHCP success ?
    Also, can DHCP be disabled at any time (at any stage of a DHCP process) or will be safer to shut it up at a certain stage?
    Is there any way to check the current DHCP state? (since the TCPnet sends messages to the serial port, it may be possible?)

    Or probably in my situation the easiest way will be to install the DHCP server on a PC for a direct connection (this is a tech's laptop) and forget about static IP alltogether ?

  • There is no option to enable both DHCP and static IP in commercial products like: small routers, print servers, ADSL modems, IP telephones etc. You can select either DHCP or static IP, but not both at the same time.

    As far as I understand your problem, you would like to present ethernet examples for MCB2300 in two configurations: one for LAN with DHCP, and the other for direct connection to PC with static IP.

    My suggestin would be to create 2 targets in uVision project, one for DHCP and the other for static IP. Then you can simply flash MCB2300 with a correct firmware. We have also a redesigned HTTP_demo example with changes just described above which is not a part of standard RL-ARM distribution. If you need it please let me know and I will send it to you.

    Franc