From the course: Linux System Engineer: Authentication with LDAP and Kerberos
Configure hostnames and name resolution
From the course: Linux System Engineer: Authentication with LDAP and Kerberos
Configure hostnames and name resolution
- [Instructor] Now that we know the IP addresses of both our VMs, let's create local name resolution files for them. In rhhost1, open a terminal and type in sudo, space, vi, space, /etc/hosts. We're going to add two lines to this. I'll go into insert mode by pressing the I key, and then go to the end of the file. I'm going to add two lines of this. The first line will start with your rhhost1 IP address. Mine is 192.168.1.19, space, rhhost1.localnet.com, space, rhhost1. On the second line, type in the IP address of rhhost2. In my case, it's 192.168.1.20, space, rhhost2.localnet.com, space, rhhost2. Save this by pressing Escape, : X !, and hitting Enter. While we're in rhhost1, let's also change the host name. Type in sudo, space, hostnamectl, space, set-hostname, space, rhhost1.localnet.com and hit Enter. Note that your prompt will not change until you log out and log back in again. Now, let's press Control + T to create a new snapshot. We will name the snapshot Hosts updated. Now, let's log into our rhhost2 VM and do the same thing. Open a terminal and type in sudo, space, vi, space, /etc/hosts. Once you've added these two lines, press Escape : X !, and hit Enter. You want to make sure that you enter the IP addresses of your rhhost1 and rhhost2. We'll also change our host name for rhhost2. Type in sudo, space, hostnamectl, space, set-hostname, space, rhhost2.localnet.com, and hit Enter. Before we move on, let's create a snapshot. Press right Control + T, and I'm going to name the snapshot Hosts updated and hit Enter. If you're using dynamic IP addresses, as I am, these may change throughout this course. If they do, go back and edit the /etc/hosts files on both VMs and proceed. You can now shut down both VMs if you wish by going out of full screen mode and clicking the Close gadget. Then click on Power off the virtual machine, and make sure Restore current snapshot "Hosts updated" is selected.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.