以太網幀格式是如何識別有效負載類型的

注:機翻,未校對。

識別以太網幀有效負載

Identifying Ethernet Frame Payloads

Ethernet frames contain payload data encapsulated within header and trailer fields used to deliver packets over Layer 2 networks. This article provides an overview of how the structure and organization of Ethernet frame formats enables destination network devices to identify the payload type of received Ethernet frames.

以太網幀包含封裝在報頭和尾部字段中的有效負載數據,用于通過第 2 層網絡傳輸數據包。本文概述了以太網幀格式的結構和組織如何使目標網絡設備能夠識別接收的以太網幀的有效負載類型。

以太網幀格式概述

Ethernet Frame Format Overview

An Ethernet frame is the basic data transmission format for communication over IEEE 802.3 Ethernet networks. The standard Ethernet frame structure consists of several fields that identify and delimit the payload data carried inside the frame:

以太網幀是通過 IEEE 802.3 以太網進行通信的基本數據傳輸格式。標準以太網幀結構由幾個字段組成,用于標識和分隔幀內攜帶的有效負載數據:

Preamble and Start Frame Delimiter – The preamble contains seven bytes of alternating 1s and 0s ending with the Start Frame Delimiter byte marking the start of the frame.

前導碼和起始幀分隔符 – 前導碼包含七個字節,這些字節交替出現 1 和 0,以標記幀開始的起始幀分隔符字節結尾。

Destination and Source MAC Addresses – These 6-byte hardware addresses identify the intended destination device and source device for the frame.

目標和源 MAC 地址 — 這些 6 字節硬件地址標識幀的預期目標設備和源設備。

EtherType/Length – A 2-byte field identifying the payload protocol or specifying the length of the payload data.

EtherType/Length – 一個 2 字節字段,用于標識有效負載協議或指定有效負載數據的長度。

Payload Data – Between 46 and 1500 bytes containing the encapsulated data for upper layer protocols.

有效負載數據 – 46 到 1500 字節之間,包含上層協議的封裝數據。

Frame Check Sequence (FCS) – A 4-byte cyclic redundancy check value used to detect transmission errors.

幀校驗序列 (FCS) – 用于檢測傳輸錯誤的 4 字節循環冗余校驗值。

Within this basic structure, the EtherType and Length fields directly enable devices to identify the specific type and contents of payload data inside an Ethernet frame on local networks.

在此基本結構中,EtherType 和 Length 字段直接使設備能夠識別本地網絡以太網幀內有效負載數據的特定類型和內容。

“以太網類型”和“長度”字段

Ethernet Type and Length Fields

The EtherType and Length fields provide critical information to network interfaces handling Ethernet frames. This 2-byte field has a dual significance depending on its numeric value:

EtherType 和 Length 字段為處理以太網幀的網絡接口提供關鍵信息。此 2 字節字段具有雙重意義,具體取決于其數值:

For values 0-1500, it specifies the number of bytes in the payload data field. This allows support for legacy IEEE 802.3 Ethernet frames.

對于值 0-1500,它指定有效負載數據字段中的字節數。這允許支持傳統的 IEEE 802.3 以太網幀。

For values of 1536 (0x0600) and above, it indicates the protocol identifier for the encapsulated payload using EtherType values assigned by the IEEE.

對于 1536 (0x0600) 及以上的值,它使用 IEEE 分配的 EtherType 值指示封裝有效負載的協議標識符。

If the value is below 1536, receiving network interfaces treat it as a Length field and expect a raw payload of the specified size. Values of 1536 or above indicate an EtherType identifying the payload protocol. This provides extensibility to support many layered protocols carried over native Ethernet networks.

如果該值低于 1536,則接收網絡接口會將其視為“長度”字段,并期望獲得指定大小的原始有效負載。值為 1536 或更高表示標識有效負載協議的 EtherType。這提供了可擴展性,以支持通過本地以太網網絡傳輸的許多分層協議。

常見有效負載類型標識符值

Common Payload Type Identifier Values

Standard EtherType values are used to identify some widely adopted protocols commonly encapsulated and transmitted using Ethernet framing:

標準 EtherType 值用于識別一些廣泛采用的協議,這些協議通常使用以太網成幀進行封裝和傳輸:

IPv4 – Defined as EtherType 0x0800, indicates the frame payload contains an IPv4 packet.

IPv4 – 定義為 EtherType 0x0800,表示幀有效負載包含 IPv4 數據包。

IPv6 – EtherType 0x86DD signifies the presence of an IPv6 packet inside the frame.

