Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Is there anyway to have Ethernet Gateway set to DHCP for IP address?

Is there anyway to have Ethernet Gateway set to DHCP for IP address?

Scheduled Pinned Locked Moved Troubleshooting
13 Posts 5 Posters 5.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    drock1985
    wrote on last edited by
    #3

    Hi,

    How would I do that? I'm a complete noob when it comes to programming (just learning).

    My Projects
    2 Door Chime Sensor
    Washing Machine Monitor

    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #4

      Have a look here:
      https://www.arduino.cc/en/Reference/EthernetClient

      and here:

      https://www.arduino.cc/en/Reference/EthernetBegin

      As you can see, skipping ip parameter activates DHCP.

      1 Reply Last reply
      0
      • greglG Offline
        greglG Offline
        gregl
        Hero Member
        wrote on last edited by
        #5

        Yeah cant you just use https://www.arduino.cc/en/Tutorial/DhcpAddressPrinter and then recycle the mac address used?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          drock1985
          wrote on last edited by
          #6

          Well, I tried to add the DHCP, but it does go over the memory size of the Nano by 150 bytes, so it won't go there.

          Next thing would be the Uno, but again, still new and just figuring this out. Would I have to remove the SPI callout in the Gateway code, and therefore have to re-set which pins go where?

          Thanks for the help so far!

          My Projects
          2 Door Chime Sensor
          Washing Machine Monitor

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mvdarend
            wrote on last edited by mvdarend
            #7

            How about cloning the Ethernet Gateway MAC address on your PC, once it's 'known' to the router you can change your PC MAC address back and plug in your Ethernet Gateway.

            Here's some info on how to do it:
            http://www.howtogeek.com/192173/how-and-why-to-change-your-mac-address-on-windows-linux-and-mac/

            Edit: Added link to more info

            1 Reply Last reply
            0
            • D Offline
              D Offline
              drock1985
              wrote on last edited by
              #8

              Hi mvdarend,

              that was a good idea, but unfortunately that didn't work either. I plugged in my ethernet cable to my PC (i'm usually on wireless) and set up a static IP. That worked fine for the router. So I then cloned the MAC address over to the Arduino sketch and went back to wireless. Rebooted the Gateway and it didn't want to work. Can't even ping the IP address along the way.

              So, i'm stumped for now. I tried the code you linked to in the first reply hek, but i'm getting compile errors. It's something on my end, i'm sure.

              Anyways, i'm going to try and build a serial gateway (again) and see what happens for the short term until the library gets updated for DHCP then try again.

              Thanks!

              My Projects
              2 Door Chime Sensor
              Washing Machine Monitor

              1 Reply Last reply
              0
              • greglG Offline
                greglG Offline
                gregl
                Hero Member
                wrote on last edited by
                #9

                @drock1985 - Sorry if I missed it, by WHY do you need to use DHCP on the mySensors Gateway? Why not just pick a free IP address, outside of the DHCP pool?

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  drock1985
                  wrote on last edited by
                  #10

                  Hi Greg,

                  Its something with this new router I am using, the Google OnHub. It works differently than most routers, being advertised as a "smart router".

                  It doesn't allow you to manually specify information like address reservation to MAC addresses like all other routers do (Trendnet, TP-Link, D-Link, etc). The only way it does is after a device successfully connects once via DHCP, you can then in the app (for iOS and Android, there is no web interface) you can select that device and then set a reserved IP, but never before.

                  From what I can tell in the current EthernetGateway sketch (v 1.5) the code does not actually perform a full DHCP request communicating back and forth with the router (which is what OnHub wants) and instead relies on the router setting up the communication after the gateway advertises the MAC address and IP. Without the full DHCP request, I can't set a static IP at all.

                  I even contacted Google multiple times, but they said it's beyond the software and how it's programmed. So now i'm forced into getting DHCP implemented into the EthernetGateway sketch.

                  I know the easy solution would be to go out and get a different router, but so far this is the only one I have had in the last 3 years that I haven't had to reboot because of dropping Wi-Fi connections or slow-downs, so it's a keeper. :)

                  My Projects
                  2 Door Chime Sensor
                  Washing Machine Monitor

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jkandasa
                    Plugin Developer
                    wrote on last edited by
                    #11

                    @drock1985 if you have any of your old router or old smartphone(not using now) or your friends smart phone(change your rouer authentication detail temporerly if you use your firends phone :wink: ) connect it with you OnHub and use that MAC on your Gateway

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      drock1985
                      wrote on last edited by
                      #12

                      That's what mvdarend suggested but that still doesn't work. I set the EthernetGateway to an unused ethernet port MAC address on my PC (since I used wireless to connect). I connected the cable to OnHub and my PC, it seen the PC and I set the DHCP reservation. Unplugged it and rebooted over back to wifi. I then programmed the MAC address of the wired MAC address I used earlier, but it still doesn't register.

                      I don't know what else to try.

                      My Projects
                      2 Door Chime Sensor
                      Washing Machine Monitor

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        drock1985
                        wrote on last edited by
                        #13

                        Back up and running temporarily when Arduino uno and serial gateway. Looking forward to the update for DHCP.

                        My Projects
                        2 Door Chime Sensor
                        Washing Machine Monitor

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        16

                        Online

                        11.7k

                        Users

                        11.2k

                        Topics

                        113.1k

                        Posts


                        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • MySensors
                        • OpenHardware.io
                        • Categories
                        • Recent
                        • Tags
                        • Popular