Allowing a specific port in iptables :
The general form of the rule is :
-A INPUT -i <interface> -p <protocol> --dport <port> -j ACCEPT
-I INPUT <rule no.> -i <interface> -p <protocol> --dport <port> -j ACCEPT
Rule no : The index of the chain where you want to add this rule.
Interface : the interface you wont this rule to apply for, don't specify if you want for all, eg eth0, lo. You may want to specify eth0.
Protocol : which protocol you want it for, tcp/udp. TCP in your case
Port : the port no. you want it to apply to. In your case 8080
Make sure it this rule is before an drop all other packets rule.
The reason you statement is not working is probably because you have specified the interface as
lo instead of
To make the rules permanent :
If you just add this rule using the command line, the rule will be discarded when you restart, because the iptables will be loaded again from
/etc/sysconfig/iptables. So if you want to make it permanent, you have two choice.
iptable-save > /etc/sysconfig/iptables
This will save the iptables configuration to the iptables file, from which it will be read when you restart your pc. But in case you have manually edited that file to add comments those will be lost.
Manually edit the
/etc/sysconfig/iptables file to add this rule to the correct chain. This ensures that comments put in by you are preserved.
PS : You may need to find the location of your iptables file and the interface name and make changes accordingly.