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.

DO NOT USE THE FOLLOWING CHARACTERS ANYWHERE IN YOUR HOSTNAME!

"."

"_"

 

 

Step 1. Check if hostname is resolvable

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

# hostname
training

# 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:192.168.56.250 Bcast:192.168.56.255 Mask:255.255.255.0
              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 192.168.56.250. Add an entry in the /etc/hosts file so that it looks like this:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.250 training

Step 3. Check if hostname is resolvable

# ping `hostname`
PING training (192.168.56.250) 56(84) bytes of data.
64 bytes from training (192.168.56.250): icmp_seq=1 ttl=64 time=0.015 ms
64 bytes from training (192.168.56.250): icmp_seq=2 ttl=64 time=0.029 ms
64 bytes from training (192.168.56.250): icmp_seq=3 ttl=64 time=0.039 ms
^C
--- 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 support@cafex.com.

Have more questions? Submit a request

Comments

Powered by Zendesk