![ebtables arp 規則遷移到 nftables](https://rvso.com/image/668055/ebtables%20arp%20%E8%A6%8F%E5%89%87%E9%81%B7%E7%A7%BB%E5%88%B0%20nftables.png)
我想轉向 nftables(Ubuntu trusty,核心 3.19)。但是我想知道如何遷移 ARP 封包的 ebtables 規則:
-p ARP --arp-op 請求 --arp-ip-src 192.168.178.237 --arp-mac-src 2:fb:c5:e0:ef:a3 -j 接受
該命令nft add rule bridge filter qemu1-o arp operation request counter accept
有效,但我不知道如何將 ip/mac 約束新增至規則。
答案1
不幸的是,nftables
目前 arp 表中還沒有實現來源 ipv4 位址和目標 ipv4 位址的語法。
根據經驗,我發現可以使用以下表達式來代替:
plen 4 @nh,64,32
(來源IP)plen 4 @nh,96,32
(目的IP)
值中的 IPv4 位址應以十進位類型指定integer
。
您可以使用一些線上轉換器將您的 IP 位址轉換為數位格式。
在你的例子中192.168.178.237
將會是3232281325
所以最終規則將如下所示:
nft add rule arp filter input arp operation request arp plen 4 @nh,64,32 3232281325 ether saddr 2:fb:c5:e0:ef:a3 counter accept
PS:您可以使用xtables-nft-multi
最後一個 iptables 包,它提供了nf_tables
相容後端來匯入舊命令並檢查新語法。