Skip to content

Commit 45cbda1

Browse files
committed
routing: Finish
1 parent ede8d21 commit 45cbda1

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

docs/ops/network/routing.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ icon: material/router-network
88

99
[@iBug][iBug]
1010

11-
!!! warning "本文编写中"
11+
!!! warning "本文已完成,等待校对"
1212

1313
## 路由表 {#routing-tables}
1414

@@ -65,6 +65,26 @@ ip route delete 192.0.2.0/24
6565

6666
#### 查 {#ip-route-show}
6767

68+
前文提到,`ip route` 命令等价于 `ip route show table main`,用于显示主路由表的内容。
69+
如果要查看其他路由表的内容,可以使用 `table` 选项指定路由表,例如:
70+
71+
```shell
72+
ip route show table local
73+
```
74+
75+
如果要测试某个数据包会匹配到哪条路由规则,可以使用 `ip route get` 命令,例如:
76+
77+
```console
78+
$ ip route get 8.8.8.8
79+
8.8.8.8 via 192.0.2.1 dev eth0 src 192.0.2.100
80+
```
81+
82+
对于策略路由,`ip route get` 命令也允许指定额外的数据包信息(如源地址、TOS 等),以便测试路由规则的匹配情况,例如:
83+
84+
```shell
85+
ip route get 8.8.8.8 from 192.0.2.100 mark 1
86+
```
87+
6888
### 路由类型 {#route-types}
6989

7090
每条路由规则都有一个类型(type),常见的路由类型包括:

0 commit comments

Comments
 (0)