71

I am new to the world of setting up servers and am baffled by the term hostname and fully qualified domain name (FQDN).
For example, if I want to set up a server that hosts files on the local network i.e. a file server, what would I use a hostname such as myfileserver or something else?
What if I wanted to set up a web server, mail server, etc. that external users could access?

Eddie C.
  • 487
  • 1
  • 3
  • 12
PeanutsMonkey
  • 1,832
  • 8
  • 26
  • 27
  • Have a look at this question and it's answers http://serverfault.com/questions/222095/what-is-the-canonical-name-for-domain-names-with-extra-parts – user9517 May 15 '11 at 13:57

3 Answers3

63

Your hostname is the name of your computer.

Your fully qualified domain name is your hostname plus the domain your company uses often ending in .local.

So if the name of your computer is bob, and your company's domain is contoso.local, your computer's fully qualified domain name (FQDN) is bob.contoso.local.:

  • Hostname: bob
  • Domain: contoso.com
  • FQDN: bob.contoso.com.

In the case of a domain like contoso.local I did not use an "external" internet domain name. This name doesn't have to be the only way that you address the server.
If you make it available by its IP address you can use DNS or that IP address to allow external users to access it.
The dot at the end of the FQDN is used to indicate the empty top-level domain.

Some more information on DNS:

Edit: Thanks for the comment on .local domains RobM

sclarson
  • 3,624
  • 21
  • 20
  • So the name of my computer would have to be unique on the network segment I am on? I am further confused by the use of local. When would you use local? Would I only use say .com, .net, etc only if the server could be accessed externally? –  May 15 '11 at 03:08
  • So if I set it up as say contoso.com and it points to an IP address that is internal e.g. 192.168.0.1, what would that do as opposed to me naming it contoso.local? –  May 15 '11 at 03:18
  • @sparks. I am also confused by the use of Domain your example i.e. contoso.local? What does the domain refer to when in an internal environment? I take it the term Domain refers to say contoso.com in an external environment and the FQDN would be bob.contoso.com? –  May 15 '11 at 03:20
  • For your purposes you can just name it contoso.com, but the local name on your computer doesn't matter that much. The web server or mail server will have their own settings for the computer name or address that they respond to. Also if you are using an internal IP address you'll need to look into "Port Forwarding" on your router/firewall. – sclarson May 15 '11 at 03:21
  • @sparks. Please forgive me if I am being a noob here. I still am confused by the use of the term Domain. Are you able to give me an example of how this would work for an organization that has both internal servers and servers accessed externally? –  May 15 '11 at 03:26
  • 1
    Your "domain" in the internet sense is something like "peanutmonkey.com". Then you take your external IP and on a DNS server you say "When a request for peanutmonkey.com comes in, send it to this IP". Then a computer at that IP accepts and handles the request. A "Local domain" would be something where a company setups up 500 workstations and wants internal tools to resolve their IPs from their names, but doesn't want the internet to know. So they have internal DNS with domain names that don't exist anywhere outside of the office. – sclarson May 15 '11 at 03:30
  • @sparks. Thanks. Correct me if I am wrong. If I have 500 workstations in my organizations, I take it I would have an internal DNS server that would have an IP address allocated to each host computer so that if I looked for that host computer by name or IP address it would resolve it respectively. Now if I have a mail server in that organization, I would either have an external DNS server pointing to that mail server which could also be hosted in my organization. That external DNS server would point to my mail server via an IP address or domain e.g. mail.contoso.com –  May 15 '11 at 03:45
  • @sparks - Now assuming I have understood it correctly, would I need to name each of my host computers (e.g. 500) with .local e.g.computer1.local, computer2.local, etc –  May 15 '11 at 03:46
  • Thats the general idea. It definitely isn't a "necessary" thing though. Its just the way some people do it. If you're just getting started my suggestion is go to a domain registrat, buy the domain you want, and make a website show up when you go to it. Getting that done should make the whole thing make more sense. – sclarson May 15 '11 at 03:58
  • @sparks - When you say it isn't a `necessary thing` what are you referring to exactly? The naming of computer hosts ending with .local or having a DNS that holds the IP address and records for say mail servers, web servers, etc. –  May 15 '11 at 04:10
  • @sparks. Thanks for all your help. Starting to make a little more sense. –  May 15 '11 at 04:26
  • 11
    As an aside, don't use ".local" as your internal domain name. It's a reserved name for bonjour networking (An apple protocol that's used in more places than you think so saying "I don't have macs so I'm ok" isn't going to help) and as such, Microsoft no longer recommend it. – Rob Moir May 15 '11 at 09:33
  • 3
    One minor point - technically a domain is not considered fully qualified without a trailing . on the end, and the implicitly empty label. Therefore www.google.com. is an FQDN while www.google.com isn't. In practice, most applications (web browsers, mail clients, etc) assume any domain name containing at least one dot is intended to be fully qualified. – Murali Suriar May 15 '11 at 15:32
  • @sparks - what happens in the case when there is no domain part? I.e., `hostname --fqdn` returns the same result as just `hostname`? Should `localhost` simply end in a dot? And is considered well formed when lcaking the domain part? –  Jan 17 '14 at 19:03
  • What if I bought a domain on GoDaddy called sclarson.com, would I put sclarson.local? – user1271772 Mar 25 '21 at 21:13
  • If you buy it on godaddy you just use whatever that godaddy name was. – sclarson Mar 26 '21 at 14:53
8

The hostname is just the computer name and the fully qualified domain name is the hostname plus the domain name after it....

hostname: bigbox fqdn: bigbox.mynetwork.com

or commonly the fqdn ends in .local instead of .com but that is environment specific.

Usually you'd have a private DNS that has your .local domain setup in it and a separate DNS server for the public where your .com lives. You don't want to put your .local domain on a public DNS server because someone will have a way to get a list of all your hosts and it exposes your network to attack.

3

Think of it as 3 parts

Lets say, a university called FIU. (yes it is a real university) in the computer science side, we have a domain cs.fiu.edu

we also have other servers called moodle, which is the hostname of the server.

hostname = moodle
domain name = cs.fiu.edu
FQDN for that server is called moodle.cs.fiu.edu

now, cs.fiu.edu is a branch from the domain, fiu.edu. so hostname = cs domain = fiu.edu FQDN = cs.fiu.edu (which is a seperate server that hosts that) but the domain cs.fiu.edu belongs to our department. Not sure if it makes sense. But there can also be that scenario.

will
  • 41
  • 1