微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

centos – Iptables列表在重新启动时不会持续存在

我试图通过发出以下命令在我的服务器上列出CloudFlare的IP地址:
iptables -N whitelist
iptables -A whitelist -s 204.93.177.0/24 -j ACCEPT
iptables -A whitelist -s 199.27.128.0/21 -j ACCEPT
iptables -A whitelist -s 173.245.48.0/20 -j ACCEPT
iptables -A whitelist -s 103.22.200.0/22 -j ACCEPT
iptables -A whitelist -s 141.101.64.0/18 -j ACCEPT
iptables -A whitelist -s 108.162.192.0/18 -j ACCEPT

当我输入:iptables -L我看到:

Chain whitelist (0 references)
target     prot opt source               destination
ACCEPT     all  --  network/24           anywhere
ACCEPT     all  --  199.27.128.0/21      anywhere
ACCEPT     all  --  173.245.48.0/20      anywhere
ACCEPT     all  --  103.22.200.0/22      anywhere
ACCEPT     all  --  141.101.64.0/18      anywhere
ACCEPT     all  --  108.162.192.0/18     anywhere

然后我通过服务iptables restart重新启动iptables.然而,没有任何改变,它没有列出那些IP :(我错过了什么?

您需要在重新启动之前保存配置.在Redhat系统上,它位于/ etc / sysconfig / iptables中.最简单的方法是:

>发出命令>运行iptables -L来检查配置>运行服务iptables保存>运行service iptables restart重新加载>使用iptables -L再次检查配置

原文地址:https://www.jb51.cc/centos/373362.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。