0

I have been trying to set a static IP address through a router to an Arduino that uses DCHP connection, the thing is that I have tried this in multiple routers but it keeps changing the IP address everywhere, so I don't know if the problem is the Arduino or how I configure the router. Is it possible to control a device (In this case Arduino) that connects with DHCP, only with router settings? And if it is, what's the right procedure?

1 Answer 1

2

Contrary to @TomEus answer - yes, this is entirely possible. It is called "dynamically assigning a static IP". The exact mechanism you use to do this will depend on the router, but most decent newer routers support it. (It's not possible to advise the exact steps for an unknown router though.)

At its simplest form, if your router is using ISC DHCP you would add the following for each device (this only provides the static IP, and assumes the general options for DHCP, such as DNS server, are applicable):

host devicename {
      hardware ethernet ma:ac:ad:dr:ee:ss;
      fixed-address 192.168.x.x;
}

Under dd-wrt you can set this up under services -> services. There is a section called "Static Leases" where you can map a MAC address to a hostname and IP address.

You would generally want the fixed IP address to be in the same subnet as the other devices, but outside the range of IP addresses reserved for the DHCP server.

5
  • Thanks for the information, I was about to take TomEus answer as a fact! But well, the thing is that I did this procedure in two routers, but at the end it kept changing, is it possible to be a problem with the device? Or it always have to work no matter what through the router configuration? Commented Nov 13, 2017 at 23:41
  • 1
    You have not provided enough information for a specific answer. If the IP address keeps changing then the most likely causes are that you have more then 1 DHCP server and are configuring the incorrect one, or you have recorded the incorrect MAC address for your device. If the router is configured correctly, then it really does not matter what DHCP client the client is using as the server is responsible for allocating the IP address.
    – davidgo
    Commented Nov 14, 2017 at 0:21
  • 1
    dynamically assigning a static IP...a.k.a. DHCP Reservation. Commented Nov 14, 2017 at 4:13
  • I will disagree with you davigo, most consumer routers will not support dynamic assign of static IP and if OP is using enterprise class product, he would have a separate DHCP. You are correct that I made an assumption and should have asked for more information
    – TomEus
    Commented Nov 14, 2017 at 4:22
  • 1
    @TomEus - All the SOHO brands I checked support it - TPLink- tp-link.com/us/faq-182.html, DLink - dlink.cc/tag/dhcp-reservation, Belkin - belkin.com/pyramid/AdvancedInfo/F5D8235-4/Advance/reserveIP.htm Linksys - linksys.com/us/support-article?articleNum=137180 asus - event.asus.com/2012/nw/dummy_ui/en/Advanced_DHCP_Content.html Edimax - manualslib.com/manual/42778/Edimax-Br-6225n.html?page=76#manual - I could not find any brand of SOHO router which didn't. Care to name a few ?
    – davidgo
    Commented Nov 14, 2017 at 4:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .