Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To enable port 7070 on my server I've run

iptables -A INPUT -p tcp -m tcp --dport 7070 -j ACCEPT

through SSH and then

service iptables save

which saved rules to /etc/sysconfig/iptables file.

However, when I reboot the server, saved rule is not applied. How can I auto-apply this rule when server restarts?

share|improve this question
up vote 2 down vote accepted

This will list state of iptables startup:

chkconfig --list iptables

"Standard" configuration looks like this:

iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off

This command set up the defaults:

chkconfig --level 2345 iptables on

If it did not help that there is something wrong with Your OS.

One more thing to try. Please input this command:

iptables -I INPUT -p tcp -m tcp --dport 7070 -j ACCEPT

(-A is replaced with -I - this will add this rule to the begining of the input chain) Save iptables state one more time and please test if that helped.

share|improve this answer
Can you explain what you meant? What chkconfig --level 2345 iptables on is supposed to do ? because before and after I run this command chkconfig --list iptables still returns iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off – Stephane Kouakou Apr 1 '13 at 12:50
chkconfig - updates and queries runlevel information for system services - simply speaking chkconfig is used for setting which service should be start automaticaly (at system startup). You can also use "ntsysv" command (if there is no such command installed - yum install ntsysv). – RJS Apr 1 '13 at 13:02
chkconfig --list - list all services and their state (start/stop levels). chkconfig --level 2345 iptables on - tells that iptables script (from /etc/init.d/iptables) should be started at startup levels 2,3,4 and 5. /etc/init.d/iptables read it's config from file /etc/sysconfig/iptables. – RJS Apr 1 '13 at 13:03
well but my issue is it doesnt load /etc/sysconfig/iptables on startup so I run your command and it's still not loading config – Stephane Kouakou Apr 1 '13 at 13:10
see my edits in the above answer. And after restart please attach "iptables -L -n" output in your question – RJS Apr 1 '13 at 13:14

Your Answer


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.