Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running a VmWare with an application under JBoss starting up on port 8080. I'm able to access the app from outside the VM if the iptables are off.

However, I must turn on iptables due to some rules, but I couldn't open port 8080. I tried: -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT and -A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT but no success.

Output of netstat -tulpn with iptables rule:

Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 6617/java

What am I missing here?

Thanks!

share|improve this question
add comment

1 Answer

You have probably APPENDED the rule to the table after a policy that denies access. You should try INSERTING the rule. The difference is replacing -A INPUT with -I INPUT, so the command would be

-I INPUT -p tcp -m tcp --dport 8080 -j ACCEPT 

Another possibility (not sure where you have specified the rule) is that you need to modify the FORWARD chain rather then the input chain - if this rule exists on the VM host rather then the VM.

share|improve this answer
    
It's not working yet, when I execute service iptables save it's going to /etc/sysconfig/iptables. This is what I got now: [root@devsrvr ~]# more /etc/sysconfig/iptables *nat :PREROUTING ACCEPT [0:0] :POSTROUTING ACCEPT [23:1780] :OUTPUT ACCEPT [23:1780] -A PREROUTING -d 172.17.38.10 -p tcp -j DNAT --to-destination 192.168.38.129 COMMIT *filter :INPUT ACCEPT [151:22125] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [275:33909] -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT COMMIT –  Adami Sep 2 '13 at 12:43
    
I've just found out that the rule iptables -t nat -A PREROUTING --dst 172.17.38.10 -p tcp -j DNAT --to-destination 192.168.38.129 is doing that. Any idea of how can I have that rule and also access through port 8080? –  Adami Sep 2 '13 at 13:18
    
As your default policies all appear to be "ACCEPT", I can't see any reason why this is not working. I'm guessing you have dropped the rest of the firewall and it works now ? If so, what does it look like with the Firewal on ? If the firewall is meant to be like this, what does the firewall on the VM show ? –  davidgo Sep 2 '13 at 20:21
add comment

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.