这是我修复初始问题后的一个后续问题:我有一个 CENTOS Linux VPS。我的 IPTABLES 脚本中有以下内容,用于在 VPN 重启时运行,但当我执行service firewall restart
我手动运行了下面的每个命令,它们都有效。根据 Host Gator 的说法,为了让 IPTABLES 规则持续存在,我需要将它们放在
/etc/firewall/INCLUDE
这是我的包含文件:
1 iptables -A INPUT -p tcp -m tcp --dport 3000 --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT
2 iptables -A INPUT -i lo -j ACCEPT
3 iptables -A OUTPUT -o lo -j ACCEPT
4 iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
5 iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
6 iptables -A INPUT -p tcp --dport 5622 -m state --state NEW -j ACCEPT
7 iptables -A INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT
8 iptables -A INPUT -p tcp --dport 4643 -m state --state NEW -j ACCEPT
9 iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT
10 iptables -A INPUT -p ICMP --icmp-type 8 -j ACCEPT
11 iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT
12 iptables -I INPUT -p tcp --dport 3000 --syn -j ACCEPT
13 iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 3000
14 iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000
15 iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
16 iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
17 iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
18 iptables -A INPUT -j DROP -p ALL
错误:
DETECTED CONTROL PANEL: cpanel
Reading file /etc/firewall/GLOBAL_DROP
Running file /etc/firewall/INCLUDE
REG INCOMING SERVICES
Reading file /etc/firewall/INPUT
OUTGOING SERVICES
Reading file /etc/firewall/OUTPUT
: command not foundbles-config: line 7:
: command not foundbles-config: line 14:
: command not foundbles-config: line 20:
: command not foundbles-config: line 26:
: command not foundbles-config: line 33:
: command not foundbles-config: line 38:
: command not foundbles-config: line 44:
: command not foundbles-config: line 49:
这是某种间距问题还是空格问题?有什么想法吗?
答案1
HostGator Linux 管理员已修复该问题:据 HostGator 称:
通过移动具有不正确配置选项的文件然后重新启动防火墙,可以更正错误消息:
root@mic [~]# mv -v /etc/sysconfig/iptables-config /root
`/etc/sysconfig/iptables-config' -> `/root/iptables-config'
root@mic [~]# service firewall restart
DETECTED CONTROL PANEL: cpanel
Reading file /etc/firewall/GLOBAL_DROP
Running file /etc/firewall/INCLUDE
REG INCOMING SERVICES
Reading file /etc/firewall/INPUT
OUTGOING SERVICES
Reading file /etc/firewall/OUTPUT
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]