I am new to OpenHAB, but work with java dev. daily.
“Please note: if your network devices use a DHCP server to obtain ther IP addresses automatically, please make sure to define a DHCP reservation for a device which you want to use in openHAB. Otherwise it’s IP address may change in the future and your thing definiton won’t work any more. Information about how to define a DHCP reservation can be normally be found in the manual of your network router.”
Why not simply lookup the phys addr. and use that to recognize the device in place of the IP? I like the way DHCP works
Yes, that is a working strategy to lookup a network devices. I’m using this here to find my Amazon Echo which cannot be pinged and does not have any open ports. However, as steve1 already mentioned, your Java code just gets the MAC address of your local network interface. You have to lookup the MAC address in the ARP cache of your OS (as you correctly wrote in your post).
Yes, you can find the MAC address of a network device using platform-dependent techniques. Since the quote from the documentation was related to the OH2 network device discovery I thought the question was “why does openHAB not use this technique?”. AFAIK, there’s no Java platform-independent way to do a reverse/inverse ARP query. @Temar, what technique are you using to query the ARP cache? Do you do anything to ensure the Echo’s MAC is actually in the cache?
I know the example queries the local NIC, I just figured you could pass any IP on the same subnet. I should probably read the javadoc…
I have read several places that the ARP table is available on many routers and gateways using SNMP. I know that is possible from java. It should probably be fetched from whatever device holds the DHCP table.
Another way is to use one of the arpd servers available. But that is not a clean java solution.
What’s up? Could anyone help me understand how this dhcp work?
I want to have remote access to my rpi out of the network and I don’t want to use my openHAB neither the static ip add. so I wold like to make only the right settings in my router! The proplem is that this stupid router I have is from the tv/internet local provider (ZTE) and it doesn’t aloud me to assign an static dhcp according to rpi MAC address and the desired ip! And than let’s say if I could do that, what next? How do I access the internal ip binded to the rpi mac add. ? do I need to port forward? I didn’t understand this procedure very well even it sounds very easy! I used to have access out of the local network by using a static ip in my rpi, opening port 8080 and using a dns which was free and now it isn’t anymore!
What about duckdns? I can’t use it because I can’t fill the internal ip in the ipv6 space! I’m using ipv4 but it says it works with both ip types but I couldn’t set one.