What is a _memorable_ "servername" exactly?

The "Install the Apache 2 Web Server on Ubuntu 10.04 LTS (Lucid)" tutorial (http://library.linode.com/web-servers/a … figuration">http://library.linode.com/web-servers/apache/installation/ubuntu-10.04-lucid#basicsystemconfiguration) advises one to use a memorable "servername" in the /etc/hosts file.

Unfortunately I am not quite sure what Sam Kleinman refers to when he writes memorable. Could I call the "servername" anything I desire?

Prior to that the tutorial states that one should replace "servername.domain.tld" with Linode's fully qualified domain name (FDQN).

Currently I am using "lixx-yyy.members.linode.com" as my FDQN in /etc/hosts, where xx likely represents the server number, and yyy represents the last 3 digits of the static IP address.

Is this correct? If not, what should one be using for "servername.domain.tld"?

Does one have the freedom to name "servername" anything I like in /etc/hosts? For example, can one use any registered domain name as "servername", or is it far more arbitrary?

Thanks for the help.

11 Replies

I name all my servers after WW1 German Generals (in honour of my Great Grandfather).

Ok not really.

Pretty much any name will do.

Try "Sparky", I've always had really good luck with that name.

When in doubt, RFC 1178 has guidelines for choosing computer names. The trick is to use a theme of some sort. I use names of beer, for instance. Others use some location- or purpose-specific identifier followed by a number (newark117.linode.com, db2.example.com, etc).

In short, every computer should have a hostname and it must be unique and unambiguous within your context. Or you'll go batty.

So far I've used variations of my nickname. "Stanode" and "Theman" :P

I named mine after the elements, until I ran out of elements I could spell.

First, it is very important to distinguish between machine naming and virtual server naming. In the case of machine naming it is a matter of attaching a name to a physical object. There is a very high probability that in practical use that physical object will fulfill more than one rôle. Since this is the case for most general purpose computers, it is best to use a name with no particular semantic content relating to the machine's function. This may change over time, or a new machine may takes its place in delivering the service it currently does.

So, barring machines that are physically embedded in other devices, semantically neutral, easy-to-remember-and-spell names are best. You can do this thematically (though as with the individual machines, do not count on the name making "sense" over time. e.g.: all machines in location X are named for types of toads, but machine Y is moved to location Z and now is a toad in a place no toad should be.)

Avoid names that are confusing when spoken. If you are English speaking and choose French names you will find that you are constantly forced to spell the machine's name after saying it, and, even with that precaution, you will get email (long after the initial contact and just before an important deadline) saying the machine doesn't answer. Make names shortish, and don't try to embed information in them, use a database to track them.

Now, on virtual host names, these are NOT machine names. They are truly functional names. If you are creating a virtual host for a web server, you are creating something that is for a particular purpose. It is not tied to a physical machine (it can be moved easily to a completely different hosting arrangement). It is designed to provide access to a category of information or a particular service.

So, here, you WANT a semantically effective name. It should be named for what the user will find when they type that address into the location bar of their browser. It should inform the human being about what will be there and be easy to remember and even to derive if the user is knowledgable.

So, for a virtual host, use a meaningful name. "Memorability" is a laudable quality but it comes from a complex of attributes. It is very easy to remember things that make sense. Since a virtual host name does NOT have to be unique outside the namespace defined by the rest of the FQDN, you don't have to concern yourself with confusion outside your enterprise. Just choose something that means something most useful about the virtual host.

For example, if the host is a place for a particular user to provide general web services to his audience, .domain.tld is very sensible. The user will then use the URL (i.e.: .domain.tld/) to provide naming for his functions, while the host name was your naming for your function.

If the host is for a particular function of the organization running the web server, name it for that. (e.g.: blog.domain.tld and forum.domain.tld).

The main idea in all of this is to note that you are dealing with a hierarchical naming system where the names are sometimes tied to physical objects and sometimes to virtual ones. Imagine HOW the name will be USED and choose accordingly.

Also, "binky" is a good name.

Tool albums worked for me until I had more than six servers.

I've used various schemes. For a while, I used *intosh since my first machine (1994) was a mac. So I had macintosh, gusintosh, deskintosh, lapintosh, dellintosh, servintosh, routintosh, and my current toshiba laptop, toshintosh (couldn't resist, so I used *intosh instead of my newer scheme below). There might have been a tuxintosh in there for a while.

For newer machines, I'm currently using the names of planets from the Star Wars universe. My linode is hoth, and my home file server is yavin (because, you know, gas giants are large, and 10TB is kinda large for a home file server).

Thank you all for your informative responses. I just saw them for the first time today when I was searching the forums for "/etc/hosts". For some reason I did not receive email notifications with each response.

While I understood the general idea "Names, like words, have meanings based on use" described so eloquently by Yaakov and supported by RFC 1178, I was still unclear on the mechanics of how to modify the /etc/hosts file, specifically the allowable syntax. Originally I failed to convey precisely the nature of my inquiry which was more syntactical than lexical or semantic. Thanks Yaakov for providing a clue in that direction by mentioning that a virtual host does not have to be unique outside the namespace defined by the rest of the FQDN. I agree - "binky" is a great name, as in "binky" has crashed.

