Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I mean, why IP addresses are not sufficient? We can identify devices by their IP addresses. Why do we want to use hostnames? To identify devices?

I know that IP addresses are assigned in a random way (from a certain range). What about the host names? How are they assigned?

share|improve this question

2 Answers 2

On all the zeroconf devices I've used the hostname is actually set on the device. On a Mac this comes from the computer name you set for your system. On my Linux and OpenSolaris machines it's the system hostname.

share|improve this answer
    
Do I correctly understand? The hostnames are not set automatically by the zeroconf. User sets a name for the computer and this name is used by zeroconf as the hostname for this computer. What if 2 computers have the same name? –  Roman Mar 3 '10 at 21:10
    
Well, they are not set by the protocol. The application implementing the zeroconf service on your platform (Avahi in the case of Linux) takes care of setting the hostname it publishes via mDNS. It defaults to the system hostname but you could change it to something else. I'm unsure as to what happens if two machines attempt to publish the same hostname. –  Kamil Kisiel Mar 3 '10 at 21:45
1  
If two machines try to publish the same hostname (or any other name), there's a resolution mechanism defined as part of the protocol. One gets the original name, say "foo", and the other gets "foo-1". –  Peter Westlake Mar 5 '10 at 16:57

An IP address doesn't tell you anything about the device. As well as machines setting host names as Kamil explained, printers and scanners and cameras and storage devices can all have helpful names built in. So you might see names like "Inkjet Printer Model 1234" and "Digital Camera XYZ". Deciding which one will print your document is much easier than trying to choose between 192.168.1.11 and 192.168.1.12!

If you have more than one of a device, you can very often change the names, but for something like a printer, the name that's set at the factory is usually good enough. So to answer the second part of your question, for many devices, the names are assigned by being burned into ROM at the factory.

share|improve this answer
    
Should be pointed out that the meaningful name is not necessarily the hostname. Some devices publish a name like "Inkejt Printer Model 1234 named <hostname>" in case there are multiples of them on the network. –  Kamil Kisiel Mar 5 '10 at 22:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.