Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have few iptables rules which I want to use permanently. So I've installed iptables-persistent and save my rules in /etc/iptables/rules.v4 and /etc/iptables/rules.v6.

Also I turn on autostart for iptables-persistent service

$ sudo update-rc.d iptables-persistent defaults
$ sudo update-rc.d iptables-persistent enable 2345

But after system starts iptables rules are still empty

$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

And when I start iptables-persistent manually, it goes well

$ sudo service iptables-persistent start
 * Loading iptables rules...
 * IPv4...
 * IPv6...

$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source                destination         
DROP       all  --  domain.ru             anywhere            
DROP       all  --  srv246-131.domain.ru  anywhere
etc ...

What am I missing?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The problem is, that iptables-persistent calls iptables-restore during bootup before the network is initialised. Therefore you cannot do dns-lookups at this point.

You either have to use the ip-address instead of a domain name or load the domain-related rules at a later time e.g. via rc.local.

share|improve this answer

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.