添加nat路由说明

This commit is contained in:
bjdgyc 2022-10-13 15:02:36 +08:00
parent 6a1aa35f18
commit 8c6173d3d8
1 changed files with 21 additions and 1 deletions

View File

@ -151,7 +151,7 @@ sysctl -w net.ipv4.ip_forward=1
cat /proc/sys/net/ipv4/ip_forward cat /proc/sys/net/ipv4/ip_forward
``` ```
2. 设置 nat 转发规则 2.1 设置 nat 转发规则(二选一)
```shell ```shell
systemctl stop firewalld.service systemctl stop firewalld.service
@ -165,6 +165,22 @@ iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o eth0 -j MASQUERADE
iptables -nL -t nat iptables -nL -t nat
``` ```
2.2 使用全局路由转发(二选一)
```shell
# 假设anylink所在服务器的内网ip: 10.1.0.10
# 传统网络架构,在交换机添加以下静态路由规则
ip route-static 192.168.10.0 255.255.255.0 10.1.0.10
# 公有云环境下需设置vpc下的路由表添加以下路由策略
目的端: 192.168.10.0/24
下一跳类型: 云服务器
下一跳: 10.1.0.10
```
3. 使用 AnyConnect 客户端连接即可 3. 使用 AnyConnect 客户端连接即可
### macvtap 设置 ### macvtap 设置
@ -184,6 +200,9 @@ ipv4_start = "192.168.10.100"
ipv4_end = "192.168.10.200" ipv4_end = "192.168.10.200"
``` ```
<details>
<summary>tap设置</summary>
### ~~tap 设置~~ ### ~~tap 设置~~
1. 创建桥接网卡 1. 创建桥接网卡
@ -208,6 +227,7 @@ eth_gateway="192.168.10.1"
``` ```
sh bridge-init.sh sh bridge-init.sh
``` ```
</details>
## Systemd ## Systemd