How to route traffic to a gateway on a VPN network?
0
votes
0
answers
471
views
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!
Asked by Shuzheng
(4931 rep)
Mar 25, 2021, 08:27 AM
Last activity: Jan 19, 2023, 01:00 PM
Last activity: Jan 19, 2023, 01:00 PM