Applying firewall rules: iptables-restore: line 1 failed [closed]

I’m trying to do Port forwarding on my centOS machine. When i’m restarting iptables i’m getting the error iptables: Applying firewall rules: iptables-restore: line 1 failed [FAILED].

My iptables file is below

  Firewall configuration written by system-config-firewall
  # Manual customization of this file is not recommended.
  *filter
  :INPUT ACCEPT [0:0]
  :FORWARD ACCEPT [0:0]
  :OUTPUT ACCEPT [0:0]

  -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  -A INPUT -p icmp -j ACCEPT
  -A INPUT -i lo -j ACCEPT
  -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 2181 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 3306 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 5432 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 8020 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 8032 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 8080 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 8088 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 8440 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 8441 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 8887 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 8888 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 9000 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 9933 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 9999 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 10000 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 19888 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 50070 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 50090 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 50470 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 60000 -j ACCEPT
  -A INPUT -m tcp -p tcp --dport 60010 -j ACCEPT
  -A INPUT -j REJECT --reject-with icmp-host-prohibited
  -A FORWARD -j REJECT --reject-with icmp-host-prohibited
  COMMIT

I’m unable to restart iptables. i’m using this command

service iptables start 

(or)

/etc/init.d/iptables restart

Answer

Well, unless you cut-and-pasted it wrong, that first line should also start with a comment. That is, change

Firewall configuration written by system-config-firewall

to

# Firewall configuration written by system-config-firewall

You might want to pay closer attention to that second line, too; there’s nothing wrong with it, but you should probably read it more.

Attribution
Source : Link , Question Author : Jack Daniel , Answer Author : MadHatter

Leave a Comment