To change the host ...
 
Share:
Notifications
Clear all

To change the host file in RHEL

1 Posts
1 Users
0 Reactions
1,799 Views
 Vk
(@varsharani)
Posts: 35
Eminent Member
Topic starter
 

To change the host file in Red Hat Enterprise Linux (RHEL), you'll typically want to modify the /etc/hosts file. You can do this using a text editor like vi, nano, or gedit. Here's how you can do it using the vi editor:

  1. Open a terminal.
  2. Type the following command to open the /etc/hosts file with vi:
sudo vi /etc/hosts
  1. You'll be prompted to enter your password since you're using sudo to edit a system file.
  2. Once the file is open, you'll see the contents of the /etc/hosts file. It will look something like this:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  1. To add or modify entries, move the cursor to the location where you want to make changes and type in the desired IP address followed by the hostname. For example:
192.168.1.10 example.com
  1. After making the necessary changes, press Esc to exit editing mode, then type :wq and press Enter to save the changes and exit vi.

Once you've saved the changes to the /etc/hosts file, the new configurations should take effect immediately without requiring a system restart. Make sure that the changes you've made are correct to avoid any network issues.

 
Posted : 27/04/2024 9:29 pm
Share: