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

DHCP doesn't work


  • Please log in to reply
22 replies to this topic

#1 Lance Fisher

Lance Fisher

    New Member

  • Members
  • Pip
  • 4 posts

Posted 18 December 2010 - 10:01 PM

Hi, I'm just getting started with the Netduino Plus. I can't seem to get an IP address from my local DHCP server (A ZyXEL X-550 router). The router's admin page shows an IP address of 192.168.10.186 assigned to the Netduino's MAC address, but the netduino reports 0.0.0.0 as its IP address as demonstrated by this program: public static void Main() { var networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); Debug.Assert(networkInterfaces[0] != null); var net = networkInterfaces[0]; Debug.Print("DHCP Enabled: " + net.IsDhcpEnabled); Debug.Print("IP Address: " + net.IPAddress); //output: // DHCP Enabled: True // IP Address: 0.0.0.0 } If I use MFDeploy, and set a static IP address, I can send data across the internet. My firmware version is: 4.1.0.5 (as reported in MFDeploy under Target | Device Capabilities, SolutionReleaseInfo.solutionVersion) I've also tried setting a DHCP reservation for the Netduino on the router, but the Netduino still reports 0.0.0.0 as its IP address. Is there a problem with DHCP on the Netduino Plus, or am I missing something? Thanks.

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 December 2010 - 11:02 PM

Hi Lance, DHCP seems to be working well for some users and not for others. It appears to be an issue in the lwIP open source networking stack, perhaps in the area of reservation ID #s... What type of router do you have? If you plug the device directly into your Internet connection, does it get an address then? If we can create some repro cases, we can use WireShark to narrow down the issue and check the bugfix back into Microsoft's core codebase and/or the lwIP project... Chris

#3 Lance Fisher

Lance Fisher

    New Member

  • Members
  • Pip
  • 4 posts

Posted 19 December 2010 - 12:01 AM

Hi Chris,

My Router is a ZyXEL X-550 (an older, but highly-rated home use wired/wi-fi router)

I tried plugging it directly into the cable modem, but that didn't seem to change anything. There could be some other issue there.

It looks like it is in fact working if I set a reservation for the Netduino in the router configuration. (I wasn't saving the setting correctly before.) However, once I remove the reservation, the Netduino goes back to setting the IP address to 0.0.0.0 even though the router says it has assigned an IP address to its MAC address. Also, it seems to default the DNS Address to 208.67.222.222.

I'd be happy to WireShark it, but I don't have hub laying around, and I'm not sure how to physically capture traffic from it otherwise.

Is there a way to have the Netduino Debug.Print() the DHCP network calls? Maybe a little program people could run on the Netduino to help debug this problem would be helpful.

Thanks,
Lance

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 19 December 2010 - 04:07 AM

My Router is a ZyXEL X-550 (an older, but highly-rated home use wired/wi-fi router)


Lance,

I think that Pascal and some other community members identified an issue with lwIP not sending some required data during the DHCP call--which could cause some routers to assign a new address every time. I'm going to see if maybe this is related...

We've done some testing on the issue you raised and have found a D-Link gaming router which exhibits the issue. I'm not sure how many spare engineering cycles we can throw at this before the holiday break, but I'm going to see what we can do...

In the meantime, do you mind setting a DHCP reservation in your router for the Netduino Plus's MAC address...or using a static IP address?

Thanks for providing the additional information on this issue, Lance.

Chris

#5 Lance Fisher

Lance Fisher

    New Member

  • Members
  • Pip
  • 4 posts

Posted 19 December 2010 - 09:03 AM

Thanks, Chris! I'm not in a hurry to have this fixed since I'm just tinkering at home for now. I can use a static IP address no problem. The DHCP reservation has turned out to be spotty.

#6 FelixEmman

FelixEmman

    Member

  • Members
  • PipPip
  • 25 posts

Posted 02 March 2011 - 02:24 AM

I'm having the same issue, DHCP doesn't work. I setup my MAC as it's on the netduino sticker, and checked "DHCP" in MFDeploy-Config-Network. I get a "0.0.0.0" from NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress. However, if I reserve the MAC with a specific IP address in the router, netduino will get that IP address assigned with DHCP... the same behavior Lance reported above BTW, I noticed that after a while (~10 min) it will disappear from the DHCP list of the router. (My router is a Belkin F5D8235-4 v2000, Firmware v2.01.08.) Felix

Edited by FelixEmman, 02 March 2011 - 02:37 AM.


#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 02 March 2011 - 03:02 AM

Hi Felix, Have you upgraded to the v4.1.0.6 (or v4.1.1 alpha 7+) firmware? If so: if you set your IP settings to "0.0.0.0" before selecting the DHCP checkbox, do you get an address then? Chris

#8 FelixEmman

FelixEmman

    Member

  • Members
  • PipPip
  • 25 posts

Posted 02 March 2011 - 04:01 AM

Hi Felix,

Have you upgraded to the v4.1.0.6 (or v4.1.1 alpha 7+) firmware?

If so: if you set your IP settings to "0.0.0.0" before selecting the DHCP checkbox, do you get an address then?

Chris


Hey Chris,

Yes, I upgraded to 4.1.0.6 which you posted today - 3/1.
Hm, I think I had the settings set to something other than 0s. I cleared the StaticIP/Subnet/Gateway/DNS1/DNS2 all to 0s. That will make it work. BUT, after just a few minutes, it is no longer in the DHCP list of the router, and pinging times out. So it drops from the network. Not sure if the router has anything to do with this or not, but I'd expect the lease to be longer, since my router's DHCP lease is set to "forever".

The same happens when I set the IP statically, it works ok for a few minutes, then it vanishes from the network...

#9 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 02 March 2011 - 07:37 AM

Hi Felix, Any chance you can run a few tests? Test 1: check your router and see if the DHCP address is still assigned Test 2: check to make sure that your Netduino Plus is still responding (i.e. try to Ping it from MFDeploy or interact with it from Visual Studio) Test 3: run Wireshark and grab a network sniff trace of traffic from the Netduino Plus--to see what it's up to/what's going wrong. Also, does this happen with no code running...or with a certain project you've developed? Chris

#10 FelixEmman

FelixEmman

    Member

  • Members
  • PipPip
  • 25 posts

Posted 03 March 2011 - 12:24 AM

Chris,
I updated my router's firmware to the latest firmware yesterday (after the first unsuccessful attempts to get the netduino on the network). At that point DHCP started working, but like I said netduino was vanishing a few minutes into the connection. Weird, to say the least!

So today I started looking at wireshark DHCP captures but could not find anything abnormal. However I noticed that if I connected any of my computers with a cable to the router, DHCP would not respond to DHCP discovers, and they could not get on the network! So after a lot of frustration, I decided to revert to the old router firmware.
After the downgrade everything works... netduino is on DHCP, alive and well after long periods. The other computers' DHCP works fine as well. So the new firmware was a fiasco.

Conclusion:
1) DHCP seems to work ok on the netduino now
2) Don't buy Belkin products again

