Cannot connect to the my ejabberd server. Connection Timeout

I am working on an EC2 instance with Static ip and am trying to connect to my ejabberd server installed on the same box.
I am also using xmpp4r and the problem i am facing is when I try to connect to the server with a client the connection times out.

Code snippet
client.connect
RESOLVING:
_xmpp-client._tcp.jabber.xxxxxxx.com (SRV)
CONNECTING:
jabber.xxxxxxx.com:5222
Errno::ETIMEDOUT: Connection timed out - connect(2)
from /usr/lib/ruby/gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/connection.rb:66:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/connection.rb:66:in `new'
from /usr/lib/ruby/gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/connection.rb:66:in `connect'
from /usr/lib/ruby/gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:70:in `connect'
from (irb):6

Im not sure why this is happening and there are no errors in my log.
#ejabber.log

=INFO REPORT==== 2010-07-15 10:21:25 ===
I(<0.302.0>:ejabberd_listener:116) : (#Port<0.464>) Accepted connection {{120,61,34,11},40322} -> {{10,193,127,228},5280}

=INFO REPORT==== 2010-07-15 10:21:25 ===
I(<0.295.0>:ejabberd_http:123) : started: {gen_tcp,#Port<0.464>}

=INFO REPORT==== 2010-07-15 10:21:26 ===
I(<0.302.0>:ejabberd_listener:116) : (#Port<0.465>) Accepted connection {{120,61,34,11},40323} -> {{10,193,127,228},5280}

=INFO REPORT==== 2010-07-15 10:21:26 ===
I(<0.295.0>:ejabberd_http:123) : started: {gen_tcp,#Port<0.465>}

but no connections to 5222.

My jabber server runs on a subdomain jabber.xxxxxx.com and points the site ip. I have setup ejabberd before without any issues on similar EC2 Ubuntu instances but im completely lost now. I have tried reinstalling ejabberd too.

Thanks in advance for your help.

Sid

Figured it out

Its actually an EC2 security groups issue. You need to ensure if the instance security groups has the port 5222 open. If your working with Server-2-Server then you should have 5269 open too.

The way to get that done on elastic fox is click on the security groups click on the group permissions, grant permission button (green tick button) and add the port. For host add 0.0.0.0/0 to allow all.

And thats it. Hope this is useful to someone.

Syndicate content