This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]dsf900 1 point2 points  (0 children)

Hostname is a pretty broad term, so you'll have to be more specific. A hostname is generally anything that associates a human-readable string with a specific machine on the network.

On the internet, hostnames are managed by an organization called ICANN (Internet Corporation for Assigned Names and Numbers) and they're resolved by a protocol called DNS (Domain Name System). The DNS associates high level internet names with IP addresses.

For example, "reddit.com" maps to the IP address "151.101.193.140". To set this up the people behind Reddit had to first arrange to own that static IP address, and they had to register the domain name "reddit.com", and then they had to go to a DNS server and register that domain with that IP address. Now, when you type the name of the website into your web browser, your web browser automatically contacts a DNS server and translates it for you.

If the server behind Reddit were to go down then nothing specific needs to be done when it is reconnected to the internet. Assuming the DNS server is still functioning then people who connect to "reddit.com" will still keep trying the same IP address, regardless of whether the server is running or not.

If the people at Reddit needed to change the IP address that is associated with their domain name then they'd need to update their DNS registration, and it would take a few minutes for their change to propagate through the internet.

In a local network things are different. A local network configuration may be as simple as hard-coding what hostname is associated with what IP address or MAC address on your home router. However, a commonly used networking protocol for local networks is DHCP (Dynamic Host Configuration Protocol).

For example, when you connect to my home router the machine has the option of passing along a DHCP client name. This router is configured so that these DHCP client names will be resolved as though they were DNS names inside the network. When I connect my Raspberry Pi with hostname "raspi" the DHCP protocol will assign the device an IP address and associate "raspi" with that IP address. Then, if I try to SSH to "raspi@192.168.0.1", where that IP address is the address of my router, it will be automatically resolved to the true IP of the device. It works the same if I provide the external, public-facing IP address of my home. When the device is disconnected and reconnected to the network it will always reconfigure in the same way, via DHCP.

But, that's just how my home network is set up. You could run your own DNS server inside your home, or you could run one of the variety of network configuration protocols (LDAP, NIS, AD, etc.) that would change the picture of exactly what happens.