Hosts: Directions for RHEL/CentOS

Created on 19 May 2018  路  4Comments  路  Source: StevenBlack/hosts

According to this page the way to re-read the hosts file on the above OSes is

$ sudo /etc/init.d/network restart

Can we get this added to the readme?

pull request wanted

Most helpful comment

I'd entertain a pull request on readme_template.md for that.

@StevenBlack : You would also need to update the Python script to add the command.

All 4 comments

Hi Max @nanodeath, I'd entertain a pull request on readme_template.md for that.

Just to clarify the readme instructions, the main focus of the link you provided is to change the hostname of a device and gives instructions to edit two different files, /etc/sysconfig/network and /etc/hosts, as well as issue the hostname command. It then instructs your given command, /etc/init.d/network restart, to be issued "to ensure that changes will persist on restart," but it's not clear if all of the changes need this command or only one or some of them need it to persist on restart. Have you personally tested this and know the answer to this? For the purposes of the readme, this is only relative if the command is required for the changes in /etc/hosts to persist. Again, this is just for clarification so the readme is as clear as possible.

Personally I have not heard of a command needing to be issued for file changes to be persistent other than a command to save the file, but I am not too savvy at Linux distros. Obviously the hosts file must be "re-read" at least every time you start the machine, unless there is a cache file somewhere and this system completely rewrites the standard way of handling the hosts file.

@ScriptTiger : The link provided is a bit of a red herring. The relevant point for this repository is that you need to restart networking to ensure that the host file changes are incorporated.

I'd entertain a pull request on readme_template.md for that.

@StevenBlack : You would also need to update the Python script to add the command.

Was this page helpful?
0 / 5 - 0 ratings