Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to run a java application on my EC2 instance. The application accepts socket connections on port 54321. If I try and connect to it, it times out. My Security Group is set as:

TCP Port (Service)  Source  Action 
21  0.0.0.0/0   Delete 
22 (SSH)    0.0.0.0/0   Delete 
80 (HTTP)   0.0.0.0/0   Delete 
20393   0.0.0.0/0   Delete 
54321   0.0.0.0/0   Delete

Is there anything else I need to do?

# iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
# iptables -nvL -t nat
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
# 
share|improve this question
    
Is there a firewall running in the instance itself? (Paste the output of iptables -nvL and iptables -nvL -t nat if you're not sure.) –  mgorven Apr 25 '12 at 16:58
    
@mgorven Added to the question. –  Joseph Apr 25 '12 at 17:05
    
What version of linux is your EC2 instance? Do you have SELinux installed/enabled? Not sure if you need to run IPTables since the EC2 firewall can protect you. –  djangofan Apr 25 '12 at 20:29
1  
@Joseph are you sure the app is listening to the outside? do a netstat -tlpn |grep 54321 and see if you see 0.0.0.0:54321 in the output –  LinuxDevOps Apr 13 at 22:35

1 Answer 1

I've just had this exact same problem. I was running a RHEL instance, and it's been bugging me for a while.

Anyway, the solution, thanks to @mgorven (in the OP comments) for pointing me in the right direction, is to turn off the Linux firewall, thus:

[root@myserver ~]$ service iptables stop

This will shut the firewall down, but you also need to ensure that it does not turn itself back on with the next reboot:

[root@myserver ~]$ chkconfig iptables off

This solved my problems - hopefully it will solve your issue.

HTH

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.