The format for the files generated by iptables-save/ip6tables-save and loadable through iptables-restore/ip6tables-restore stipulates that one can prepend -4 or -6 respectively so as to maintain the rules for IPv4 and IPv6 in the same single file.

The lines with -4 are ignored by ip6tables-restore and the ones with -6 are ignored by iptables-restore.

Now, this seems only to apply to rules. How can I create a chain (:CHAINNAME -) only for either stack?

That is, if I have something like (excerpt):

:ICMPv6 -
-6 -A INPUT -p icmpv6 -j ICMPv6

how can I make sure that the chain is only created for the IPv6 stack but not the IPv4 stack?

Is this at all possible?

Your Answer

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

Browse other questions tagged or ask your own question.