linux端口 fcs校验,我如何接收错误的以太网帧并禁用CRC / FCS计算?
你沒有指定哪個操作系統,但我至少可以為Linux發言:
它可能在你的內核,網卡和驅動程序以及ethtool版本。
我們需要告訴驅動程序/硬件做兩件事情,通常不這樣做:1)將FCS字段傳遞給網絡堆棧。 (通常在傳遞之前被截斷)2)不丟棄具有不良FCS字段的分組,而是按原樣傳遞它們
有兩個ethtool選項來實現每個這些:
ethtool -K eth0 rx-fcs on #1 above: give us the FCS field ethtool -K eth0 rx-all on #2 above: even receive bad packets
有了這些,我可以使用wireshark或tcpdump來查看FCS字段,即使它們不正確。 (在我的情況下,我有一些網絡設備,用一個準確的時間戳即時替換校驗和 – 這會導致數據包出現“壞”,我使用上述恢復)
不是所有的卡都能實現這個! 他們可能有上述ethtool選項“固定”或不響應。
在1G速度下,我看到e1000卡運行良好。 在10G的時候,我還沒有找到一個可以做到這一點的網卡,而且必須依靠更復雜的數據采集卡。
再次,我不知道最低內核/ ethtool版本的要求是什么,但我記得要升級一個CentOS服務器,以使其工作。
我也知道,r8169和e1000驅動程序/卡可以做到這一點,但不能說任何其他組合。
另外請注意,您將無法在發送它們的計算機上捕獲傳出的FCS值,因為它們在進程中添加得相當晚(可能已卸載到卡本身),因此pcap無法看到。
在Linux 3.10.11內核上,使用ethtool 3.10:
$ ethtool -k eth0 Features for eth0: rx-checksumming: on tx-checksumming: on tx-checksum-ipv4: off [fixed] tx-checksum-ip-generic: on tx-checksum-ipv6: off [fixed] tx-checksum-fcoe-crc: off [fixed] tx-checksum-sctp: off [fixed] scatter-gather: on tx-scatter-gather: on tx-scatter-gather-fraglist: off [fixed] tcp-segmentation-offload: on tx-tcp-segmentation: on tx-tcp-ecn-segmentation: off [fixed] tx-tcp6-segmentation: on udp-fragmentation-offload: off [fixed] generic-segmentation-offload: on generic-receive-offload: on large-receive-offload: off [fixed] rx-vlan-offload: on tx-vlan-offload: on ntuple-filters: off [fixed] receive-hashing: on highdma: on [fixed] rx-vlan-filter: on [fixed] vlan-challenged: off [fixed] tx-lockless: off [fixed] netns-local: off [fixed] tx-gso-robust: off [fixed] tx-fcoe-segmentation: off [fixed] tx-gre-segmentation: off [fixed] tx-udp_tnl-segmentation: off [fixed] fcoe-mtu: off [fixed] tx-nocache-copy: on loopback: off [fixed] rx-fcs: off rx-all: off tx-vlan-stag-hw-insert: off [fixed] rx-vlan-stag-hw-parse: off [fixed] rx-vlan-stag-filter: off [fixed]
接著:
$ sudo ethtool -K eth0 rx-fcs on rx-all on
給我:
$ ethtool -k eth0 Features for eth0: rx-checksumming: on tx-checksumming: on tx-checksum-ipv4: off [fixed] tx-checksum-ip-generic: on tx-checksum-ipv6: off [fixed] tx-checksum-fcoe-crc: off [fixed] tx-checksum-sctp: off [fixed] scatter-gather: on tx-scatter-gather: on tx-scatter-gather-fraglist: off [fixed] tcp-segmentation-offload: on tx-tcp-segmentation: on tx-tcp-ecn-segmentation: off [fixed] tx-tcp6-segmentation: on udp-fragmentation-offload: off [fixed] generic-segmentation-offload: on generic-receive-offload: on large-receive-offload: off [fixed] rx-vlan-offload: on tx-vlan-offload: on ntuple-filters: off [fixed] receive-hashing: on highdma: on [fixed] rx-vlan-filter: on [fixed] vlan-challenged: off [fixed] tx-lockless: off [fixed] netns-local: off [fixed] tx-gso-robust: off [fixed] tx-fcoe-segmentation: off [fixed] tx-gre-segmentation: off [fixed] tx-udp_tnl-segmentation: off [fixed] fcoe-mtu: off [fixed] tx-nocache-copy: on loopback: off [fixed] rx-fcs: on rx-all: on tx-vlan-stag-hw-insert: off [fixed] rx-vlan-stag-hw-parse: off [fixed] rx-vlan-stag-filter: off [fixed]
總結
以上是生活随笔為你收集整理的linux端口 fcs校验,我如何接收错误的以太网帧并禁用CRC / FCS计算?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 免费开卡!ApplePay交通卡上线宁波
- 下一篇: 李国庆称“可以适度逼捐”:我肯定会捐款