IPv6 – EtherType 0x86DD表示幀內存在 IPv6 數據包。

ARP – The Address Resolution Protocol used to map IP addresses to MAC addresses is identified by EtherType 0x0806.

ARP – 用于將 IP 地址映射到 MAC 地址的地址解析協議由 EtherType 0x0806 標識。

VLAN – Virtual LAN tagging protocols use EtherType 0x8100 to multiplex multiple virtual networks over a shared physical medium.

VLAN – 虛擬 LAN 標記協議使用 EtherType 0x8100 在共享物理介質上多路復用多個虛擬網絡。

MPLS – Multiprotocol Label Switching, EtherType 0x8847 and 0x8848, tags packets for optimized forwarding and routing.

MPLS – 多協議標簽交換,EtherType 0x8847 和 0x8848,標記數據包以優化轉發和路由。

In this way, the 2-byte EtherType field provides a simple, extensible indicator allowing Ethernet interfaces to dynamically identify and handle many types of Layer 3 payload data encapsulated within a Layer 2 Ethernet frame structure.

通過這種方式,2 字節 EtherType 字段提供了一個簡單、可擴展的指示器,允許以太網接口動態識別和處理封裝在第 2 層以太網幀結構中的多種類型的第 3 層有效負載數據。

IPv4 和 IPv6 有效負載標識

IPv4 and IPv6 Payload Identification

The most ubiquitous protocols transported over Ethernet are the Internet Protocol (IP), version 4 and 6. When an Ethernet frame contains an IP packet as its payload data, the EtherType field is set to the corresponding IP identifier:

通過以太網傳輸的最普遍的協議是 Internet 協議 (IP) 版本 4 和 6。當以太網幀包含 IP 數據包作為其有效負載數據時,EtherType 字段將設置為相應的 IP 標識符:

IPv4 – 0x0800 tells the receiving interface to expect an IPv4 header and packet following the Ethernet frame header.

IPv4 – 0x0800告訴接收接口在以太網幀報頭之后需要 IPv4 報頭和數據包。

IPv6 – 0x86DD indicates the presence of an IPv6 packet, formatted with a distinct IPv6 header.

IPv6 – 0x86DD表示存在 IPv6 數據包,該數據包使用不同的 IPv6 標頭進行格式化。

With these EtherType values, the Ethernet interface can parse the IP payload correctly. It can check packet validity, verify checksums, and either process the contents or hand off to higher level services. Up to 1500 bytes of IP packet data can be encapsulated within a standard Ethernet frame structure this way.

使用這些 EtherType 值,以太網接口可以正確解析 IP 有效負載。它可以檢查數據包的有效性,驗證校驗和,并處理內容或移交給更高級別的服務。通過這種方式,最多 1500 字節的 IP 數據包數據可以封裝在標準以太網幀結構中。

Notably, IPv4 and IPv6 themselves have identifier fields. An IPv4 header contains a Protocol field specifying how to interpret the IP payload. Common payload protocols here include TCP, UDP, and ICMP. Similarly, IPv6 uses a Next Header field to identify payload contents like TCP/UDP data or extension headers. So handling payload identification involves nested processing of identifiers at multiple layers.

值得注意的是,IPv4 和 IPv6 本身具有標識符字段。IPv4 標頭包含一個協議字段,用于指定如何解釋 IP 有效負載。此處常見的有效負載協議包括 TCP、UDP 和 ICMP。同樣,IPv6 使用 Next Header 字段來標識有效負載內容,如 TCP/UDP 數據或擴展標頭。因此,處理有效負載標識涉及在多個層對標識符進行嵌套處理。

有效負載識別

ARP Payload Identification ARP

The Address Resolution Protocol (ARP), EtherType 0x0806, provides a special payload case. ARP is a Layer 3 protocol used to resolve hardware MAC addresses from known IP addresses. However, it runs directly over Ethernet, not over IP. So ARP packets represent an exception case:

地址解析協議 (ARP) EtherType 0x0806 提供了一個特殊的有效負載案例。ARP 是一種第 3 層協議,用于從已知 IP 地址解析硬件 MAC 地址。但是,它直接通過以太網運行,而不是通過 IP 運行。因此,ARP 數據包表示例外情況:

Layer 2 Encapsulation – ARP runs directly above Ethernet and relies on EtherType 0x0806 identification.

第 2 層封裝 – ARP 直接在以太網上方運行,并依賴于 EtherType 0x0806 識別。

Layer 3 Purpose – ARP handles IP address to MAC resolution, a core Layer 3 routing function.

