Sample Header Ad - 728x90

How to save only specific iptables chains?

6 votes
1 answer
4448 views
I need to configure iptables on a linux machine with running docker containers. If I save iptables rules with iptables-save > /etc/iptables/rules.v4, rules from all chains will be written to file. But I want to save only INPUT, OUTPUT and DOCKER-USER chains, and don't want chains DOCKER, DOCKER-ISOLATION-STAGE-1, etc to be saved, since they contain rules added by docker automatically, which will be irrelevant after reboot. As far as I know, iptables-save can save specific tables, but not specific chains. Currently I consider to combine iptables-save with grep to cut rules from unwanted chains. Is there any better way to achieve same result?
Asked by Marat Safin (161 rep)
Jun 13, 2019, 03:08 PM
Last activity: Jun 13, 2019, 03:44 PM