Redirecting all traffic from a specified device via VPN (L2TP)

Hi all!

Guys, I need a case for forwarding all traffic from one device via my vpn (l2tp) tunnel.

I’ve the next:

  1. VPS with L2TP server - 10.0.0.1
  2. Mikrotik with L2TP client - 10.0.0.2 (192.168.0.1)
  3. Routes into vps and vice versa

What I need:

Redirect one (or maybe several in the future) device from my local network through an existing VPN route, so that this device can access the Internet ONLY via VPN. Current IP address of this device is 192.168.0.222

ksnip_20231108-124202.png
PS I tried different options proposed here on the forum, where the type of VPN and the task were similar, but I don’t understand what else is necessary in my case, since the options indicated here did not solve the problem for me.

Thanks!

Post your config

Hi, which section should I provide from the configuration?

I began to understand in more detail, and tried to do the following…

I have two external Mikrotiks, which are also connected to me via l2tp, and they see each other through my Mikrotik using masquerading: network xxx.xxx.1.0 sees network xxx.xxx.2.0 through me and vice versa.

I tried to add prerouting in Mangle for my device 0.222 with the marking test and added a route where I specified the network gateway 1.0 (I also tried 2.0) and with the marking test - everything works, my device from my network with address 0.222 accesses the Internet via Mikrotik 1.0 or 2.0 WANs.

But with my VPS the Internet is falling off. I think the issue is on the side of the VPS and the correct routing rules. I’m still digging in this direction.

On most VPN clients like a windows/mac machines you can choose that on an advanced setup tab.

FYI it’s called split tunneling
https://cybernews.com/what-is-vpn/split-tunneling/

We’re not talking about setting up routes on the client side here. :open_mouth: