35 lines
608 B
Markdown
35 lines
608 B
Markdown
> 本文作者:丁辉
|
||
|
||
# Flannel网络不通容器
|
||
|
||
## 一:缺失路由导致无法通讯
|
||
|
||
1. 查看路由
|
||
|
||
```bash
|
||
route -n
|
||
```
|
||
|
||
2. 添加路由
|
||
|
||
```bash
|
||
route add -net 10.0.0.0 netmask 255.255.0.0 dev flannel0
|
||
```
|
||
|
||
> 添加路由后,需要重启 flannal 服务
|
||
|
||
**其他操作**
|
||
|
||
> 主机处于192.168.10.0/24,而想访问192.168.20.0/24网的主机,可以这样配置路由。
|
||
|
||
- 添加默认网关
|
||
|
||
```bash
|
||
route add -net 192.168.20.0 netmask 255.255.255.0 gw 192.168.10.1
|
||
```
|
||
|
||
- 删除默认网关
|
||
|
||
```bash
|
||
route del -net 192.168.20.0 netmask 255.255.255.0
|
||
``` |