2

I have two redhat 6.3 machines, BOTH have no changes in /etc/hosts (ie. I have not added an ip address to them). On of my machines can run getLocalhost fine AND return the hostname a.domain.com. The other one fails with UnknownHostException.

Previously, I always added ip to /etc/hosts, but I am wondering why this one machine does not needs that. The /etc/nsswitch.conf on both machines has "hosts: files dns" so that is the same on both machines.

There is a big difference on the /etc/sysconfig/network-scripts/ifcfg-eth0 scripts. The node that gets UnknownHostException is something like this

DEVICE="eth0"
BOOTPROTO="static"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR=10.10.1.5
PREFIX=23

The one that works has something like this...

DEVICE="eth0"
HWADDR="AA:AA:AA:AA:3F:A8"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
IPADDR=10.10.1.2
PREFIX=23
GATEWAY=10.10.1.1
DNS1=10.20.100.100
DNS2=10.20.100.101
DOMAIN="domain.com sub.domain.com"

Could this somehow be the cause? or what other files can I look at to see why this is not working? I assume java is making some linux getLocalHost api call into the machine to get the hostname.

thanks, Dean

1 Answer 1

1

ah, I stumbled upon the difference. In my /etc/sysconfig/network file, I had the FQDN on the working machine but on the other machine, I only had the hostname "b" so changing that to "b.domain.com" fixed the issue and I don't need to modify my /etc/hosts file at all!!!!

Dean

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.