Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

VirtualBox and CentOS 6, cannot connect to httpd after reboot from host. if I do a

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

then it works but everytime I reboot I have to log in as root and do this. how can I fix this so I dont have to do it after every reboot

share|improve this question
have you save your iptables rules ? # service iptables save or put on your /etc/rc.local –  chocripple Dec 4 '12 at 13:22

2 Answers 2

up vote 2 down vote accepted

As Rikih said - run "service iptables save" after issuing the "iptables -I INPUT ..." command. That will save your ruleset to the /etc/sysconfig/iptables file, which is what is read at startup.

share|improve this answer

I agree with Rikih and John...but the anal retentive part of me says... make a backup directory "mkdir /root/my_iptables_backups" and then "cp /etc/sysconfig/iptables /root/my_iptables_backups" save the present working config. Next run the iptables save command after you make your change (for the VM to work). If you truly want to be anal a diff on the two files...the old config in /root/my_iptables_backups and the new /etc/sysconfig. You should see that one entry. If they are wildly different (and the they should not be), then you could just copy back your backup to /etc/sysconfig and try again.

share|improve this answer

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.