在服务防火墙重新启动时,以ACCEPT或DROP结尾的IPTABLES命令失败

我有CENTOS Linux VPS。 我的IPTABLES脚本中有以下内容,当我的VPN重新启动时运行,但在执行service firewall restart时出现错误

我已经运行了下面的每个命令手动,他们的工作。 根据主机鳄鱼为了IPTABLES规则坚持我需要把他们放在

 /etc/firewall/INCLUDE 

文件,所以我将这些命令插入到文件中,但是执行service firewall restart命令时,以ACCEPT或DROP结尾的命令会给出错误信息。

这是我的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 

错误:

 Running file /etc/firewall/INCLUDE 'ptables v1.4.7: Invalid target name `ACCEPT Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `ACCEPT Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `ACCEPT Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `DROP Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `ACCEPT Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `ACCEPT Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `ACCEPT Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `ACCEPT Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `ACCEPT Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `ACCEPT Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `ACCEPT Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `ACCEPT Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `DROP Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `DROP Try `iptables -h' or 'iptables --help' for more information. 'ptables v1.4.7: Invalid target name `DROP Try `iptables -h' or 'iptables --help' for more information. 

如何修复命令,以便在重新启动防火墙时接受它们?

我想我已经find了答案:每个换行符后面都有^ M个字符。 我相信如果我删除它们的命令将工作。 我正在使用VIM,如果我在vim中通过执行':e ++ ff = unix'来查看它们,它会在每个换行符后显示'^ M'。