问题原文
原帖链接 · TuxStash.de · CC BY-SA 4.0
19:27:47.782291 98:9b:cb:: > ff:ff:ff:ff:ff:ff, ethertype Unknown (0x88e1), length 60:
0x0000: 0000 a000 b052 38e5 d57f 0000 0000 0000 .....R8.........
0x0010: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0020: 0000 0000 0000 0000 0000 0000 0000 ..............
19:27:47.782293 98:9b:cb:: > ff:ff:ff:ff:ff:ff, ethertype Unknown (0x8912), length 60:
0x0000: 0170 a000 0000 1f84 e5a3 97a2 5553 bef1 .p..........US..
0x0010: fcf9 796b 5214 13e9 e200 0000 0000 0000 ..ykR...........
0x0020: 0000 0000 0000 0000 0000 0000 0000 ..............
My router is sending this garbage into my network and I'd like to block it, as one cannot disable it. Doing so via iptables has proven to be more challenging than I thought it would be:
root@fw:~ # iptables -A INPUT -m mac --mac-source 98:9b:cb:: -p 0x88e1 -j DROP
iptables v1.8.2 (nf_tables): unknown protocol "0x88e1" specified
Try `iptables -h' or 'iptables --help' for more information.
Is there any way to block an invalid ether-type?
已采纳解答
原帖链接 · Ingo · CC BY-SA 4.0
It seems iptables cannot be used for our problem. We have to use its improved successor nftables. It has simply a meta expression available with expression type protocol = EtherType protocol value. Thanks to @Bernard who found the solution to his question Linux server dropping RX packets in __netif_receive_skb_core. He gives this example to drop the unknown EtherTypes, that must just appended to /etc/nftables.conf:
table netdev filter {
chain ingress {
type filter hook ingress device eno1 priority 0; policy accept;
meta protocol {0x8912, 0x88e1} drop
}
}
On my Raspberry Pi with Raspberry Pi OS Buster I just do:
rpi ~$ sudo apt install nftables
/etc/nftables.conf is now available and I appended the rules with the correct interface name instead of eno1 from the example.
rpi ~$ sudo systemctl start nftables.service
and tcpdump show me, that there are no more that unknown EtherType packets.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
