如何将流量路由到 VPN 网络上的网关?

如何将流量路由到 VPN 网络上的网关?

我位于 Docker 容器中,位于通过 VPN 连接到远程网络的主机上,并且希望将所有流量路由到10.43.0.0/1610.148.185.170VPN 网络上的主机)。

sudo ip route add 10.43.0.0/16 via 10.148.185.170 dev enp0s5
Error: Nexthop has invalid gateway.

$ ip route show
default via 10.211.55.1 dev enp0s5 proto dhcp metric 100
10.211.55.0/24 dev enp0s5 proto kernel scope link src 10.211.55.3 metric 100
169.254.0.0/16 dev enp0s5 scope link metric 1000
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown

我得到的错误是“Nexthop 有无效网关”,这可能意味着我无法指定10.148.185.170为网关,因为它位于 VPN 网络上并且需要额外的跃点(VPN TUN 接口)?如果这是正确的话我如何告诉操作系统10.43.0.0/16通过 VPN 网络发送网络数据包10.148.185.170作为网关发送网络数据包

笔记:从容器到 VPN 网络上的主机的所有流量均未正确路由,例如:

$ nc -vvv 10.148.185.170 443
Connection to 10.148.185.170 443 port [tcp/https] succeeded!

相关内容