I'm new to this platform but I try to be as specific as possible. I researched quite a lot but every new answer just adds to the confusion at the moment.

I am running Debian on my first server with a static IP. I have a domain burgers.de which has an A-record to my server's IP. The hostname of this machine is burgers. It's hosts file has these entries:               localhost.localdomain   localhost

xx.xx.xx.xx             burgers.de              burgers

# ::ffff:xx.xx.xx.xx    burgers.de              burgers

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Now to the confusing part:

Everywhere something like hostname.domain.tld after the IP in the hosts file is recommended. That would be burgers.burgers.de in my case which seems odd to me.

But I can't find any explanation why it should have this structure of 'hostname''domain''tld'. Can't I simply use just my domain burgers.de in there? The man page for hosts unfortunately doesn't help.

My goal is to achieve a correct FQDN.

Thanks for the help in advance and please correct me in any way. I'm here to learn but temporarily stuck and would not have asked otherwise.

closed as off-topic by Christopher, Rui F Ribeiro, roaima, dr01, vonbrand Apr 27 '18 at 13:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information." – Christopher, Rui F Ribeiro, roaima, dr01
If this question can be reworded to fit the rules in the help center, please edit the question.

  • If you use true names instead of obfuscation your question would be clearer and hence you would probably get better answers. I have read your question twice and still do not understand what you are asking... – Patrick Mevzek Apr 22 '18 at 16:50
  • hosts file has nothing to do with your DNS server. man gethostbyname – user996142 Apr 22 '18 at 17:39
  • @PatrickMevzek I'm sorry. I edited my post and hope, it's more understandable now. [at]user996142 I am not operating a DNS server. I'm just trying to host my own websites. Sorry if there was any confusion. – pedda Apr 24 '18 at 18:32
  • General approach is to give your machine a name inside your domain, thishost.burgers.de. There is nothing stopping you hosting a website for the domain burgers.de itself on this machine, though. – roaima Apr 26 '18 at 13:29
  • Each Unix/Linux has its's own quirks when setting this up, it has even changed between versions of the same distribution. Either check the documentation for your exact system, look at the support fora for it, or add specific details so we can answer. – vonbrand Apr 27 '18 at 13:39

What you put in /etc/hosts are typically hostnames, while burgers.de looks more of a domain name. This is not forbidden, just not customary.

If burgers.de is your domain name it typically means (at least this was the goal of domain names at the beginning) that you may have a group of servers and/or services that you would like to name "under" this domain name.

So, depending on various constraints and your own imagination, your first server could be server1.burgers.de or pedda.burgers.de or anything else you like as you control the burgers.de domain so you are free to implement whatever naming scheme you like. There is no correct or incorrect naming, as long as you respect the syntax for hostnames (basically: letters, digits, hyphens but not at start or end and 63 characters maximum)

It is this hostname that you put typically in /etc/hosts, as well as in the DNS (though it is not mandatory if you do not expect to use the name outside of the server itself)

Then you can name services. These services will, through the DNS, map to your server. Like www.burgers.de, mail.burgers.de, etc. In the DNS they will either be associated to A/AAAA records that will given them your server IP addresses or to CNAME record to server1.burgers.de or equivalent, as long as this name is itself published in the DNS with some A/AAAA records.

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