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 77

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 ~]#
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

LVL 77

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 77

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle 12c patching 1 61
Linux/Apache File Ownership/Permissions 1 54
curl SSL certificate unable to get local issuer certificate 15 21
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
To setup a SonicWALL for policy based routing to be used with the Websense Content Gateway there are several steps that need to be completed. Below is a rough guide for accomplishing this. One thing of note is this guide is intended to assist in the…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

863 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

26 Experts available now in Live!

Get 1:1 Help Now