I am curious how the netduino will behave when the DHCP lease expires. Have you run into this situation? Will it try to renew?

#11 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 03 March 2011 - 02:47 AM

Hi Felix, Thank you for the update. Glad that the problem was router-related, but sad that it gave you trouble in the first place! Thanks goodness for Wireshark...awesome program. The Netduino Plus uses the open source lwIP networking stack. We haven't done any specific testing on renewing DHCP addresses after lease expiration, but it should happen automatically. If you run into any troubles, please let us know and we'll go down the diagnostics path on that too... Chris

#12 TankMaster

TankMaster

    New Member

  • Members
  • Pip
  • 9 posts

Posted 02 April 2011 - 01:45 PM

DHCP doesn't work for my either and I have a Dlink DIR-655 router. I have tested the suggestions in this thread but they don't work either :/

#13 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 02 April 2011 - 04:58 PM

DHCP doesn't work for my either and I have a Dlink DIR-655 router.
I have tested the suggestions in this thread but they don't work either :/


Hi TankMaster,

Just to confirm:
1. Did you set your IP address and gateway address to 0.0.0.0 in MFDeploy?
2. Did you check the "DHCP" box in MFDeploy?
3. Are you running v4.1.0.6 or newer firmware?

If yes, then do you have a copy of (the free program) WireShark by any chance? If we could get a quick log of what's going on in your network, we should be able to narrow down the issue and hopefully get it fixed in the v4.1.1 beta firmware...

Chris

#14 adamCoding

adamCoding

    New Member

  • Members
  • Pip
  • 3 posts

Posted 31 July 2011 - 06:01 PM

I had similar networking "issues". My issue was that I was too lazy to set the proper MAC address and decided to just put my own custom MAC. This caused hours of debugging to realize all I needed was to set the proper MAC that was given as a sticker on the back of the netduino plus. DHCP worked and static IP's also worked after that. Problem was with a custom MAC the arp tables might not get properly updated on routers.

#15 WPtE

WPtE

    New Member

  • Members
  • Pip
  • 5 posts

Posted 06 October 2011 - 10:00 PM

