nftables 相关知识

Wiki地址:https://wiki.nftables.org/wiki-nftables/index.php/Main_Page

Centos 8已将iptables替换为nftables,因此是时候学习nftables与iptables之间的差异。

Centos 8中Firewalld守护进程使用nftables作为默认后端,在Centos 7中使用的是iptables作为后端。

nftables主要有三个概念:

  table - 指包含chain的一个容器

  chain - 指包含在一个table里的rule容器

  rule - 指包含在chain里的action

Table

  table语法

    - 待更新

  table语法示例

    - 待更新

Chain

  chain语法

    - 待更新

  chain语法示例

    - 待更新

Rules

  handle is an internal number that identifies a certain rule.

  position is an internal number that is used to insert a rule before a certain handle.

  rule语法

# nft add rule [<family>] <table> <chain> <matches> <statements>
# nft insert rule [<family>] <table> <chain> [position <position>] <matches> <statements>
# nft replace rule [<family>] <table> <chain> [handle <handle>] <matches> <statements>
# nft delete rule [<family>] <table> <chain> [handle <handle>]

  rule语法规则中包含 Matches 和 Statements,因为内容太多,请参考文档 https://wiki.nftables.org/wiki-nftables/index.php/Quick_reference-nftables_in_10_minutes#Rules

  

  rule示例

    - 待更新

猜你喜欢

转载自www.cnblogs.com/vincenshen/p/12333904.html