In this lab, you will configure the system host name and name resolution.
Outcomes
Customized host name and name resolution settings.
Reset your serverX system.
View the current host name settings.
Display the current host name.
[student@serverX ~]$hostnameserverX.example.com
Display the host name status.
[student@serverX ~]$hostnamectl statusStatic hostname: n/a Transient hostname: serverX.example.com Icon name: computer Chassis: n/a Machine ID: 9f6fb63045a845d79e5e870b914c61c9 Boot ID: d4ec3a2e8d3c48749aa82738c0ea946a Operating System: Red Hat Enterprise Linux Server 7.0 (Maipo) CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:GA:server Kernel: Linux 3.10.0-97.el7.x86_64 Architecture: x86_64
Set a static host name to match the current transient host name.
Change the host name and host name configuration file. Replace the X with your station number and match the output of the previous step.
[student@serverX ~]$sudo hostnamectl set-hostname serverX.example.com
View the configuration file providing the host name at network start.
[student@serverX ~]$cat /etc/hostnameserverX.example.com
Display the host name status.
[student@serverX ~]$hostnamectl statusStatic hostname: serverX.example.com Icon name: computer Chassis: n/a Machine ID: 9f6fb63045a845d79e5e870b914c61c9 Boot ID: d4ec3a2e8d3c48749aa82738c0ea946a Operating System: Red Hat Enterprise Linux Server 7.0 (Maipo) CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:GA:server Kernel: Linux 3.10.0-97.el7.x86_64 Architecture: x86_64
Temporarily change the host name.
Change the host name.
[student@serverX ~]$sudo hostnametestname
Display the current host name.
[student@serverX ~]$hostnametestname
View the configuration file providing the host name at network start.
[student@serverX ~]$cat /etc/hostnameserverX.example.com
Reboot the system.
[student@serverX ~]$reboot
Display the current host name.
[student@serverX ~]$hostnameserverX.example.com
Add a local nickname for the classroom server.
Look up the IP address of the classroom.example.com.
[student@serverX ~]$host classroom.example.comclassroom.example.com has address 172.25.254.254
Modify /etc/hosts so that the name
class has the IP address 172.25.254.254 and
can be used to communicate with classroom.example.com.
[student@serverX ~]$sudo vim /etc/hosts[student@serverX ~]$cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.25.254.254 classroom.example.com class 172.25.254.254 content.example.com
Look up the IP address of the class.
[student@serverX ~]$host classHost class not found: 2(SERVFAIL)[student@serverX ~]$getent hosts class172.25.254.254 classroom.example.com class
Ping class.
[student@serverX ~]$ping -c3 classPING classroom.example.com (172.25.254.254) 56(84) bytes of data. 64 bytes from classroom.example.com (172.25.254.254): icmp_seq=1 ttl=64 time=0.397 ms 64 bytes from classroom.example.com (172.25.254.254): icmp_seq=2 ttl=64 time=0.447 ms 64 bytes from classroom.example.com (172.25.254.254): icmp_seq=3 ttl=64 time=0.470 ms --- classroom.example.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2000ms rtt min/avg/max/mdev = 0.397/0.438/0.470/0.030 ms