Many of the servers in our environment have their loop-back line in /etc/hosts
configured like so:
127.0.0.1 mydevserver.testdomain.com mydevserver localhost.localdomain localhost
Normally, this is not an issue. However, we are now dealing with some external software from a vendor that calls gethostbyaddr and their installer is designed to fail if the result of hostname --ip-address
is 127.0.0.1. This of course causes it to fail on our systems because the servers hostname is in the loopback line of /etc/hosts
.
My question is, if I wrap the installer in a bash or perl script, is there a way to "mask" or temporarily alter the results of hostname --ip-address
without changing the /etc/hosts file?
(Clarification: They are calling the gethostbyaddr() function from within their compiled binary installer. The way to get a similar result from command line is hostname --ip-address
)