EmbeddedRelated.com
Forums
Memfault Beyond the Launch

How to bind host-name with an IP address

Started by Ty June 19, 2012
On Jun 19, 2012, at 9:47 AM, Ty wrote:

>
> The problem I have is within LAN, the rabbitweb IP address isn't necessarily static ( 1 day it might be 192.168.1.13 and another day I might be 192.168.0.12). The app that I use to connect to the rabbitweb via LAN doesn't work 100% of the time. I need a way method for the app to connect to the rabbitweb by a hostname( for ex. 'wxyz') instead of 192.168.0.13, for example. I need to tell the router that the rabbitweb is also known as 'wxyz'.
>
I haven't been following this too closely, but wouldn't something along the lines of Zero Configuration Networking (zeroconf.org) (aka Bonjour for the Mac people) be along the lines that you're looking for?

Dean
Thanks guys for the great solution but I need a solution that would be seamless to the client/end-user. So I think I'll have to implement a udp server along with my http server. The UDP server would respond to broadcast messages from the client with its IP Address, Mask, default gateway. The client will need to send this broadcast before it communicate with the HTTP server. I hope this is the most practical solution.

--- In r..., Dean Leiber wrote:
> On Jun 19, 2012, at 9:47 AM, Ty wrote:
>
> >
> > The problem I have is within LAN, the rabbitweb IP address isn't necessarily static ( 1 day it might be 192.168.1.13 and another day I might be 192.168.0.12). The app that I use to connect to the rabbitweb via LAN doesn't work 100% of the time. I need a way method for the app to connect to the rabbitweb by a hostname( for ex. 'wxyz') instead of 192.168.0.13, for example. I need to tell the router that the rabbitweb is also known as 'wxyz'.
> >
> I haven't been following this too closely, but wouldn't something along the lines of Zero Configuration Networking (zeroconf.org) (aka Bonjour for the Mac people) be along the lines that you're looking for?
>
> Dean
>

Why not boot in DHCP first time and then change the set-up to static ip
configuration once happy with IP assume once the device is installed it
will remain there.

I to would like to implement a host name setup will have to look into how
windows achieves this.

On 20 June 2012 14:05, Ty wrote:

> **
> Thanks guys for the great solution but I need a solution that would be
> seamless to the client/end-user. So I think I'll have to implement a udp
> server along with my http server. The UDP server would respond to broadcast
> messages from the client with its IP Address, Mask, default gateway. The
> client will need to send this broadcast before it communicate with the HTTP
> server. I hope this is the most practical solution.
>
> --- In r..., Dean Leiber wrote:
> >
> >
> > On Jun 19, 2012, at 9:47 AM, Ty wrote:
> >
> > >
> > > The problem I have is within LAN, the rabbitweb IP address isn't
> necessarily static ( 1 day it might be 192.168.1.13 and another day I might
> be 192.168.0.12). The app that I use to connect to the rabbitweb via LAN
> doesn't work 100% of the time. I need a way method for the app to connect
> to the rabbitweb by a hostname( for ex. 'wxyz') instead of 192.168.0.13,
> for example. I need to tell the router that the rabbitweb is also known as
> 'wxyz'.
> > >
> > I haven't been following this too closely, but wouldn't something along
> the lines of Zero Configuration Networking (zeroconf.org) (aka Bonjour
> for the Mac people) be along the lines that you're looking for?
> >
> > Dean
> >
>
On 6/20/2012 9:05 AM, Ty wrote:
> Thanks guys for the great solution but I need a solution that would be seamless to the client/end-user. So I think I'll have to implement a udp server along with my http server. The UDP server would respond to broadcast messages from the client with its IP Address, Mask, default gateway. The client will need to send this broadcast before it communicate with the HTTP server. I hope this is the most practical solution.

I have used that and it used to work.

Newer versions of windows block UDP data from devices that have not been
explicitly communicated with. So, it won't work unless you add an
exception to the Windows firewall.

--
------
Scott G. Henion, Consultant
Web site: http://SHDesigns.org
------

Hi Phil... with your approach, would the rabbitweb have the same IP Address if the router was to reboot? The client/end-user doesn't necessarily know much about regarding IP Address.

--- In r..., Phil D wrote:
>
> Why not boot in DHCP first time and then change the set-up to static ip
> configuration once happy with IP assume once the device is installed it
> will remain there.
>
> I to would like to implement a host name setup will have to look into how
> windows achieves this.
>
> On 20 June 2012 14:05, Ty wrote:
>
> > **
> >
> >
> > Thanks guys for the great solution but I need a solution that would be
> > seamless to the client/end-user. So I think I'll have to implement a udp
> > server along with my http server. The UDP server would respond to broadcast
> > messages from the client with its IP Address, Mask, default gateway. The
> > client will need to send this broadcast before it communicate with the HTTP
> > server. I hope this is the most practical solution.
> >
> >
> >
> > --- In r..., Dean Leiber wrote:
> > >
> > >
> > > On Jun 19, 2012, at 9:47 AM, Ty wrote:
> > >
> > > >
> > > > The problem I have is within LAN, the rabbitweb IP address isn't
> > necessarily static ( 1 day it might be 192.168.1.13 and another day I might
> > be 192.168.0.12). The app that I use to connect to the rabbitweb via LAN
> > doesn't work 100% of the time. I need a way method for the app to connect
> > to the rabbitweb by a hostname( for ex. 'wxyz') instead of 192.168.0.13,
> > for example. I need to tell the router that the rabbitweb is also known as
> > 'wxyz'.
> > > >
> > > I haven't been following this too closely, but wouldn't something along
> > the lines of Zero Configuration Networking (zeroconf.org) (aka Bonjour
> > for the Mac people) be along the lines that you're looking for?
> > >
> > > Dean
> > >
> >
> >
>

