How to make hostname resolvable

CafeX Fusion Application Server is built on the JBoss application server. JBoss requires that the hostname of the host is resolvable. This article explains how to make sure that is the case.






Step 1. Check if hostname is resolvable

This can be done with a combination of the ping and hostname commands as follows:

# hostname

# ping `hostname`
ping: unknown host training

Note the use of back quotes in the ping command above to substitute the output of the hostname command as an argument for the ping command. 

Step 2. Add entry to /etc/hosts for hostname

To get the IP address of the host use the ifconfig command. Note that there might be multiple interfaces each with its own IP address. It should not matter which one you chose.

# ifconfig
eth0        Link encap:Ethernet HWaddr 08:00:27:A7:33:99
              inet addr: Bcast: Mask:
              inet6 addr: fe80::a00:27ff:fea7:3399/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
              RX packets:142796 errors:0 dropped:0 overruns:0 frame:0
              TX packets:29438 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:180062646 (171.7 MiB) TX bytes:5724444 (5.4 MiB)

The IP address from the above example is Add an entry in the /etc/hosts file so that it looks like this: localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 training

Step 3. Check if hostname is resolvable

# ping `hostname`
PING training ( 56(84) bytes of data.
64 bytes from training ( icmp_seq=1 ttl=64 time=0.015 ms
64 bytes from training ( icmp_seq=2 ttl=64 time=0.029 ms
64 bytes from training ( icmp_seq=3 ttl=64 time=0.039 ms
--- training ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2737ms
rtt min/avg/max/mdev = 0.015/0.027/0.039/0.011 ms

Ctrl-c to stop the ping command.



Comments are disabled on these articles if you require help contact

Have more questions? Submit a request