Hi,
According to my findings, the following applies to any release of RHEL/OL 5/6 or 7:
[root@localhost ~]# hostname
localhost.localdomain
[root@localhost ~]# hostname -f
localhost
[root@localhost ~]# dnsdomainname
[root@localhost ~]#
Shouldn't FQDN (-f) and hostname be the other way around?
Also, dnsdomainname returns nothing.
The fix, under release 7 is relatively simple:
1. Set the hostname to "localhost" (/etc/hostname)
[root@localhost ~]# hostnamectl set-hostname localhost
This fixes "hostname" but does not fix the domain name.
2. Correct /etc/hosts
From:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
To:
127.0.0.1 localhost.localdomain localhost.localdomain4 localhost4 localhost
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
By simply moving "localhost" to the end the line and changing /etc/hostname to localhost, the previous commands now produce the wanted results:
[root@localhost ~]# hostname
localhost
[root@localhost ~]# hostname -f
localhost.localdomain
[root@localhost ~]# dnsdomainname
localdomain
Interestingly, apparently the last OS release where /etc/hosts uses the same format was OS release 5, e.g.:
[root@vm501 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
10.0.50.1 vm501.example.com vm501
This may not sound like a big deal but it screwed up the Oracle database 18c installation.
[grid@localhost ~]$ hostname
localhost.localdomain
[grid@localhost ~]$ lsnrctl status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
The result is that the server does not allow remote sqlplus connections. Why this worked in previous versions, I don't know.
In one of my previous posts: Net Listener documentation about IP purpose in 12c/18c vs. 11g,
I outlined the the following has been removed from the documentation in 18c: (no response)
If the user specifies a host name for the HOST
parameter in the ADDRESS line of the listener.ora
file,
the listener listens on IN_ADDR ANY
in case the host name is default host name.
... which means when hostname and host entry are the same, the listener will listen on all interfaces and hence also accept remote connections.
After changing the hostname from localhost.localdomain to localhost, the listener no longer starts.
[grid@localhost ~]$ hostname
localhost.localdomain
[grid@localhost ~]$ lsnrctl status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
[root@localhost ~]# hostnamectl set-hostname localhost
[grid@localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 18.0.0.0.0 - Production on 12-APR-2019
TNS-12537: TNS:connection closed
TNS-12560: TNS:protocol adapter error
TNS-00507: Connection closed
Linux Error: 29: Illegal seek
Having localhost at the end of the line in /etc/hosts seems to work, but there is definitely something else wrong.
.... I'm still trying to find out what it is.
What's the story here? Has the resolving of localhost.localdomain always been incorrect, or am I mistaken?