Faced with the problem when you do not ping the erlang-node on some server that is running two epmd. And running two of them, because one runs the project (at the start erl), and the second starts ejabberd.

Symptoms resemble a problem with firewall:

(test2@127.0.0.1)1> net_adm:ping('test1@127.0.0.1').
pang

See ps ax:

ps ax | grep epmd
root     1212   ... /usr/local/lib/erlang/erts-5.9.3.1/bin/epmd -daemon
root     1515   ... /usr/local/bin/epmd -daemon

And if you execute kill 1212 1515 and run again erl, it will be pinged:

(test2@127.0.0.1)1> net_adm:ping('test1@127.0.0.1').
pong

Additional symptoms I described on Stack Overflow.

Solution

Open for editing /etc/rc.conf:

ejabberd_enable="YES"
epmd_enable="YES"

And in /usr/local/etc/rc.d/epmd adding:

start_precmd=epmd_prestart
epmd_prestart() {
    `ps ax | grep epmd | awk '{ print $1}' | xargs kill`
    return 0
}

We have to use a hack, because I could not find how to get ejabberd not to launch epmd.