W5100 Shield - LTE Router (with sim card) unrealiable connection

Good afternoon to everybody!

I'm experiencing a few issues while trying to connect an Arduino Mega with an Ethernet shield to the internet via an LTE router.
The Arduino is configured to use a DHCP address provided by the router.

If I power up both the Arduino (Mega2560, in this specific case) and the router, my microcontroller cannot successfully connect, and therefore post http requests.
If, however, I start the router first, wait for it to fully connect, and then power my microcontroller on, then the connection is established perfectly and there are no problems.

By checking on my code and with serial port debug, I found out that the DHCP address given to my Mega is not in the range specified by the router's setup page (192.168.1.(100 through 150) is what I should get, but I keep getting numbers in the range of 230 and above).

Is there a way I could be sure to receive a valid IP address before going on and trying to connect? The Ethernet.begin() returns a positive result, since it is in a "while" loop to keep the Arduino from going on with the code.

Thanks in advance!!


Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.

Posting tips.

  • Your OS and version can be valuable information, please include it along with extra security you are using.
  • Always list the version of the IDE you are using and the board version if applicable.
  • How to insert an image into your post. ( Thanks Robin2 )
  • Add your sketch where applicable but please use CODE TAGS ( </> )
  • Add a SCHEMATIC were needed even if it is hand drawn
  • Add working links to any specific hardware as needed (NOT links to similar items)
  • Remember that the people trying to help cannot see your problem so give as much information as you can

"The Arduino is configured to use a DHCP address provided by the router."

Well, then you are telling the router to give the board what ever IP address thet is not currently used on the router. Generally if you card code an IP address in your code, the router should accept that if it is not already being used.