Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a network device hostname determined by the device itself or a network admin?

I have a local network with several PCs and specialized controllers on it. These specialized controllers must be configured with static IP addresses and do not have DHCP capabilities.

I was asked to put together a list of the device hostnames and IP addresses. It's easy to figure out the IP address of each device, however, I'm struggling to find out the host name for these specialized controllers. If it were a Windows PC, I would simply navigate some menus to find the host name.

I'm confused about how the host name is configured for network devices in general. For Windows PCs, it seems like the PC itself determines its own host name. When it joins a network, it simply broadcasts its host name to a DNS server and the DNS server remembers it. For devices that are not DHCP, it seems like I would need to manually go to a DNS server and enter the host name for the specific IP address.

So what exaclty determines the host name? The device itself or a network admin?

like image 463
Izzo Avatar asked Oct 16 '22 09:10

Izzo


1 Answers

This more of networking question and belongs to ServerFault - you will get your answer faster there.

If it were a Windows PC, I would simply navigate some menus to find the host name.

What kind of system is there if there is no Windows? Linux, *BSD, AIX, other? I'll answer for Linux for now.

So what exactly determines the host name? The device itself or a network admin?

This depends on your configuration in Linux check - /etc/nsswitch.conf e.g.

hosts:          files dns

Which defines that the hostname will be defined by /etc/hosts and if it is not found there it will check DNS next.

If hosts file, the local resolution, contains the pair ip <-> name it is used. If the DNS takes precedence and it contains the pair it is taken from there. As shown above, it can contain both at once in defined order, then the resolution is done in that order.

By the way, DHCP server can give you static IP addresses based on your MAC address so your controllers will have always the same IP address, if same network card is used. It is way easier to manage than configure all servers manually.

like image 60
tukan Avatar answered Oct 21 '22 01:10

tukan