Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to change iptables to the following

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
REJECT     all  --  anywhere             127.0.0.0/8         reject-with icmp-port-unreachable 
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:www 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:https 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:30000 
ACCEPT     icmp --  anywhere             anywhere            icmp echo-request 
LOG        all  --  anywhere             anywhere            limit: avg 5/min burst 5 LOG level debug prefix `iptables denied: ' 
REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere

When I run the /sbin/iptables-restore < /etc/iptables.up.rules command, I get the following message:

iptables-restore: line 1 failed

Can anyone give me any advice on what to do? Thank you

share|improve this question

2 Answers 2

up vote 1 down vote accepted

What you've posted is the output of iptables -L, and is NOT a valid format for iptables. What you'll want to do is use iptables-save to get a copy of a correctly formatted ruleset.

share|improve this answer
    
Thank you. I figured out that they have to be posted in a different format. –  Victor Sep 3 '10 at 5:06

Can you show us what is at line 1 of /etc/iptables.up.rules? It seems that this file was overwritten to a format that wasn't from /sbin/iptables-save.

The other option is that you you need to use sudo to execute the restore command.

share|improve this answer

Your Answer

 
discard

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