Are you an LLM? You can read better optimized documentation at /zh/docs/UB-Base-Specification-2.1.0/network-layer/network-header-nth/packet-header-based-on-the-ip-address-format.md for this page in Markdown format
基于IP地址格式的包头
Byte0 | Byte1 | Byte2 | Byte3 |
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
LPH | RT | LPH |
CCI | RSVD | NPI [24:16] |
NPI [15:0] | IP Header |
IP Header |
… |
IP Header | UDP/TCP/ICMP/… |
… |
图 5-4 基于IP地址格式的网络层包头
UB网络层可兼容IP协议,通过在标准IP数据包头部之前添加UB网络层域段,可以支持网络隔离、端网协同的负载均衡以及多种拥塞标记模式。基于IP地址格式的网络层包头如上图所示,各域段定义如下:
表 5-3 基于IP地址格式的网络层包头域段
域段名 | 位宽(bit) | 描述 |
|---|
RT | 2 | Routing Type,路由类型(见5.3.2节)。 |
CCI | 16 | Congestion Control Indicator,用于传递拥塞控制信息(见5.3.5节)。 |
NPI | 25 | Network Partition Identifier,网络分区标识(见5.3.3节)。 |
UB协议栈的通信流量使用UDP承载时,目的端口号固定为4792(IANA Service Name and Transport Protocol Port Number Registry),对IP包头和UDP包头部分域段的使用说明如下:
表 5-4 UB协议栈使用IPv4包头的说明
IPv4头域段 | 支持情况 |
|---|
IHL | 设置为5,不支持Option选项 |
Type of Service | DSCP根据业务设置优先级; UB Domain内未使用ECN域段,该域段可设置为任意值。 |
Total Length | IPv4头到ICRC的长度 |
Flags | 设置为0b010,不支持分片 |
Fragment Offset | 设置为0,不支持分片 |
Protocol | 设置为0x11,代表传输层为UDP |
表 5-5 UB协议栈使用IPv6包头的说明
IPv6头域段 | 支持情况 |
|---|
Traffic class | DSCP根据业务设置优先级; UB Domain内未使用ECN域段,该域段可设置为任意值。 |
Payload length | IPv6头之后到ICRC的长度 |
Next header | 设置为0x11,代表传输层为UDP |
表 5-6 UB协议栈使用UDP包头的说明
UDP header of UB stack | 支持情况 |
|---|
Source Port | 源端口号,可作为负载均衡因子使用,取值由发送端生成,本规范不做约束 |
Destination Port | 设置为4792(IANA Service Name and Transport Protocol Port Number Registry) |
Length | UDP头到ICRC的长度 |
Checksum | 设置为0 |