从iptables过渡到nftables

技术颜良 / 2024-02-03 / 原文

精彩文章免费看

从iptables迁移到nftables

基于iptables-save 为文件,然后导入即可


% iptables-save  > iptables.txt
% iptables-nft-restore < iptables.txt



% iptables-nft-save 
# Generated by xtables-save v1.6.0 (nf_tables) on Sat Dec 24 14:51:41 2016
*filter
:INPUT ACCEPT [19:1283]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [18:2487]
-A FORWARD -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT
COMMIT
# Completed on Sat Dec 24 14:51:41 2016

% nft list ruleset
table ip filter {
    chain INPUT {
        type filter hook input priority 0; policy accept;
    }

    chain FORWARD {
        type filter hook forward priority 0; policy accept;
        ip protocol tcp tcp dport 22 ct state new counter packets 0 bytes 0 accept
    }

    chain OUTPUT {
        type filter hook output priority 0; policy accept;
    }
}
 

参考: https://wiki.nftables.org/wiki-nftables/index.php/Moving_from_iptables_to_nftables

 

点赞赚钻最高日赚数百

 
赞 (0)
cloudFans
小礼物走一走,来简书关注我
下载简书,随时随地看好文
 
暂无评论
智慧如你,不想  咩~