2024-11-13 13:42:00 +00:00
|
|
|
---
|
|
|
|
icon: material/new-box
|
|
|
|
---
|
|
|
|
|
2022-08-24 08:23:21 +00:00
|
|
|
# 路由
|
|
|
|
|
2024-11-13 13:42:00 +00:00
|
|
|
!!! quote "sing-box 1.11.0 中的更改"
|
|
|
|
|
|
|
|
:material-plus: [network_strategy](#network_strategy)
|
|
|
|
:material-plus: [default_network_type](#default_network_type)
|
|
|
|
:material-plus: [default_fallback_network_type](#default_fallback_network_type)
|
2024-11-16 04:15:14 +00:00
|
|
|
:material-plus: [default_fallback_delay](#default_fallback_delay)
|
2024-11-13 13:42:00 +00:00
|
|
|
|
2023-12-01 05:24:18 +00:00
|
|
|
!!! quote "sing-box 1.8.0 中的更改"
|
|
|
|
|
|
|
|
:material-plus: [rule_set](#rule_set)
|
|
|
|
:material-delete-clock: [geoip](#geoip)
|
|
|
|
:material-delete-clock: [geosite](#geosite)
|
|
|
|
|
2022-08-24 08:23:21 +00:00
|
|
|
### 结构
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"route": {
|
|
|
|
"geoip": {},
|
|
|
|
"geosite": {},
|
|
|
|
"rules": [],
|
2023-12-01 05:24:18 +00:00
|
|
|
"rule_set": [],
|
2022-08-24 08:23:21 +00:00
|
|
|
"final": "",
|
|
|
|
"auto_detect_interface": false,
|
2022-09-09 07:40:35 +00:00
|
|
|
"override_android_vpn": false,
|
2024-11-12 14:57:15 +00:00
|
|
|
"default_interface": "",
|
|
|
|
"default_mark": 0,
|
|
|
|
"default_network_strategy": "",
|
|
|
|
"default_fallback_delay": ""
|
2022-08-24 08:23:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2024-11-13 13:42:00 +00:00
|
|
|
!!! note ""
|
|
|
|
|
|
|
|
当内容只有一项时,可以忽略 JSON 数组 [] 标签
|
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
### 字段
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2023-12-14 14:23:52 +00:00
|
|
|
| 键 | 格式 |
|
|
|
|
|-----------|-----------------------|
|
|
|
|
| `geoip` | [GeoIP](./geoip/) |
|
2023-12-01 05:24:18 +00:00
|
|
|
| `geosite` | [Geosite](./geosite/) |
|
|
|
|
|
|
|
|
#### rule
|
|
|
|
|
|
|
|
一组 [路由规则](./rule/) 。
|
|
|
|
|
|
|
|
#### rule_set
|
|
|
|
|
|
|
|
!!! question "自 sing-box 1.8.0 起"
|
|
|
|
|
|
|
|
一组 [规则集](/configuration/rule-set/)。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
|
|
|
#### final
|
|
|
|
|
2023-11-15 17:11:28 +00:00
|
|
|
默认出站标签。如果为空,将使用第一个可用于对应协议的出站。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
|
|
|
#### auto_detect_interface
|
|
|
|
|
2023-11-09 09:04:08 +00:00
|
|
|
!!! quote ""
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
仅支持 Linux、Windows 和 macOS。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2022-09-09 07:40:35 +00:00
|
|
|
默认将出站连接绑定到默认网卡,以防止在 tun 下出现路由环路。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
|
|
|
如果设置了 `outbound.bind_interface` 设置,则不生效。
|
|
|
|
|
2022-09-09 07:40:35 +00:00
|
|
|
#### override_android_vpn
|
|
|
|
|
2023-11-09 09:04:08 +00:00
|
|
|
!!! quote ""
|
2022-09-09 07:40:35 +00:00
|
|
|
|
|
|
|
仅支持 Android。
|
|
|
|
|
|
|
|
启用 `auto_detect_interface` 时接受 Android VPN 作为上游网卡。
|
|
|
|
|
2022-08-24 08:23:21 +00:00
|
|
|
#### default_interface
|
|
|
|
|
2023-11-09 09:04:08 +00:00
|
|
|
!!! quote ""
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
仅支持 Linux、Windows 和 macOS。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2022-09-09 07:40:35 +00:00
|
|
|
默认将出站连接绑定到指定网卡,以防止在 tun 下出现路由环路。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
|
|
|
如果设置了 `auto_detect_interface` 设置,则不生效。
|
|
|
|
|
|
|
|
#### default_mark
|
|
|
|
|
2023-11-09 09:04:08 +00:00
|
|
|
!!! quote ""
|
2022-08-24 08:23:21 +00:00
|
|
|
|
2022-08-25 01:45:22 +00:00
|
|
|
仅支持 Linux。
|
2022-08-24 08:23:21 +00:00
|
|
|
|
|
|
|
默认为出站连接设置路由标记。
|
|
|
|
|
2023-11-15 17:11:28 +00:00
|
|
|
如果设置了 `outbound.routing_mark` 设置,则不生效。
|
2024-11-12 14:57:15 +00:00
|
|
|
|
|
|
|
#### network_strategy
|
|
|
|
|
2024-11-13 13:42:00 +00:00
|
|
|
!!! question "自 sing-box 1.11.0 起"
|
2024-11-12 14:57:15 +00:00
|
|
|
|
2024-11-13 13:42:00 +00:00
|
|
|
详情参阅 [拨号字段](/configuration/shared/dial/#network_strategy)。
|
2024-11-12 14:57:15 +00:00
|
|
|
|
|
|
|
当 `outbound.bind_interface`, `outbound.inet4_bind_address` 或 `outbound.inet6_bind_address` 已设置时不生效。
|
|
|
|
|
|
|
|
可以被 `outbound.network_strategy` 覆盖。
|
|
|
|
|
|
|
|
与 `default_interface` 冲突。
|
|
|
|
|
2024-11-13 13:42:00 +00:00
|
|
|
#### default_network_type
|
2024-11-12 14:57:15 +00:00
|
|
|
|
2024-11-13 13:42:00 +00:00
|
|
|
!!! question "自 sing-box 1.11.0 起"
|
2024-11-12 14:57:15 +00:00
|
|
|
|
2024-11-13 13:42:00 +00:00
|
|
|
详情参阅 [拨号字段](/configuration/shared/dial/#default_network_type)。
|
|
|
|
|
|
|
|
#### default_fallback_network_type
|
|
|
|
|
|
|
|
!!! question "自 sing-box 1.11.0 起"
|
|
|
|
|
|
|
|
详情参阅 [拨号字段](/configuration/shared/dial/#default_fallback_network_type)。
|
|
|
|
|
|
|
|
#### default_fallback_delay
|
2024-11-12 14:57:15 +00:00
|
|
|
|
2024-11-13 13:42:00 +00:00
|
|
|
!!! question "自 sing-box 1.11.0 起"
|
2024-11-12 14:57:15 +00:00
|
|
|
|
2024-11-13 13:42:00 +00:00
|
|
|
详情参阅 [拨号字段](/configuration/shared/dial/#fallback_delay)。
|