MBED refuses to DHCP with my router

22 May 2011

Hi,

Maybe someone can give me a hint on what is going on:

My mbed is not able to get an IP via DHCP from my router. I tried several Lan ports unsuccessfully, but with the same cable and port I can get the DHCP working with my laptops, but mbed returns 0.0.0.0 .

If I assign the mbed's mac address to an static IP in the router, then mbed connects to the router with that fixed IP and I can use it.

As many code examples are using DHCP to get an IP, I would like to be able to use DHCP.

Has someone experienced the same and found a solution?

Thanks,

Jose-Maria

23 May 2011

Hello Jose-Maria,

Perhaps you can try to configure your Internet Connection Sharing on your PC.

Hope it help you.

Bst Rgrds, Wen

23 May 2011

Do you get any debug spew out the serial port when the DHCP attempt fails? Is there anything helpful in that text? Some routers have logs of their own that you can access from their web based UI. Does yours have this feature and if so, does it log anything interesting when the DHCP attempt fails?

23 May 2011

Hello,

Thanks Wen and Adam for your inputs.

At the end, what I want to do is to access MBED from the Internet. The first step is to get an IP. With the fixed IP I can access MBED from within my home network (activate LEDs, do some beeps,..), but still I am unable to see Mbed from outside the router. I have used IP webcams and I know the NAT tricks to do to see them from the internet but with MBED I am still unable.

Regarding router logs, this router has no serial port but has the log capture option. Nothing appears in the logs when trying to use the DHCP . Neither error messages appear if I do a telnet .... so I am doomed.

I got the same problem when using webservers based in C++ as well as in Jumentum SOC basic, so I suposse this has to do with my stupid router. I will try for some more days and if I have no success, I will surrender. At least I am having some fun and learning about Get and Post stuff. I can not change the router because it is a special type for ADSL TV service.

Regards, Jose-Maria

24 May 2011

you have to forward the port used by the mbed to its IP.

If you are running http server on your mbed and using the default port 80, just forward port 80 on your router to the IP address of your mbed

It should look something like this on your router configuration page

https://lh4.googleusercontent.com/_kbdk_95fcC8/Tdtt2Q-La1I/AAAAAAAADcs/lV90B51-kmI/s640/port_forward.png

24 May 2011

Hello Herson,

Your router seems to be smarter than mine... At least you can declare the type of device (Web Server) that will be available on port 80.

I already assigned port 80 to the Mbed static IP but then I get the Router configuration page. I changed to port 99 and then I don't get to the router but also don't get answer from MBED. From the internal network I have access to Mbed in the port assigned (99 in my example), butI am not able to cross the router .

I'm missing something: no DHCP and no access from outside the router, but with this router I was using an IP webcam and accessing it from Internet assigning a port to the camera IP, so it should be possible. Also the router DHCP is working as all my home lan and wifi devices get the proper IP address, except mbed. Maybe mbed does not wait enough to get the IP or there is some glitch in the code....

I will borrow the router from a friend and I will check if I am able to overcome these problems with a different router.

Thanks for your input.

Jose-maria

24 May 2011

At what port does your mbed is listening?

You can actually tranlate port on a router

For example, you might type in http://home:9090 from the outside and have it forwarded to your mbed ip at a different port

So any request at http://home:9090 may be forwarded to you mbed IP at port 99. Take note of the inbound port (external port) and private port (port where mbed is listening)

24 May 2011

Your getting the router page because its probably listening to port 80. Just use a different listening port for mbed (like 99) and forward any incoming port 99 to your mbed ip.

Then to access it from the outside

Http: yourhomeip:99

24 May 2011

Jose,

You should check what ports your ISP is blocking. You can use this freeware: http://www.portdetective.com/

Run the above program on a computer with an internal IP address that you have set your router to port forward the port you wish to test/use. It will tell you if your ISP is blocking you. You can then use it (hopefully) to find an unblocked port to use. Make sure you are specifying TCP ports, they are not the same ports as UDP ports.

This will tell you if your problem is with your ISP blocking ports, your router or your mbed TCP/IP configuration. Once, you know you can reach that IP address/Port combination from the Internet, then test with the mbed.

