How to Configure Hostname and /etc/hosts on a DHCP Server
To change the hostname and modify the '/etc/hosts' file, follow these steps:
-
Open a terminal or SSH into the DHCP server.
-
Edit the hostname file using the command: sudo nano /etc/hostname
Replace the current hostname with the desired hostname and save the file.
-
Edit the hosts file using the command: sudo nano /etc/hosts
Update the entry for the current hostname with the new hostname. For example, if the current entry is: 127.0.0.1 oldhostname change it to: 127.0.0.1 newhostname
Save the file.
-
Restart the DHCP server for the changes to take effect. The command to restart the DHCP server depends on the specific DHCP server software you are using. For example, if you are using ISC DHCP, you can restart it with the command: sudo systemctl restart isc-dhcp-server
Replace 'isc-dhcp-server' with the appropriate service name for your DHCP server software.
After following these steps, the DHCP server should have the new hostname configured and the '/etc/hosts' file updated accordingly.
原文地址: http://www.cveoy.top/t/topic/o2Jx 著作权归作者所有。请勿转载和采集!