Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm new in Linux and encountered with problem with iptables.

Here is content of /etc/sysconfig/iptables file

# Generated by iptables-save v1.4.7 on Tue Nov 27 21:41:04 2012
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [40672:2356787]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 
-A INPUT -p icmp -j ACCEPT 
-A INPUT -i lo -j ACCEPT 
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT 
-A INPUT -j REJECT --reject-with icmp-host-prohibited 
-A FORWARD -j REJECT --reject-with icmp-host-prohibited 
COMMIT
# Completed on Tue Nov 27 21:41:04 2012

But when I try "sudo iptables -L -n -v -x" I have following output:

Chain INPUT (policy ACCEPT 261172 packets, 1040204290 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 522761 packets, 2080465034 bytes)
    pkts      bytes target     prot opt in     out     source               destination  

Why doesn't the rules from /etc/sysconfig/iptables displayed in output?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

Why iptables does not fetch information from /etc/sysconfig/iptables on centOs?

Because Iptables service not enable in startup.

You can check using :

chkconfig --list iptables

When Iptables service get start, it load rules from /etc/sysconfig/iptables using :

iptables-restore /etc/sysconfig/iptables

So check Iptables Service is Running or not :

sudo /etc/init.d/iptables status
share|improve this answer
    
thanks a lot! startig a service helps me. –  V. Artyukhov Aug 30 '13 at 12:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.