共计 1549 个字符,预计需要花费 4 分钟才能阅读完成。
Debian 11 已自带 nftables,为 iptables 原团队研发的新一代 netfilter 解释器 / 命令行,性能更高效,命令行更直观,建议代替 iptables 使用。
官方 Wiki:https://wiki.nftables.org 简单记录一下我习惯启用基本 nftables 的步骤: 1. mkdir /etc/nftables #!/usr/sbin/nft -f flush ruleset table ip default { chain input { type filter hook input priority 0; policy drop; iif lo accept # ping # SSH # Nginx chain forward { type filter hook forward priority 0; policy drop; ct status dnat accept table ip6 default { chain input { type filter hook input priority 0; policy drop; iif lo accept icmpv6 type {nd-nei**or-solicit, nd-router-advert, nd-nei**or-advert} accept # ping chain forward { type filter hook forward priority 0; policy drop; ct status dnat accept 3. vim /etc/nftables.conf include “/etc/nftables/default.nft” 4. systemctl start nftables 8. 端口转发示例 table ip default { chain input { type filter hook input priority 0; policy drop; iif lo accept # ping # SSH chain forward { type filter hook forward priority 0; policy drop; ct status dnat accept chain prerouting { type nat hook prerouting priority -100; policy accept; iif eth0 tcp dport 443 dnat to ip 目的地:port 端口 chain postrouting { type nat hook postrouting priority 100; policy accept; masquerade 完。 |
网友回复:
注册 : nftables 天下第一!好用且强大,主机资讯帮顶。