Difference between revisions of "Configuring tables"

From nftables wiki
Jump to navigation Jump to search
m (Note about flush ruleset vs flush table)
(add page description)
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Some basic operations and commands that you will use to configure tables in the nftables framework.
= Adding tables =
= Adding tables =


Line 38: Line 40:
'''Note:''' ''nft flush table ip filter'' will not flush '''Sets''' defined within that table, and will cause an error if the table to be flushed does not exist and you're using Linux <4.9.0, which you can overcome by flushing the ruleset.
'''Note:''' ''nft flush table ip filter'' will not flush '''Sets''' defined within that table, and will cause an error if the table to be flushed does not exist and you're using Linux <4.9.0, which you can overcome by flushing the ruleset.


==== Flush Ruleset ====
= See also =


Flush your whole configuration, tables sets and all:
More valuable information:


<source lang="bash">
* [[Configuring chains]]
% nft flush ruleset
* [[Operations at ruleset level]]
</source>

Revision as of 12:53, 1 February 2018

Some basic operations and commands that you will use to configure tables in the nftables framework.

Adding tables

% nft add table ip filter

Show/List tables

% nft list tables

Deleting tables

% nft delete table ip foo

Troubleshooting: Since Linux kernel 3.18, you can delete tables and its content with this command. However, before that version, you need to delete its content first, otherwise you hit an error that look like this:

% nft delete table filter
<cmdline>:1:1-19: Error: Could not delete table: Device or resource busy
delete table filter
^^^^^^^^^^^^^^^^^^^

Flushing tables

You can delete all the rules that belong to this table with the following command:

% nft flush table ip filter

This removes the rules for every chain that you register in that table.

Note: nft flush table ip filter will not flush Sets defined within that table, and will cause an error if the table to be flushed does not exist and you're using Linux <4.9.0, which you can overcome by flushing the ruleset.

See also

More valuable information: