DHCP not working?

I am having trouble getting an ip address on my netduino plus 2.
Blinky works great, so I am connectd.
The ethernet cable connected to my router has proven itself on another computer.

I am using Netmf 4.3.1, visual studio 13.
Thanks for any help.
Terrence

Here is the code.


public static void Main()
{
byte[] MAC = { 0x5C, 0x86, 0x4A, 0x00, 0xF2, 0x15 };
NetworkInterface nic = NetworkInterface.GetAllNetworkInterfaces()[0];
nic.EnableDhcp();
nic.PhysicalAddress = MAC;
Debug.Print(Network.GetNicStatus(nic));
int i = 0;
while (true)
{
	nic = NetworkInterface.GetAllNetworkInterfaces()[0];
	if (nic.IPAddress != "0.0.0.0")
		break;

	Debug.Print("Waiting for an IP Address..." + i++.ToString());
	Thread.Sleep(2000);
	Debug.Print(Network.GetNicStatus(nic));
}
}

–can’t seem to find the help section on how to post code in the forums?–

Netduino Plus?

Try forum on netduino.com. You might get more help there.

Well I posted it over there 24 hours ago and it hasn’t been approved. So I thought you guys could help.

it might help to assign a Mac address before enabling dhcp

1 Like

to post code, use the square bracket CODE tags. You can hit the “101010” button above the text entry box to get a set inserted at the bottom of your reply

1 Like

Bret, thanks for the formatting tip.

1 Like

@ Mike, you are brilliant! That worked.

Thanks for that tip.

Terrence

1 Like