第 3 層用途 – ARP 處理 IP 地址到 MAC 的解析,這是第 3 層核心路由功能。

Thus ARP highlights the dual functions of Layer 2 framing. The Ethernet headers encapsulate Layer 3 packets containing ARP data used to facilitate routing and interconnection of logical IP networks. This demonstrates the flexibility of the Ethernet model to blend multiple levels of processing – using EtherType values for parsing, while carrying packets handling inter-network routing functions.

因此,ARP 突出了 Layer 2 成幀的雙重功能。以太網報頭封裝了包含 ARP 數據的第 3 層數據包,用于促進邏輯 IP 網絡的路由和互連。這展示了以太網模型混合多級處理的靈活性——使用 EtherType 值進行解析,同時攜帶處理網絡間路由功能的數據包。

VLAN 和 MPLS 有效負載識別

VLAN and MPLS Payload Identification

Virtual LAN (VLAN) and Multiprotocol Label Switching (MPLS) protocols utilize alternative framing and EtherTypes to tag and forward packets flows based on labels rather than destination IP addresses. They represent two complex payload identification cases:

虛擬局域網 (VLAN) 和多協議標簽交換 (MPLS) 協議利用替代幀格式和 EtherType 根據標簽而不是目標 IP 地址標記和轉發數據包流。它們代表了兩種復雜的有效載荷識別案例:

VLAN – Inserts VLAN tags using EtherType 0x8100 inside Ethernet frames to demarcate Virtual LAN routing domains.

VLAN — 使用 EtherType 0x8100在以太網幀內插入 VLAN 標記以劃分虛擬 LAN 路由域。

MPLS – Defines EtherTypes 0x8847 and 0x8848 for Multi-Protocol Label Switching, using stacked labels for path specifications.

MPLS – 定義用于多協議標簽交換的 EtherTypes 0x8847 和 0x8848,使用堆疊標簽作為路徑規范。

VLAN allows a single physical network to be partitioned into multiple isolated logical networks through the insertion of VLAN tagging headers after the source MAC address field in an Ethernet frame. Routers and switches use this additional 12-bit VLAN Identifier field to forward such tagged packets only between ports within the same tagged VLAN domain.

VLAN 允許通過在以太網幀中的源 MAC 地址字段后插入 VLAN 標記標頭,將單個物理網絡劃分為多個隔離的邏輯網絡。路由器和交換機使用此附加的 12 位 VLAN 標識符字段僅在同一標記 VLAN 域中的端口之間轉發此類標記數據包。

In MPLS meanwhile, labels stacked after the source MAC specify next hop forwarding rules. This allows construction of label switched paths to optimize routing across core networks. MPLS uses these multilayer labels rather than traditional destination-based IP forwarding to streamline traffic flows based on service policies and traffic engineering rules.

同時,在 MPLS 中,堆疊在源 MAC 之后的標簽指定下一跳轉發規則。這允許構建標簽交換路徑,以優化跨核心網絡的路由。MPLS 使用這些多層標簽而不是傳統的基于目標的 IP 轉發來簡化基于服務策略和流量工程規則的流量。

In both cases, inspection of EtherType identifiers (0x8100 for VLAN, 0x8847/0x8848 for MPLS) signals that the Ethernet payloads have encapsulated headers defining alternate optimized forwarding and routing semantics. This highlights the power of Ethernet framing to flexibly carry varied higher level data and control plane protocols.

在這兩種情況下,對 EtherType 標識符(0x8100 用于 VLAN,0x8847/0x8848 用于 MPLS)的檢查表明,以太網有效負載具有封裝的標頭,定義了替代優化的轉發和路由語義。這凸顯了以太網成幀的強大功能,可以靈活地承載各種更高級別的數據和控制平面協議。

具有有效負載類型標識的以太網幀示例

Example Ethernet Frames with Payload Type Identification

Let’s examine some hexadecimal Ethernet frame dumps to see EtherType identifiers flag the presence of different payload protocols in real network traces:

讓我們檢查一些十六進制以太網幀轉儲,看看 EtherType 標識符標記了實際網絡跟蹤中存在不同的有效負載協議:

Frame 1 (IPv4 Packet):
Destination MAC: 01:23:45:67:89:ab
Source MAC: 02:45:67:89:ab:cd
EtherType: 0800 (IPv4)
Payload: 450000280691c0a864984da8b036

