views:

159

answers:

3

Hello. I'm working with Microchip's TCP/IP stack and the host name of my device is not being broadcasted, although I can access it using its DHCP assigned IP.

So the question is, what is the protocol that a network device uses to broadcast its host name, so that when I see a list of devices in a network I can identify it by name?

Is it the NetBIOS name service or something else? Thanks in advance.

A: 

There is WINS (based on NetBIOS) that supports this functionality.

There is ZeroConf/Bonjour that offer a "service advertisement" protocol but I am guessing that's not what you are after here.

In "normal" IP based networks, name resolution would go through a DNS layer: the DNS servers propagate their databases (if instructed too of course) but there is no concept of "broadcasting" at this layer.

jldupont
+3  A: 

The most network-agnostic way to specify a hostname for a host on the network is through DNS, which your device itself cannot control, but all is not lost.

In most environments, the DHCP and DNS servers are tied (AD in Windows networks, DNSMasq on linux, etc...) so your best option is to rely on this behaviour. When you request an IP using DHCP, the DHCP protocol allows you to specify the hostname you'd like to use and if the network is set up to allow DNS entries to be created and maintained by the DNS server, the hostname you send during your DHCP request will typically be used.

The DHCP parameter is called 'Hostname'. The Network protocol documentation for this parameter is located in RFC 2132, and explained here.

Unfortunately since i just joined the site, I'm not allowed to post more than one link, so I can't link the RFC but you can just google for RFC 2132. Good luck!

loginx
A: 

I guess you've solved this by now but I modified the dchp.c file in the Microchip stack and added the following to the options part of _DHCPSend().

// host name
i = strlen(AppConfig.NetBIOSName);
UDPPut(12);     //host name code
UDPPut(i);      //length
UDPPutString(AppConfig.NetBIOSName);

This worked for me.

George Mayne