You do not want to use DHCP if you wish to allow access from the Internet through a router. You need a static IP address on your router so you can configure that address to receive the external port traffic intended for it. If you use DHCP, the IP address of your mbed will occasionally change and the router's port forwarding will stop working.

The reason your webcam worked, but your mbed didn't is because the webcam probably uses UPnP. This protocol facilitates cooperative access through a NAT router.

Harry

25 May 2011

Hello Harry,

Following your recommendation, I used the portdetective as well as this web page http://canyouseeme.org/, that also check the ports.

With Canyouseeme, what I can know is if the request has been refused or there is a timeout because no one answers in this port.

I have been moving the router configuration port in different ones and I can confirm that the check works, as I get the OK from the port where I set the router configuration.

When I try to ports 80 (assigned to mbed) or 21 or 23, it pings ok but I get a timeout, while if I check other radom ports (81,22,40,etc) they also answer to the ping but I get the message that my request has been rejected, so it seems to me that the 80,21,23 ports are open but what portdetective or canyouseeme say is that no one is answering to these ports.

I set mbed in the startup condition as well as using some of the webserver demo programs, but unsuccessfuly. All is fine from the local network but no access from outside.

Regarding the UPnP effect, probably you are right and this makes the difference.

Well, I think I have spend enough time with this fight with the router... I have been defeated!.

Thanks for your help, Jose-Maria

25 May 2011

Jose,

Ping is an ICMP function that is not related to port number. In other words, you ping an entire IP address, not a specific port on it. When there is a response to a ping, it is coming from some stack that has implemented ICMP, possibly the stack running inside the router.

One problem you may be having is duplex mismatch. If you attempt to ping a stack (or connect to a listen port) and the stack shows it received the request, but the originator times out. You almost always have a duplex mismatch. You may want to try setting your TCP/IP port speed and duplex manually. Try full duplex and then half duplex. Autonegotiation is fickle. Note that some routers act as hubs and some as switches and this makes all the difference.

Also, I suspect that your router is responding to your external pings and giving you a false impression. If your router allows it, turn this feature off.

I wouldn't use canyouseeme.org for the type of tests that you are doing because it runs in a web browser and there are any number of points that will block an unsolicited inbound connection request to it. With portdetective you download a program that will authorize itself to the Windows firewall (you should check that). Another tool you may want to try is tracert, which is an intrinsic command on most TCP/IP stacks. It will show you how far your ping is getting. Run it from a PC on the external Internet, not locally. Your tracert should show your internal IP address. Also, try Herson's suggestion and use an external web browser to test the ability to connect.

One other thing to try, if your router supports it: set the internal address of the mbed (or a computer running portdetective) as the DMZ address on the router. The DMZ port is a "sink" or primary IP address that receives all external traffic the router cannot definitively assign to any other port.

I urge you not to give up. Success would be getting it to work or knowing definitively why it doesn't. You are not wasting your time, you are learning.

Harry

01 Oct 2018

Yes, i agreed with your points i am also facing this same issue as MBED refuses to DHCP with Netgear Router. I had checked all my setting & configuration of my device but still problem arise. Can you provide best solution to get resolve it. Get more information about Netgear Router by following this link: https://www.netgearroutersupportnumber.com/

06 Aug 2019

Detailed surveys and analysis of MagicJack Support Number confirm that magicJack is a highly beneficial boon to the loquacious people Magicjack support number

09 Oct 2019

Never hesitate to call us for outstanding SilverSingles Customer Service. We have full capabilities to resolve all kinds of common or rare dating issues. SilverSingles Support Number

07 Nov 2019

I was facing the same issue as MBED refuses to DHCP with Netgear Router. Can you please troubleshoot the issue & help me out from this. For more information about Netgear Router by following this link: https://routererrorcode.com/

19 Nov 2019

Thank you ever so for you blog.Really looking forward to read more. Really Cool. match support number

26 Nov 2019

I like the helpful info you provide in your articles. I’ll bookmark your blog and check again here regularly.... Pof customer support

08 Dec 2019

I'm a newcomer. I'm here to learn from you.