If you have a web server (e.g. the MQX web_hvac example) running on a device which also gets the IP by DHCP, is it possible to reach that server by some predefined name, rather than having to know the IP address?
(I'm using MCF52255 with MQX 3.7.)
Hi Angelo,
It's good that the solution for this problem was found. Anyway, didn't you investigate also the case when the device figures as a DHCP server and wants to provide its hostname to the attached clients?
I believe the solution of this issue is irrelevant here (but to be sure, I tried to add the option; it did not change anything as expected). Running a DNS server on the device would probably solve the problem, but RTCS does not seem to feature DNS server. Or it has maybe a way easier solution and I just overlooked it. Any clues, please?
Hi Angelo
I am currently using MQX 4.0.2 using K60 controller, I have similar question My MQX device is getting connected to my LAN network and DHCP is enabled So I need the user to just browse using the hostname . And my customer is not welling to enable DNS so is there a way we can achieve . Please let us know the steps to do it
Hi, sorry but I haven't resolved this issue yet. I was hoping that it would be added to MQX at some point. Maybe Martin will have further detail on his suggestion, but otherwise if you need to accomplish this soon, I would suggest trying to use the approach he mentioned (DHCP option 12).
Hi angelo ,
DHCP option 12 is supported in Mqx 4.0.2 can please provide few limelight steps so I can try this feature is really important as customer are behind us .
Hi, sorry I haven't looked into it much yet. Where did you see that it is support in MQX 4.0.2?
Hi Angelo
Added the option 12 to DHCP client message , and configured a Hostname and now able to see the host name in the switch terminal .
IP Address | Host Name | MAC Address |
192.168.10.2 | MQXdevice1 | 00:1E:C0:89:A6:A4 |
192.168.10.4 | Device2 | 14:58:D0:C8:17:9E |
Ealier it was blank , so in the case of DHCP enabled we can have hostname using option 12 has Martin mention . This is may be part of the solution to the issue .
Procedure to do it ,
Modify the ipcfg_bind_dhcp_internal function ipcfg.c
1) add a entry to the parm_options[] DHCPOPT_HOSTNAME entry
2) Add the piece of line
DHCP_option_string(&optptr,&optlen,DHCPOPT_HOSTNAME,"MQXdevice1");
Rebuiild the library now DHCP discovery message will have option 12 hostname and in the router you see the host name .
Now if the DNS is enable we can reach the websever by hostname rather than the IP address.
regards
vallinath
Great, thanks!
standard internet solution for this would be to register the client IP address at DNS Server. I post here my understanding of this. please correct me if I'm wrong:
In DNS, there is the term of "authoritative name server" that assigns domain names with IP addresses. The domain name administrator or dynamic DNS method can configure this assignment at DNS server.
Typical dynamic DNS method is based on "Host Name option" at DHCP client. DHCP client may give "Host Name" option 12 to DHCP client messages, and a combo of DHCP+DNS Sever would use dynamic DNS to connect the "Host Name" with the IP address.
Unfortunately the MQX RTCS (up to 4.0) DHCP client doesn't implement this option at the moment. We have this on the TODO list. For the moment, it would require you to implement this DHCP option 12 in the RTCS source file dhcpclnt.c, and configure the DHCP/DNS Server to use dynamic DNS for local network.
At some routers, local domain administrator can assign local domain name with a static IP addresses of local stations.
I can imagine also that some logic could be implemented at the server side based on MAC address. For example, local domain administrator could assign a local domain name with a MAC address. The DHCP server would remember the MAC address of the client and the IP address it has issued for it and would update authoritative name server for the local domain accordingly.
Hi Martin
I have Boards running in DHCP mode and I want to connect them using DNS system. As you told on Date Jun 4, 2013 this feature is not supported by MQX, I want to know does MQX support this feature now, If yes any related example or document about How to configure boards in DHCP and DNS ?
and If No then how will I achieve this ?
Please Explains steps you mentioned above.
Thanks.
Hi Martin,
I am trying to implement what Angelo is trying to do, and what you have suggested, namely, add the hostname option using DHCP client Option 12 in dhcpcInt.c, but there are a few things I don't understand in RTCS.
First, I see in DHCPCLNT_fill_options( ) the comments say "Only the following options are allowed for a DHCP Client message. Client ID, Use 'file'/'sname' fields, Parameter request list, IP address lease time, Class Id, Max message size, Requested IP addr. DO NOT change the order of insertion into the buffer, as other functions will depend on the order given here."
Questions:
1) Why are those the only options allowed? It seems that I could add any option which complies with RFC 2132.
2) Why can't the order change? What "other functions"? These options quoted above are not in the order presented in RFC 2132, and from my understanding of 2132, the options can be in any order.
Next, I see the DHCP_FILL( ) macro used which I would like to add option 12, however this macro uses DHCP_find_option( ) to first find the option code in the OPT_BUFF, therefore some code must first stuff option code 12 in the OPT_BUFF before I can even add option 12 to DHCPCLNT_fill_options( ) and I cannot find such code.
Please try to find where in RTCS the option codes are first stuffed into the DHCP client's buffer, and why it says "Only the following options are allowed for a DHCP Client message" in dhcpcInt.c
Thanks,
Gene
Thank you Martin,
The scenario is if we make a device that connects to any given home or office network router, and retrieves an IP address from the router's DHCP server, we won't easily know what that IP is in order to reach it through a web client on the network. We need to make this very straightforward so an average person with little or no ability to administer their router or modem, can just plug it in, and open the page. So unfortunately doing DHCP reservation by MAC address or even finding the IP on the router's page is not something we can ask the user to do. I know there are net IP scanners that will also let someone find IPs, but again we want to provide a quick and easy user experience.
I look forward to this being supported by MQX. Perhaps in the meantime I'll look into implementing option 12 myself, unless anyone else has already done this and is willing to share it.
Thanks,
Angelo
Hi Angelo,
I too would like to do exactly what you are describing. Have you found out anything new, or tried anything with the DHCP client option 12? I can't find anything about option 12 in the RTCSUG.
Thanks,
Gene
Hi Gene, I'm still pretty much at the same point you are. I decided to put it off since it seemed like more work than it was worth at the time. Maybe priorities will change in the future and I'll get back to it, but in the meantime I'd love to hear if you make any progress.
Regards,
Angelo