Frame 2 (IPv6 Packet):
Destination MAC: 23:45:98:ab:cd:ef
Source MAC: 12:34:56:78:90:12
EtherType: 86dd (IPv6)
Payload: 6ff06f206da173222ef600d60ddae36789b25de367b35f

Frame 3 (ARP Packet):
Destination MAC: ff:ff:ff:ff:ff:ff
Source MAC: ab:cd:ef:01:23:45
EtherType: 0806 (ARP)
Payload: 0001080006040001abcf0123edef45600c29bf5e802

注:本段著色區域無特殊意義,僅是防止字符被網頁錯誤渲染為emoji

Here we see the same source and destination MAC addresses on each frame, but the varying EtherType field values flag the presence of different payload protocols – IPv4, IPv6, and ARP carried over the Layer 2 Ethernet fabric between the same two devices. This allows the receiver to correctly parse and handle the different formatted IP and ARP data present in the payloads.

在這里,我們在每個幀上看到相同的源和目標 MAC 地址,但不同的 EtherType 字段值標記了存在不同的有效負載協議 —— IPv4、IPv6 和 ARP 通過兩個設備之間的同一第 2 層以太網結構傳輸。這允許接收方正確解析和處理有效負載中存在的不同格式的 IP 和 ARP 數據。

Identification of payload types thus begins at the very start of an Ethernet frame with the EtherTypeclassify. Combined with destination MAC addressing, this mechanism elegantly enables extensible heterogeneous communications over unified physical and datalink layer networks.

有效負載類型的識別從以太網幀的開頭即 EtherType 分類開始,結合目標 MAC 地址尋址,這種機制巧妙地實現了在統一的物理和數據鏈路層網絡上進行可擴展的異構通信。

by NE 101 ,March 1, 2024

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/37071.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/37071.shtml
英文地址,請注明出處:http://en.pswp.cn/web/37071.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

套接字通信類的封裝

在掌握了基于TCP的套接字通信流程之后,為了方便使用,提高編碼效率,可以對通信操作進行封裝,本著有淺入深的原則,先基于C語言進行面向過程的函數封裝,然后再基于C進行面向對象的類封裝。 1. 基于C語言的封裝…

Linux基礎篇——學習Linux基本工具安裝教程視頻鏈接

本篇文章就是記錄一下學習Linux需要用到的基本工具的視頻教程鏈接,方便以后查看 VMware15.5安裝 安裝視頻教程:VMware15.5安裝教程 centos7.6安裝(這個視頻教程真的很nice) 視頻教程:centos7.6 虛擬機克隆、快照、…

ansible 模塊擴展

uri模塊 在Ansible中,uri模塊是一個用于發送HTTP、HTTPS、FTP等請求的模塊,可以用于獲取網頁內容、下載文件、上傳文件等。本質上,它是一個HTTP客戶端模塊。 使用uri模塊,需要指定一些參數來定義HTTP請求。下面是一些uri模塊的常…

學習平臺推薦_菜鳥教程官網

網址: 菜鳥教程 - 學的不僅是技術,更是夢想!菜鳥教程(www.runoob.com)提供了編程的基礎技術教程, 介紹了HTML、CSS、Javascript、Python,Java,Ruby,C,PHP , MySQL等各種編程語言的基礎知識。 同…

Nginx-2

一、高級配置 1.1網頁狀態頁 基于nginx 模塊 ngx_http_stub_status_module 實現,在編譯安裝nginx的時候需要添加編譯參數 --with-http_stub_status_module,否則配置完成之后監測會是提示語法錯誤注意: 狀態頁顯示的是整個服務器的狀態,而非虛擬主機的狀…

opencv實現surface_matching記錄

1 說明 使用的cv版本為4.7.0 , surface_matching功能是附加在contrib中的,并未直接包含在opencv 4.7.0中,因此編譯的時候需要考慮contrib。 VS版本為2022, CMake版本為3.30-rc4. 2 編譯opencv(含contrib) 參見: Win10 下編譯 OpenCV 4.7.0詳細全過程,包含xfeatures2…

Open3D (C++) 點云邊界提取

邊界提取 一、算法原理1、詳細流程2、主要函數3、參考文獻二、代碼實現三、結果展示四、注意事項本文由CSDN點云俠原創,原文鏈接。如果你不是在點云俠的博客中看到該文章,那么此處便是不要臉的爬蟲。 一、算法原理 1、詳細流程 該算法完全復刻自PCL。 2、主要函數 /// \…

算法入門(上)

什么是算法? 算法(Algorithm)是解決特定問題求解步驟的描述,在計算機中表現為指令的有限序列,并且每條指令表示一個或多個操作。 給定一個問題,能夠解決這個問題的算法是有很多種的。算式中的問題是千奇百怪…

