内容简介:本文风哥教程参考Linux官方文档、Red Hat Enterprise Linux官方文档、Ansible Automation Platform官方文档、Docker官方文档、Kubernetes官方文档和Podman官方文档等内容,详细介绍了相关技术的配置和使用方法。
本文档风哥主要介绍nft list ruleset命令的使用方法,包括查看所有规则、查看指定表、查看指定链等内容。
Part01-基础概念与理论知识
1.1 nft查看命令概述
nft list ruleset – 查看所有规则
nft list tables – 查看所有表
nft list table – 查看指定表
nft list chain – 查看指定链
Part02-生产环境规划与建议
2.1 规则查看策略
1. 定期查看规则集
2. 验证规则配置
3. 排查规则冲突
4. 备份规则配置
Part03-生产环境项目实施方案
3.1 查看所有规则
$ sudo nft list ruleset
table inet filter {
chain input {
type filter hook input priority 0;
tcp dport 22 accept
tcp dport 80 accept
tcp dport 443 accept
ct state established,related accept
iif “lo” accept
}
}
# 以JSON格式输出
$ sudo nft -j list ruleset
# 以数字形式显示
$ sudo nft -n list ruleset
3.2 查看指定表
$ sudo nft list tables
table inet filter
# 查看指定表
$ sudo nft list table inet filter
table inet filter {
chain input {
type filter hook input priority 0;
tcp dport 22 accept
}
}
# 查看指定表的句柄
$ sudo nft -a list table inet filter
table inet filter {
chain input {
type filter h学习交流加群风哥QQ113257174ook input priority 0; policy accept;
tcp dport 22 accept # handle 5
}
}
Part04-生产案例与实战讲解
4.1 案例:规则集导出与备份
$ sudo nft list ruleset > /etc/nftables/backup-$(date +%Y%m%d).conf
# 导出JSON格式
$ sudo nft -j list ruleset > /etc/nftables/backup-$(date +%Y%m%d).json
# 恢复规则集
$ sudo nft -f /etc/nftables/backup-20260406.conf
风哥提示:
Part05-风哥经验总结与分享
本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html
