hwdsl2 / setup-ipsec-vpn

Scripts to build your own IPsec VPN server, with IPsec/L2TP, Cisco IPsec and IKEv2
Other
25.3k stars 6.32k forks source link

I have a question I would like to know #1420

Closed kuesttman closed 1 year ago

kuesttman commented 1 year ago

Hello, I don't know if it's the right place. But first, I would like to thank and congratulate you. Your script is incredible. And it's helping me a lot.

I have a question I would like to know.

I need to add a route on my server, pointing to a client, for me to have access to the networks that my client has access to.

My client is a Mikrotik Routeros. I configured it with L2TP/Ipsec, and configured it on my linux server: "sudo ip route add 172.20.0.0/24 via 192.168.42.10"

And it was working perfectly.

But I changed to VPN IKEv2, and tried to perform the same configuration "sudo ip route add 172.16.0.0/24 via 192.18.43.10"

But it shows an error, and I can't add the route: "Error: Nexthop has invalid gateway"

Can you tell me if I'm configuring it wrong? Or how can I add this route to work with IKEv2 VPN.

From the documentation, I know that my server does not have a gateway IP for the range 192.168.43.0/24

So how could I do this in my scenario?

hwdsl2 commented 1 year ago

@kuesttman Hello! For your use case, IPsec/L2TP mode uses xl2tpd and ppp, which creates a point to point network interface after the VPN connection is established. This may be why you can add a route using "ip route add".

IKEv2 mode, on the other hand, does not create a new point to point network interface, so you may be unable to add a route to the network behind the VPN client. Unfortunately, I am not aware of a good solution for this. But you can try other solutions such as WireGuard or OpenVPN.