The Wayback Machine - https://web.archive.org/web/20240801183130/https://www.geeksforgeeks.org/introduction-to-host-names/
Open In App

Introduction to Host Names

Last Updated : 06 Oct, 2022
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report

A hostname is essentially a shorthand for a computer or other device attached to a computer network with a unique IP address, which is the physical address of the web server. Computers require names to distinguish one machine from another, just as a name is used to identify a person, a place, or a thing.

Working of Host Name: 

Users typically do not deal with IP addresses but deal with host names. These names are arranged in a hierarchical structure. The naming hierarchy is based on the concept of naming domains. Each domain covers some subset of the entire set of names. At the top level, there are domains corresponding to educational institutions (.edu), commercial entities (.com), public organization (.org), government entities (.gov), etc. There are also top-level domains for countries. Below is shown such a hierarchy.

Each organization gets a name at the second level in the name hierarchy. For example, Geeksforgeeks has geeksforgeeks.org. It is possible to add additional naming levels within an organization, and this is typically done to identify sub-organizations or departments within the larger organization.

Finally, each host (end-system) has a unique name within its department or sub-organization. The complete name of a host includes this name as well as the names of all sub-organization units, the organization name, and the top-level domain. For example, in our Geeksforgeeks organization, we have write.geeksforgeeks.org and contribute.geeksforgeeks.org.

 

Guidelines/Rules for Host Name:

Each element of the hostname must be from 1 to 63 characters long and the entire hostname, including the dots or period(.), can be at most 253 characters long. Valid characters for hostnames are 

  • letters from a to z
  • the digits from 0 to 9
  • the hyphen (-)
  • can’t start with a hyphen.

Host Name and Domain Name:

A hostname is a domain name given to the host. It’s a human-readable nickname that is associated with a corresponding MAC or physical address which is unique for every device. Although the terms “hostname” and “domain name” are frequently used interchangeably, they have a small difference in them. All hostnames are domain names, but not all domain names are hostnames. Domain names make IP addresses more human-friendly.

Host Name Domain Name
A hostname is the name of the device or computer connected to the network.  A domain name is the address of the website to access the website by the user. 
This name or label is used to distinguish between two devices on the network. It is the alternative to the IP addresses which are quite human friendly instead of IP addresses.
All hostnames are the domain name. Not all domain names are hostname.
The hostname must contain characters ‘a’ through ‘z’ and for digits, it should be ‘0’ through ‘9’ and it can contain the hyphen (-). Domain names are composed of a series of labels, each separated by a dot.

Similar Reads

HTML DOM Location host Property
The Location Host property in HTML is used to sets or return the hostname and port of a URL. The Location Hash property doesn't return the port number if it is not specified in the URL. Syntax: It returns the host property. location.hostIt is used to set the host property. location.host = hostname:portProperty Value: hostname:port: It contains a st
1 min read
Node.js URL.host API
The url.host is an inbuilt application programming interface of class URL with in url module which is used to get and set the host portion of the URL. Syntax: const url.host Return value: It gets and sets the host portion of the URL.Below programs illustrates the use of url.host Method:Example 1: C/C++ Code // node program to demonstrate the // url
1 min read
Node.js urlObject.host API
The utilities for URL resolution and parsing is provided by the URL module. A URL string is a structured string that contains various multiple meaningful components. When parsed, a URL object is returned that contains properties for each of these components. url.host() return the host name in the url as a string. Examples: http://localhost:8080/reg
1 min read
HTML DOM Area host Property
The DOM Area host Property in HTML DOM is used to set or return the hostname and port part of the href attribute value. Syntax: It returns the Area host property. areaObject.hostIt is used to set the Area host property.areaObject.host = hostname:port Property Values: It contains a single value hostname: port which specifies the hostname and port nu
2 min read
Host Data Safeguarding
Hosts include clients and servers that send or receive data or services. It is essential to protect host data because an organization can lose data if cyber criminals steal it or device fails. Few methods to protect host data are given below: Encryption: Encryption changes data using a complicated algorithm to make it unreadable. A special key retu
2 min read
HTTP headers | Host
The HTTP Host represents the domain name of the server. It may also represent the Transmission Control Protocol (TCP) port number which the server uses. Defining the port number is optional, the default value is considered. For example, "80" is assigned as the port number for an HTTP URL when there is no port number specified. The HTTP Host header
1 min read
HTTP header X-Forwarded-Host
The HTTP X-Forwarded-Host header is a request-type header de-facto standard header. This header is used to identify the original request made by the client. Because the hostnames and the ports differ in the reverse proxies that time this header took the leader and identify the original request. This header can also be used for debugging, creating l
1 min read
How to Host a Local Server globally for more than one system ?
Often it has been a problem of hosting a local server for more than one system. For Professionals, it is easy to host on AWS on any other service but for the students who are new and are in search of an alternative to host a local server on the internet to be used on more than one computer, here is the answer. When a local server is hosted on any s
2 min read
How to style the host element of the component in AngularJS ?
In this article, we will see how to style the host element of the component in AngularJS, along with knowing the basic implementation through the examples. This task can be accomplished by implementing the ng-style directive with the element. CSS properties help in the styling of the component. Approach: Styling of host components uses CSS properti
2 min read
How to extract the host name from URL using JavaScript ?
To extract the hostname portion from a URL, we can use the location object that represents information about the current URL. It is the element of the window object and a client-side object. Syntax: window.location.propertyname Example 1: In this example, we will use the self URL, where the code will run to extract the hostname. C/C++ Code <!DOC
1 min read
three90RightbarBannerImg