0

I'm in a Docker container, on a host connected to a remote network via VPN, and want to route all traffic to 10.43.0.0/16 to 10.148.185.170 (host on the VPN network).

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

The error I get is that "Nexthop has invalid gateway", which probably means I cannot specify 10.148.185.170 as the gateway, since it's on the VPN network and requires an extra hop (VPN TUN interface)? If that's correct, how can I tell the operating system to send network packets to 10.43.0.0/16 through the VPN network with 10.148.185.170 as the gateway?

Note: All traffic from the container to hosts on the VPN network are notmally routed correctly, e.g.:

$ nc -vvv 10.148.185.170 443
Connection to 10.148.185.170 443 port [tcp/https] succeeded!
Shuzheng
  • 4,023
  • 1
  • 31
  • 71
  • am I correct to understand that you want to route all your container's traffic thru VPN, while at the same time, your main host should be OUT of VPN? – dgan Mar 25 '21 at 08:59
  • @dgan - The container's traffic to `10.0.0.0/8` are normally routed through the VPN – Shuzheng Mar 25 '21 at 09:23

0 Answers0