I just received my new netduino plus. I'm new to the micro .net framework, but after playing around a bit I noticed it's very much the same as regular .net. I however experience the same issues as described here before. After I've entered the MAC address from the sticker on the back I was able to see it on the network with a static address... however, the netduino does not respond to pings, neither does it respond to the port (80) I've opened. DHCP doesn't work at all. I can see on my router that a lease is given to the mac address of the netduino, but the netduino simply displays 0.0.0.0 My router (asus RT-N16) has the dhcp package called dnsmasq: http://thekelleys.or...nsmasq/doc.html I've tested this with stable firmware 4.1.0.6 as well as the 4.2 RC1 To be honest, I'm a bit disappointed because of this, I expected that this would work better than using arduino + a shield since it's all integrated in 1 board. I've tried several samples from different authors based on netduino plus networking, but none of them seem to work.

#16 WPtE

WPtE

    New Member

  • Members
  • Pip
  • 5 posts

Posted 06 October 2011 - 10:23 PM

Ok, so I've tried this demo: http://forums.netdui...uino-webserver/ aaaaand it works :P I had to try it 3 times before the webserver actually worked, but from the first start DHCP got trough and the netduino responded to ping :D So excuse my ranting ;) Now the netduino plus adventure begins for me! :lol:

#17 Valkyrie-MT

Valkyrie-MT

    Advanced Member

  • Members
  • PipPipPip
  • 315 posts
  • LocationIndiana, USA

Posted 07 October 2011 - 01:03 PM

I think the Netduino Plus usually has not finished negotiating the IP address when it initially boots with DHCP. You have to wait for it... The following code was taken from Microsoft's own samples:

            NetworkInterface ni;

            // Wait for DHCP (on LWIP devices)
            while (true)
            {
                ni = NetworkInterface.GetAllNetworkInterfaces()[0];

                if (ni.IPAddress != "0.0.0.0") break;

                Debug.Print("Waiting for an IP Address...");
  
                Thread.Sleep(1000);
            }

See thread here for a similar discussion.

Note: a web server CAN be made to work on the Netduino Plus. I have one running continuously now for over 3 months without reboot or failure of any kind...

-Valkyrie-MT

#18 WPtE

WPtE

    New Member

  • Members
  • Pip
  • 5 posts

Posted 07 October 2011 - 07:58 PM

I think the Netduino Plus usually has not finished negotiating the IP address when it initially boots with DHCP. You have to wait for it...


Thanks for that Valkyrie-MT!
I've actually waited some time for the dhcp to work with thread.sleep but nothing happened.
On the other hand, the web-server demo I used didn't do this:
NI.EnableDhcp();
NI.ReleaseDhcpLease();
NI.RenewDhcpLease();
to setup dhcp... I did used that, maybe that's why it failed? :unsure:

I have several years of experience with C#, C++ and C but I'm still finding out how this micro.net stuff works :P
I'm already in the mood to write a bunch of basic libraries to get several things started in a reliable way tho. I've done that with every language however :D

#19 gaibwm

gaibwm

    New Member

  • Members
  • Pip
  • 4 posts

Posted 24 October 2011 - 06:23 PM

Try to shut off CDP and POE on the port Netduino connect to. I had similar problem. After talking to my Network Engineer and he shut off CDP and POE then the Cisco switch starts releasing IP to Netduino +

#20 thenecroscope

thenecroscope

    Member

  • Members
  • PipPip
  • 13 posts

Posted 25 November 2011 - 12:21 AM

I have the exact same issue :( using v4.2 firmware. I've set the mac address manually, set IP to 0.0.0.0 and the gateway but no joy. If I set a static ip everything works fine. I have a Virgin (UK) media router preconfigured via virgin model number: vmdg280 This is the code i tried to use, taken from another site / forum (im very much still learning) using System; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; using Microsoft.SPOT.Net.NetworkInformation; namespace IP_Discovery { public class Program { public static void Main() { // Fetches the first network interface NetworkInterface NI = NetworkInterface.GetAllNetworkInterfaces()[0]; // DHCP NI.EnableDhcp(); //NI.ReleaseDhcpLease(); NI.RenewDhcpLease(); NetworkInterface ni; // Wait for DHCP (on LWIP devices) while (true) { ni = NetworkInterface.GetAllNetworkInterfaces()[0]; if (ni.IPAddress != "0.0.0.0") break; Debug.Print("Waiting for an IP Address..."); Thread.Sleep(5000); } Debug.Print(NI.IPAddress.ToString()); // Static NI.EnableStaticIP("192.168.0.75", "255.255.255.0", "192.168.0.1"); Debug.Print(NI.IPAddress.ToString()); } } } Whats the code for this in VB out of interest? thanks :D




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.