I'm trying to establish a way to configure my servers' hostnames in a centralized way, that is, from some service on the network that does it.
I know there are three names that identify a server...
- Transient: Received from network configuration;
- Static: Provided by the kernel;
- Pretty: Provided by the user.
So I wanted my CentOS 7/8 server to use transient hostname as its name. In a practical way, that when logging in the terminal it shows me the name that was obtained from the network...
[user_name@my-net-hostname ~]$
... and that the machine can at least identify itself by name...
[user_name@my-net-hostname ~]$ ping -c 4 my-net-hostname
PING my-net-hostname.my.domain (10.3.0.4) 56(84) bytes of data.
64 bytes from my-net-hostname.my.domain (10.3.0.4): icmp_seq=1 ttl=64 time=0.193 ms
64 bytes from my-net-hostname.my.domain (10.3.0.4): icmp_seq=2 ttl=64 time=0.086 ms
64 bytes from my-net-hostname.my.domain (10.3.0.4): icmp_seq=3 ttl=64 time=0.077 ms
64 bytes from my-net-hostname.my.domain (10.3.0.4): icmp_seq=4 ttl=64 time=0.098 ms
--- my-net-hostname.my.domain ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 0.077/0.113/0.193/0.046 ms
NOTE: In the case above this hostname was defined in a DHCP and there is also a DNS that knows the name "my-net-hostname".
NOTE: It seems to me that the correct way to do this is with a DHCP and a DNS, that is, one defines the server name (hostname) and the other defines where to find this server, but I'm having difficulty confirming this information.
QUESTION: How can I configure the hostnames of my servers from services on the network? What should I use? A DHCP? A DNS? Both?
Thanks! =D
[Ref(s).: https://askubuntu.com/questions/104918/how-to-get-the-hostname-from-a-dhcp-server , https://codingbee.net/rhcsa/rhcsa-configuring-hostnames-and-dns , https://www.redhat.com/sysadmin/set-hostname-linux ]