C++為什么將 0.1f 更改為 0 性能會降低 10 倍

一、浮點數與整數的表示差異 在計算機內部,浮點數和整數的表示方式截然不同。浮點數遵循IEEE 754標準,通過符號位、指數位和尾數位來存儲和表示數值,而整數則是直接的二進制表示。這種表示上的差異導致了它們在內存占用、處理速度以及精度上…

Debian/Ubuntu Linux安裝OBS

先決條件 建議使用 xserver-xorg 1.18.4 或更新版本,以避免 OBS 中某些功能(例如全屏投影儀)出現潛在的性能問題。在 Linux 上使用 OBS Studio 需要 OpenGL 3.3(或更高版本)支持。在終端中輸入以下內容來檢查系統支持…

Halcon測量助手

模糊測量:基于模糊邏輯 模糊邏輯:模仿人腦的不確定性概念判斷、推理思維方式,對于模型未知或不能確定的描述系統,以及強非線性、大滯后的控制對象,應用模糊集合和模糊規則進行推理,表達過渡性界限或定性知識經驗&…

MySQL基礎進階:編寫復雜查詢

編寫復雜查詢 1. 子查詢2. IN運算符3. 子查詢VS連接4. ALL關鍵字5. ANY關鍵字6. 相關子查詢7. EXISTS運算符8. SELECT子句中得子查詢9. FROM子句中得子查詢 1. 子查詢 子查詢: 任何一個充當另一個SQL語句的一部分的 SELECT 查詢語句都是子查詢,子查詢是…

GMSB文章八:微生物中介分析

歡迎大家關注全網生信學習者系列: WX公zhong號:生信學習者Xiao hong書:生信學習者知hu:生信學習者CDSN:生信學習者2 介紹 中介分析(Mediation Analysis)是一種統計方法,用于研究一…

C# Benchmark

創建控制臺項目(或修改現有項目的Main方法代碼),Nget導入Benchmark0.13.12,創建測試類: public class StringBenchMark{int[] numbers;public StringBenchMark() {numbers Enumerable.Range(1, 20000).ToArray();}[Be…

大語言模型(LLMs)全面學習指南,初學者入門,一看就懂!

大語言模型(LLMs)作為人工智能(AI)領域的一項突破性發展,已經改變了自然語言處理(NLP)和機器學習(ML)應用的面貌。這些模型,包括OpenAI的GPT-4o和Google的gem…

楊冪跨界學術圈:內容營銷專家劉鑫煒帶你了解核心期刊的學術奧秘

近日&#xff0c;知名藝人楊冪在權威期刊《中國廣播電視學刊》上發表了一篇名為《淺談影視劇中演員創作習慣——以電視劇<哈爾濱一九四四>為例》的學術論文&#xff0c;此舉在學術界和娛樂圈均引起了廣泛關注。該期刊不僅享有極高的聲譽&#xff0c;還同時被北大中文核心…

數據庫-數據完整性-用戶自定義完整性實驗

NULL/NOT NULL 約束&#xff1a; 在每個字段后面可以加上 NULL 修飾符來指定該字段是否可以為空&#xff1b;或者加上 NOT NULL 修飾符來指定該字段必須填上數據。 DEFAULT約束說明 DEFAULT 約束用于向列中插入默認值。如果列中沒有規定其他的值&#xff0c;那么會將默認值添加…

發;flask的基本使用2

上一篇我們介紹了基本使用方法 flask使用 【 1 】基本使用 from flask import Flask# 1 實例化得到對象 app Flask(__name__)# 2 注冊路由--》寫視圖函數 app.route(/) def index():# 3 返回給前端字符串return hello worldif __name__ __main__:# 運行app&#xff0c;默認…

Conformal Prediction

1 A Gentle Introduction to Conformal Prediction and Distribution-Free Uncertainty Quantification 2 Language Models with Conformal Factuality Guarantees

【啟明智顯分享】樂鑫ESP32-S3R8方案2.8寸串口屏:高性能低功耗,WIFI/藍牙無線通信

近年來HMI已經成為大量應用聚焦的主題&#xff0c;在消費類產品通過創新的HMI設計帶來增強的連接性和更加身臨其境的用戶體驗之際&#xff0c;工業產品卻仍舊在采用物理接口。這些物理接口通常依賴小型顯示器或是簡單的LED&#xff0c;通過簡單的機電開關或按鈕來實現HMI交互。…