4

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?

2

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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