Convert Host/Domain Name to IP Address
Host Name or Domain Name
There is often confusion about what is a host name and what is a domain name.
A domain name is the name that is purchased from a registrar. It will be something like hcidata.com or hcidata.co.uk. Note that there is no www at the beginning of a domain name. A domain name can be subdivided into sub-domains - for example www.hcidata.com. Once you own a domain, there is no reasonable limit to the number (or names) of the sub-domains you can create. A sub-domain can be allocated to a host machine - for example a PC. In fact many sub-domains can be allocated to the same host machine. The way sub-domains are allocated to a host machine is to create a record in the DNS (Domain Name Servers) that records the sub-domain name and the IP address of the host machine. Any requests for a sub-domain (e.g. www.hcidata.com) are converted to an IP address by DNS and the IP address is used to route the request through the network until it reaches the host machine.
In the early years of the Internet, each sub-domain would have a unique IP address so it was common for a host machine to have only one sub domain name. Nowadays, the common practice is to have many sub-domains with the same IP address. It is also common for the domain name to be converted to the IP address of the host machine that runs the www sub domain.
A host name is the unique name of a machine. When the host operating system is set up it is given a name. This name may reflect the prime use of the machine. For example, a host machine that converts host names to IP addresses using DNS may be called dns.hcidata.com and a host machine that is a web server may be called www.hcidata.com. When we need to find the host name from an IP address we send a request to the host using its IP address. The host will respond with its host name.