Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Setting DHCP client ID on Netduino Plus 2


  • Please log in to reply
4 replies to this topic

#1 kamaljain

kamaljain

    New Member

  • Members
  • Pip
  • 4 posts

Posted 03 August 2014 - 02:35 PM

Hi Folks,

 

My name is Kamal, and I am new to Netduino.  So far I'm having fun learning.  I got a Netduino Plus 2 for a skunkworks project at my day job and I'm trying to figure something out which I'll explain below.  The project will involve porting or adapting a full .Net 4.5 application that runs on an expensive rack-mounted x86 server, so the Netduino Plus 2, bringing total cost down by more than an order of magnitude, and improving reliability and performance.

 

So, the question/problem: I am using these lines to enable DHCP and Dynamic DNS server assignment, and to verify the IP address:

var interf = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0];

interf.EnableDynamicDns();
interf.EnableDhcp();

Debug.Print("Netduino is on " + interf.IPAddress + " /// DHCP: " + interf.IsDhcpEnabled);
Yes, I lifted it from some forum post I found - perhaps even from this forum!  It works great - the Netduino can succesfully use the SocketClient example to fetch a web page.  But when I look at my DHCP server, the client name is "unknown" which I believe is because there is no DHCID (DHCP Client ID) being passed.  I haven't Wiresharked it yet, but that's what my instinct tells me.
 
I've spent hours Googling and reading and haven't found a way to set this.  MFDeploy doesn't give me a way that I can see.
 
Does anyone have experience with this and perhaps...a solution or pointer for me?
 
Thanks in advance,
Kamal


#2 jrlyman3

jrlyman3

    Advanced Member

  • Members
  • PipPipPip
  • 67 posts
  • LocationNorth St Paul. MN

Posted 04 August 2014 - 02:15 AM

I believe the the Client ID (DUID) is an option and not part of the main DHCP header.  My guess is that you're right and it's not being send by the .NETMF client.  I couldn't find any documentation that says whether it is supported or not.  Let us know what you find out with WireShark.

 

John



#3 kamaljain

kamaljain

    New Member

  • Members
  • Pip
  • 4 posts

Posted 04 August 2014 - 12:55 PM

I'll take the Netduino to work today and hope I can have time to check it with Wireshark or tcpdump.  Or I can even look at the DHCP server log at work to see what options are being sent.

 

- K



#4 kamaljain

kamaljain

    New Member

  • Members
  • Pip
  • 4 posts

Posted 04 August 2014 - 05:55 PM

The Netduino isn't sending DHCP Option 12 - Host Name. The Client ID (my mistake previously) is the MAC address and that's cool.  Not sending 12...isn't.  See attached image of annotated Wireshark screen.

 

Anyone know how to set the host name and if that will get the DHCP client to send it in option 12?

 

Kamal

 

 

Attached File  netmf-dhcp-client.png   94.29KB   1 downloads



#5 kamaljain

kamaljain

    New Member

  • Members
  • Pip
  • 4 posts

Posted 06 August 2014 - 12:23 PM

From the Netduino site, the source code I found for NP2 is 4.3 and I assume the closest match for the NP+2 I have - is that a reasonable assumption, or has 4.3 been changed significantly in the area of Ethernet and IP support?  My NP+2 came with 4.2.2.2 (if memory serves).

 

Searching through the 4.3 sources, I see code to setup DHCP including sending the DHCP_OPTION_HOSTNAME it seems only if the hostname is defined.  I've been wondering about that all along, and still cannot figure out how to tell the NP+2 what its hostname is.

 

 
From .\netduinofirmware_source_4.3.1.0\MicroFrameworkPK_v4_3\DeviceCode\pal\lwip\lwip_1_3_2\src\core\dhcp.c

#if LWIP_NETIF_HOSTNAME
    p = (const char*)netif->hostname;
    if (p != NULL) {
      dhcp_option(dhcp, DHCP_OPTION_HOSTNAME, strlen(p));
      while (*p) {
        dhcp_option_byte(dhcp, *p++);
      }
    }
#endif /* LWIP_NETIF_HOSTNAME */
 
Can anyone provide any pointers or help?





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.