get_routing_table_status 获取路由表的实时状态
POST /api/v1/network/get_routing_table_status
描述
获取路由表的实时状态信息。此接口用于查询当前路由表的状态,包括各个路由条目的状态和相关信息。
访问权限
具备以下权限:
network:get_static_routes_x
请求参数
{}
返回结果
{
"success": true,
"data": {
"ipv4Routes": [
{
"destination": string,
"gateway": string,
"genmask": string,
"flags": string,
"metric": number,
"iface": string,
"isDefault": boolean,
"isDirect": boolean
},
...
],
"ipv6Routes": [
{
"destination": string,
"nextHop": string,
"flags": string,
"metric": number,
"iface": string,
"isDefault": boolean,
"isDirect": boolean
},
...
]
}
}
- IPv4路由条目
| 字段名 | 类型 | 含义 | 说明 |
|---|---|---|---|
| destination | String | 目标网络地址 | 数据包要到达的目标网络,0.0.0.0 表示默认路由(匹配所有未明确指定的目标) |
| gateway | String | 网关地址 | 到达目标网络需要经过的下一跳路由器,0.0.0.0 表示直连网络(不需要网关) |
| genmask | String | 子网掩码 | 用于确定目标网络的范围,与destination配合定义网段,255.255.255.0 表示/24网段 |
| flags | String | 路由标志 | 描述路由特性,多个标志用竖线分隔。active表示路由是活动的,gateway表示需要通过网关 ,host表示目标是单个主机,dynamic表示动态路由 |
| metric | Number | 路由度量值 | 路由的优先级,数值越小优先级越高 |
| iface | String | 网络接口 | 数据包从哪个网络接口发出,例如 eth_ntp5 或 usb_c300 |
| isDefault | Boolean | 是否默认路由 | true 表示这是系统的默认路由,即 destination 和 genmask 都为 0.0.0.0 |
| isDirect | Boolean | 是否直连网络 | true 表示目标网络直接连接在本地接口上无需网关转发,即 gateway 为 0.0.0.0 |
- IPv6路由条目
| 字段名 | 类型 | 含义 | 说明 |
|---|---|---|---|
| destination | String | 目标网络地址 | IPv6 地址加前缀长度,如 1588:1588:1588:1588::/64,::/0 表示默认路由 |
| nextHop | String | 下一跳地址 | 到达目标网络需要经过的下一跳路由器,:: 表示直连网络 |
| flags | String | 路由标志 | 描述路由特性,多个标志用竖线分隔 |
| metric | Number | 路由度量值 | 路由的成本或优先级,数值越小优先级越高,-1 表示无效路由 |
| iface | String | 网络接口 | 数据包从哪个网络接口发出 |
| isDefault | Boolean | 是否默认路由 | true 表示这是系统的默认路由,即 destination 为 ::/0 |
| isDirect | Boolean | 是否直连网络 | true 表示目标网络直接连接在本地接口上,即 nextHop 为 :: |
例子:
{
"success": true,
"data": {
"ipv4Routes": [
{
"destination": "0.0.0.0",
"gateway": "192.168.188.1",
"genmask": "0.0.0.0",
"flags": "active|gateway",
"metric": 90,
"iface": "eth_ntp5",
"isDefault": true,
"isDirect": false
},
{
"destination": "192.168.166.0",
"gateway": "0.0.0.0",
"genmask": "255.255.255.0",
"flags": "active",
"metric": 90,
"iface": "eth_ntp5",
"isDefault": false,
"isDirect": true
},
{
"destination": "192.168.166.0",
"gateway": "192.168.188.2",
"genmask": "255.255.255.0",
"flags": "active|gateway",
"metric": 100,
"iface": "eth_ntp5",
"isDefault": false,
"isDirect": false
},
{
"destination": "192.168.188.0",
"gateway": "0.0.0.0",
"genmask": "255.255.255.0",
"flags": "active",
"metric": 90,
"iface": "eth_ntp5",
"isDefault": false,
"isDirect": true
},
{
"destination": "192.168.189.0",
"gateway": "192.168.188.3",
"genmask": "255.255.255.0",
"flags": "active|gateway",
"metric": 101,
"iface": "eth_ntp5",
"isDefault": false,
"isDirect": false
}
],
"ipv6Routes": [
{
"destination": "::/0",
"nextHop": "::",
"flags": "active",
"metric": 100,
"iface": "eth_ntp5",
"isDefault": true,
"isDirect": true
}
]
}
}