Domain name as hostname?

Can I use my domain name as my server host name?

Are there any problems with this setup:

/etc/hostname

sample

/etc/hosts

127.0.0.1 localhost

xx.xx.xx.xx sample.com sample

8 Replies

@neo:

Can I use my domain name as my server host name?

Are there any problems with this setup:

/etc/hostname

sample

/etc/hosts

127.0.0.1 localhost

xx.xx.xx.xx sample.com sample

You need to have a hostname, example

xx.xx.xx.xx webserver.sample.com webserver

@marcus0263:

You need to have a hostname, example

xx.xx.xx.xx webserver.sample.com webserver
Thank you for your answer. I did setup test system with my domain name as host name and everything seems to work fine. Can you please explain what are the disadvantages of such setup?

@neo:

@marcus0263:

You need to have a hostname, example

xx.xx.xx.xx webserver.sample.com webserver
Thank you for your answer. I did setup test system with my domain name as host name and everything seems to work fine. Can you please explain what are the disadvantages of such setup?
Your Domain is your domain, host is server. Look at it this way -

Domain = Your Country

hostname = Your City

Think of the complications if all City's in America were just simply called America, get the picture?

@marcus0263:

Your Domain is your domain, host is server. Look at it this way -

Domain = Your Country

hostname = Your City

Think of the complications if all City's in America were just simply called America, get the picture?

Using your analogy, if it's a very small country with only one city, that city essentially IS the country so it would make sense if they used the same name. Since my server handles everything for my web domain, essentially it IS the domain.

Actually since it handles everything for multiple domains, it would make sense for it to have multiple host names, but that's another question.

@neo:

@marcus0263:

Your Domain is your domain, host is server. Look at it this way -

Domain = Your Country

hostname = Your City

Think of the complications if all City's in America were just simply called America, get the picture?

Using your analogy, if it's a very small country with only one city, that city essentially IS the country so it would make sense if they used the same name. Since my server handles everything for my web domain, essentially it IS the domain.

Actually since it handles everything for multiple domains, it would make sense for it to have multiple host names, but that's another question.
No your domain is your domain, your server is your server. Apples and Oranges my friend ;)

Think of it this way, your domain is your city, your hostname is your house/ a building.

Bottom line you'll run into problems, stick with the standards ;)

@marcus0263:

@neo:

Using your analogy, if it's a very small country with only one city, that city essentially IS the country so it would make sense if they used the same name. Since my server handles everything for my web domain, essentially it IS the domain.

Actually since it handles everything for multiple domains, it would make sense for it to have multiple host names, but that's another question.
No your domain is your domain, your server is your server. Apples and Oranges my friend ;)

Think of it this way, your domain is your city, your hostname is your house/ a building.

Bottom line you'll run into problems, stick with the standards ;)
You may well be right about this, but I would like to hear any arguments besides "don't do it".

This is the basis for the advice offered:

@RFC 1178 - 'Choosing a Name for Your Computer':

Avoid domain names.

For technical reasons, domain names should be avoided. In particular, name resolution of non-absolute hostnames is problematic. Resolvers will check names against domains before checking them against hostnames. But we have seen instances of mailers that refuse to treat single token names as domains. For example, assume that you mail to "libes@rutgers" from yale.edu. Depending upon the implementation, the mail may go to rutgers.edu or rutgers.yale.edu (assuming both exist).

What do you plan to call your second server? Having a basic hierarchy and naming scheme chosen at the start means growth is that much easier.

RFC 1178 covers the topic of choosing a hostname, although some of the examples are slightly dated.

(For the record: here, servers and workstations are named after beers, point-to-point links have a more utilitarian scheme, cars are named after beetles indigenous to the country of manufacture, and a cat must have THREE DIFFERENT NAMES.) -rt

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