--- In r..., Scott Henion wrote:
>
> On 6/20/2012 9:05 AM, Ty wrote:
> > Thanks guys for the great solution but I need a solution that would be seamless to the client/end-user. So I think I'll have to implement a udp server along with my http server. The UDP server would respond to broadcast messages from the client with its IP Address, Mask, default gateway. The client will need to send this broadcast before it communicate with the HTTP server. I hope this is the most practical solution.
>
> I have used that and it used to work.
>
> Newer versions of windows block UDP data from devices that have not been
> explicitly communicated with. So, it won't work unless you add an
> exception to the Windows firewall.
>
> --
> ------
> Scott G. Henion, Consultant
> Web site: http://SHDesigns.org
> ------
>
Hi Scott, thanks for the timely advice. I was just about to start writing the code. I never like Windows.:(.. What if the clients were using a mobile App for Android/BB/iPhone, would using UDP data do the trick?

On 6/20/2012 12:03 PM, Ty wrote:
> Hi Scott, thanks for the timely advice. I was just about to start writing the code. I never like Windows.:(.. What if the clients were using a mobile App for Android/BB/iPhone, would using UDP data do the trick?
>

Probably, most phones are a bit more open.

--
------
Scott G. Henion, Consultant
Web site: http://SHDesigns.org
------

--- In r..., "ebrains2003" wrote:
>
> That won't work. If the router will assume that address is
>available and will throw it back into the "pool" and then asign it
>to another computer / device.

It works fine. Clearly you've not done it. See RFC 2131 and handling the DHCPDECLINE message:

4.3.3 DHCPDECLINE message

If the server receives a DHCPDECLINE message, the client has
discovered through some other means that the suggested network
address is already in use. The server MUST mark the network address
as not available and SHOULD notify the local system administrator of
a possible configuration problem.

Maybe the Rabbit software doesn't support it, but DHCP does if it were implemented.

Bill

On Jun 20, 2012, at 7:13 AM, Phil D wrote:
> Why not boot in DHCP first time and then change the set-up to static ip configuration once happy with IP assume once the device is installed it will remain there.
>
When a DHCP server issues an address, it has a timed lease. At the end of that time, if the device has not renewed the lease, the address goes back into the address pool and can be assigned to another device.

Most DHCP servers can be configured to associate an IP address with a fixed MAC address so your rabbit would always get the same IP.

> I to would like to implement a host name setup will have to look into how windows achieves this.

Take a look at http://rabbitlib.sourceforge.net/ -- it includes support for the Windows NetBIOS protocol, which I assume includes NBNS name resolution. Machines on your local network would be able to use a fixed hostname in the web browser to connect to the Rabbit. I haven't used that version myself, and I also have a copy of another implementation that an engineer from Argentina sent me 3 years ago.

If you want to allow connections from across the Internet, it's necessary to configure your router/firewall to forward connections on the public IP address to your internal Rabbit. The Rabbit may need to learn its public IP address (I think recent DC 10 releases have an HTTP client sample that does that) if it includes that IP in any of the web pages it generates (like a page redirect).

Recent DC 10 releases also have a sample (dyndns.c) that connects to dyndns.org and updates a hostname for any given IP. You can have the Rabbit check its address periodically, and then send an update request to dyndns.org if the address has changed.

-Tom
Once you have moved to static the router will usually know that the address
cant be assigned for dhcp use, ive done this on implementations before.

with regard to the local network host name working with mobile devices i
dont think it will unless you have some control over dns in that network to
point it at your device. or use dynamicdns to store a local ip that only
works locally

On 20 June 2012 18:07, Tom Collins wrote:

> **
> On Jun 20, 2012, at 7:13 AM, Phil D wrote:
>
> Why not boot in DHCP first time and then change the set-up to static ip
> configuration once happy with IP assume once the device is installed it
> will remain there.
>
> When a DHCP server issues an address, it has a timed lease. At the end of
> that time, if the device has not renewed the lease, the address goes back
> into the address pool and can be assigned to another device.
>
> Most DHCP servers can be configured to associate an IP address with a
> fixed MAC address so your rabbit would always get the same IP.
>
> I to would like to implement a host name setup will have to look into how
> windows achieves this.
> Take a look at http://rabbitlib.sourceforge.net/ -- it includes support
> for the Windows NetBIOS protocol, which I assume includes NBNS name
> resolution. Machines on your local network would be able to use a fixed
> hostname in the web browser to connect to the Rabbit. I haven't used that
> version myself, and I also have a copy of another implementation that an
> engineer from Argentina sent me 3 years ago.
>
> If you want to allow connections from across the Internet, it's necessary
> to configure your router/firewall to forward connections on the public IP
> address to your internal Rabbit. The Rabbit may need to learn its public
> IP address (I think recent DC 10 releases have an HTTP client sample that
> does that) if it includes that IP in any of the web pages it generates
> (like a page redirect).
>
> Recent DC 10 releases also have a sample (dyndns.c) that connects to
> dyndns.org and updates a hostname for any given IP. You can have the
> Rabbit check its address periodically, and then send an update request to
> dyndns.org if the address has changed.
>
> -Tom
>
>
>

Memfault Beyond the Launch