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

  • 2
    have you save your iptables rules ? # service iptables save or put on your /etc/rc.local
    – chocripple
    Dec 4 '12 at 13:22

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.


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" ...to 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 retentive...run a diff on the two files...the old config in /root/my_iptables_backups and the new file...in /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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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