问题原文
原帖链接 · user1463822 · CC BY-SA 3.0
Problem: iptables resets to default settings after server reboot.
I'm trying to set rule like this:
iptables -I INPUT -p tcp --dport 3000 -j ACCEPT
after that I do:
service iptables save
and it writes back something like this
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
and after this I just ran (this was done once):
chkconfig iptables on (I have read that this has to be done in order to restore settings after reboot)
After that I reboot and run this command:
systemctl list-unit-files | grep iptables
and I see that iptables.service is enabled, however, the rule (to open port 3000) does not work anymore.
How do I persist these settings?
已采纳解答
原帖链接 · sgohl · CC BY-SA 4.0
CentOS 7 is using FirewallD now! Use the --permanent flag to save settings.
Example:
firewall-cmd --zone=public --add-port=3000/tcp --permanent
Then reload rules:
firewall-cmd --reload
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
