error in ip tables configuration

Posted on 2009-04-11
Last Modified: 2013-11-16
somehow I managed to mess up my ip-tables config. I get this error when I try to restart iptables,

[root@tktdgt ~]# service iptables restart
: 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:
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: mangle filter             [  OK  ]
[root@tktdgt ~]#

My file is below, it looks fine to me.

# Load additional iptables modules (nat helpers)

#   Default: -none-

# Space separated list of nat helpers (e.g. 'ip_nat_ftp ip_nat_irc'), which

# are loaded after the firewall rules are applied. Options for the helpers are

# stored in /etc/modules.conf.



# Unload modules on restart and stop

#   Value: yes|no,  default: yes

# This option has to be 'yes' to get to a sane state for a firewall

# restart or stop. Only set to 'no' if there are problems unloading netfilter

# modules.



# Save current firewall rules on stop.

#   Value: yes|no,  default: no

# Saves all firewall rules to /etc/sysconfig/iptables if firewall gets stopped

# (e.g. on system shutdown).



# Save current firewall rules on restart.

#   Value: yes|no,  default: no

# Saves all firewall rules to /etc/sysconfig/iptables if firewall gets

# restarted.



# Save (and restore) rule and chain counter.

#   Value: yes|no,  default: no

# Save counters for rules and chains to /etc/sysconfig/iptables if

# 'service iptables save' is called or on stop or restart if SAVE_ON_STOP or

# SAVE_ON_RESTART is enabled.



# Numeric status output

#   Value: yes|no,  default: yes

# Print IP addresses and port numbers in numeric format in the status output.


Open in new window

Question by:JPERKS1985
LVL 76

Accepted Solution

arnold earned 500 total points
ID: 24122672
Post the contents of /etc/sysconfig/iptables*

Expert Comment

by:Morne Lategan
ID: 24123080
Did you edit the file in dos? If so, run

dos2unix -p /path/to/file

It seems its complaining about all the blank lines

Author Comment

ID: 24123817
no more errors but it will not start

Setting chains to policy ACCEPT: mangle filter             [  OK  ]
[root@tktdgt ~]# service iptables start
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: mangle filter             [  OK  ]
[root@tktdgt ~]# service iptables status
Firewall is stopped.
[root@tktdgt ~]#
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

LVL 76

Expert Comment

ID: 24124004
run iptables -L
chkconfig --list iptables

What do you have for the above?

Author Comment

ID: 24124090
[root@tktdgt ~]# run iptables -L
-bash: run: command not found
[root@tktdgt ~]# chkconfig --list iptables
iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off
LVL 76

Expert Comment

ID: 24124353
iptables -L
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24568308
Remove run execute only iptables -L

If seems that you're running over RedHAT / CentOS . The default configuration is in /etc/sysconfig/iptables

If the code sniipet belongs to this file it is normal that you have nothing because your file does not contain any rules for firewall.


Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now