In the process of trying to get ISPConfig to run on port 8080 per the Linode tutorial ([http://library.linode.com/web-applications/control-panels/ispconfig/ubuntu-10.04-lucid" target="blank">](http://library.linode.com/web-applicati … 0.04-lucid">http://library.linode.com/web-applications/control-panels/ispconfig/ubuntu-10.04-lucid](), or port 81 per O'reilly's Linux System Administration book, I encountered this forum discussion entitled "Best ICPConfig Setup - help please" ([http://www.linode.com/forums/viewtopic.php?t=5518&highlight=ispconfig" target="blank">](http://www.linode.com/forums/viewtopic. … =ispconfig">http://www.linode.com/forums/viewtopic.php?t=5518&highlight=ispconfig]().

Unfortunately the solution offered in the URL above, and repeated below, still fails to address the question of how to modify the hosts file syntactically.

* * Change hostname to 127.0.0.1

* Update your hostname to something more meaningful

* Set up a reverse DNS using Linode manager

* Enable .htaccess acess

* Add AllowOveride All or AllowOveride Options to VirtualHost</list> 

The Dashboard of the Linode Manager allows one to change the Linode Label to a meaningful name in much the same way one is recommended to change the hostname.

* * Must the Linode Label match the hostname/servername in the /etc/hosts file?

* Can they be different with no adverse effects?</list> 

Page 14 of the O'reilly Linux System Administration book suggests the following for the /etc/hosts file.

127.0.0.1                 localhost.localdomain      localhost     server1
70.153.258.42          server1.centralsoft.org    server1

On 2010-08-05 my /etc/hosts file looked like this.

127.0.0.1                 lixxxxxx                        localhost
74.xxx.xxx.xxx

During a support ticket exchange, Linode's Stan recommended that I leave the 127.0.0.1 as the following.

127.0.0.1                 localhost

This is the current state of my /etc/hosts file.

127.0.0.1                 localhost
74.xxx.xxx.xxx         lixxxxxx.members.linode.com   lixxxxxx

And for reference here is my /etc/hostname file.

lixxxxxx
lixxxxxx.members.linode.com

So my new questions are these.
* * Must the hostname be listed once a FQDN, "servername.domain.tld" in the /etc/hosts file?

* Must one use linode.com as the "domain.tld" in the /etc/hosts file, for example, making the FQDN in the file "blinky.linode.com"?

* Can one use one of the registered domain names in the /etc/hosts file, for example, mydomain.com?

* If one plans to launch a multi-site virtual host configuration, can one arbitrarily choose one of the registered domain names for the /etc/hosts file, or must each registered domain name be accounted for in both the /etc/hosts file and the /etc/hostname file?

* Would the FQDN in the /etc/hosts file using a registered domain name look something like this: blinky.mydomain.com?

* Both user ops and the O'reilly book appear to indicate that the hostname should be assigned to 127.0.0.1\. However, Linode's Stan recommended that the 127.0.0.1 line only reference localhost, removing my prior hostname reference. Must localhost appear prior to the hostname on this line?</list> 

Thank you.

/etc/hosts should be like

127.0.0.1 localhost

127.0.1.1 foo.bar.com green

/etc/hostname

green

127.0.1.1 can be your eth0 ip

green in /etc/hostname must appear on the same line as what you want your fqdn to be in /etc/hosts, the fqdn must be the first column after the ip address. You can make green whatever you want, it's often foo. (if you change it in /etc/hostname you have to change it in /etc/hosts)

you can make foo.bar.com whatever you want, it could be bar.com. It should probably resolve to the eth0 ip address in the dns.

you can add other entries to the 127.0.1.1 line, put them between foo.bar.com and green.

You don't need to add an entry to /etc/hosts for virtual domains

That's the general gist of things. I'm sure there will be people who don't agree with what I've said.

@feldmand:

  • Must the hostname be listed once a FQDN, "servername.domain.tld" in the /etc/hosts file?
    No. But it's a good idea.
    @feldmand:

  • Must one use linode.com as the "domain.tld" in the /etc/hosts file, for example, making the FQDN in the file "blinky.linode.com"?
    No. You can either use the name linode gives you which will be something like li123-456.members.linode.com or you can buy a name from a domain registrar and either run our own DNS or get them to do it.
    @feldmand:

  • Can one use one of the registered domain names in the /etc/hosts file, for example, mydomain.com?
    You can use any name you like in /etc/hosts but it won't mean anything outside your system if you own it and have DNS setup right.
    @feldmand:

  • If one plans to launch a multi-site virtual host configuration, can one arbitrarily choose one of the registered domain names for the /etc/hosts file, or must each registered domain name be accounted for in both the /etc/hosts file and the /etc/hostname file?
    You only need one hostname in /etc/hostname. It's a good idea to put all names in /etc/hosts but you don't need to if they resolve to your IP by normal internet DNS.
    @feldmand:

  • Would the FQDN in the /etc/hosts file using a registered domain name look something like this: blinky.mydomain.com?
    Yes, it should be IP FQDN shortnames

123.123.123.123 blinky.mydomain.com binky
@feldmand:

  • Both user ops and the O'reilly book appear to indicate that the hostname should be assigned to 127.0.0.1. However, Linode's Stan recommended that the 127.0.0.1 line only reference localhost, removing my prior hostname reference. Must localhost appear prior to the hostname on this line?
    The hostname can be assigned to any IP that is normally up. 127.0.0.1 should always be up so you can use that. Localhost must resolve to 127.0.0.1. The order of lines isn't important, the order of shortnames after the FQDN isn't important.

I like to name mine after ways of getting somewhere fast. Such as "freeway", "turnpike", and the ever popular "expressway".

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct