nftables 是新的数据包分类框架,新的linux防火墙管理程序,旨在替代现存的 {ip,ip6,arp,eb}_tables,在 Linux 内核版本高于 3.13 时可用。提供一个新的命令行工具 nft,语法与 iptables 不同。
常用参数:
-h, --help 显示帮书
-v, --version 显示版本信息
-c, --check 检查命令的有效性,而不实际应用更改。
-f, --file <filename> 包含文件内容<filename>
-i, --interactive 从命令行读取输入
-j, --json 以JSON格式化输出
-n, --numeric 指定一次后,以数字方式显示网络地址(默认行为)。指定两次以数字方式显示Internet服务(端口号)。指定三次以数字方式显示协议,用户ID和组ID。
-s, --stateless 省略规则集的有状态信息
-N 将IP地址转换为名称。
-a, --handle 显示规则句柄handle
-e, --echo Echo what has been added, inserted or replaced.
-I, --includepath <directory> 添加<directory>目录到包含文件的搜索路径中。默认为: /etc
--debug <level [,level...]> 添加调试,在level处(scanner, parser, eval, netlink, mnl, proto-ctx, segtree, all)
[root@centos8 ~]#nft list tables [root@centos8 ~]#vim /etc/sysconfig/nftables.conf #删除此行前的注释 include "/etc/nftables/inet-filter.nft" [root@centos8 ~]#systemctl restart nftables.service [root@centos8 ~]#nft list tables table inet filter #默认为ip簇,无规则 [root@centos8 ~]#nft list table filter Error: Could not process rule: No such file or directory list table filter ^^^^^^ [root@centos8 ~]#nft list table inet filter table inet filter { chain input { type filter hook input priority 0; policy accept; } chain forward { type filter hook forward priority 0; policy accept; } chain output { type filter hook output priority 0; policy accept; } } [root@centos8 ~]#nft list ruleset table inet filter { chain input { type filter hook input priority 0; policy accept; } chain forward { type filter hook forward priority 0; policy accept; } chain output { type filter hook output priority 0; policy accept; } }
# nft list ruleset # 列出所有规则 # nft list tables # 列出所有表 # nft list table filter # 列出ip簇的filter表 # nft list table inet filter # 列出inet簇的filter表 # nft list chain filter input # 列出filter表input链
评论(0)
暂无评论