Community discussions

MikroTik App
 
epg18
just joined
Topic Author
Posts: 1
Joined: Tue Feb 20, 2024 11:59 am

Help with OpenVPN. Route all traffic through the VPN

Tue Feb 20, 2024 12:21 pm

I have an OpenVPN Server on a Mikrotik router. I have created the .ovpn file and when I connect from a Windows Client, the connection is successful, but it does not route all traffic through the VPN. This is why I cannot access the IPs of my internal network, nor do I access the internet from the public IP of the Server. I have also tried with the OpenVPN client for Android and get the same result.
Searching online, I found that if I add the line "redirect-gateway def1" in the ovpn configuration file on the client, it should route all traffic through the VPN.
In the case of Android, it works, and I can now access the IPs of the internal network, as well as accessing the internet through the public IP of the Server.
But in the case of Windows Clients, it doesn't work. I have tried on different PCs, and with different versions of Windows.
When I look at the IP route tables, I see that the VPN client does not add its route with higher priority, maintaining the route with the gateway of my internet adapter as more prioritized.
All traffic should be routed through the VPN IP (10.70.0.1).
Could someone please help me? Thank you very much!

IP route table before connecting to the VPN:
IPv4 Tabla de enrutamiento
===========================================================================
Rutas activas:
Destino de red Máscara de red Puerta de enlace Interfaz Métrica
0.0.0.0 0.0.0.0 192.168.128.186 192.168.128.253 25
127.0.0.0 255.0.0.0 En vínculo 127.0.0.1 331
127.0.0.1 255.255.255.255 En vínculo 127.0.0.1 331
127.255.255.255 255.255.255.255 En vínculo 127.0.0.1 331
192.168.128.0 255.255.255.0 En vínculo 192.168.128.253 281
192.168.128.253 255.255.255.255 En vínculo 192.168.128.253 281
192.168.128.255 255.255.255.255 En vínculo 192.168.128.253 281
224.0.0.0 240.0.0.0 En vínculo 127.0.0.1 331
224.0.0.0 240.0.0.0 En vínculo 192.168.128.253 281
255.255.255.255 255.255.255.255 En vínculo 127.0.0.1 331
255.255.255.255 255.255.255.255 En vínculo 192.168.128.253 281
===========================================================================

IP route table after connecting to the VPN:
IPv4 Tabla de enrutamiento
===========================================================================
Rutas activas:
Destino de red Máscara de red Puerta de enlace Interfaz Métrica
0.0.0.0 0.0.0.0 192.168.128.186 192.168.128.253 25
0.0.0.0 128.0.0.0 10.70.0.1 192.168.100.188 257
2.136.19X.XXX 255.255.255.255 192.168.128.186 192.168.128.253 281
127.0.0.0 255.0.0.0 En vínculo 127.0.0.1 331
127.0.0.1 255.255.255.255 En vínculo 127.0.0.1 331
127.255.255.255 255.255.255.255 En vínculo 127.0.0.1 331
128.0.0.0 128.0.0.0 10.70.0.1 192.168.100.188 257
192.168.100.0 255.255.255.0 En vínculo 192.168.100.188 257
192.168.100.188 255.255.255.255 En vínculo 192.168.100.188 257
192.168.100.255 255.255.255.255 En vínculo 192.168.100.188 257
192.168.128.0 255.255.255.0 En vínculo 192.168.128.253 281
192.168.128.253 255.255.255.255 En vínculo 192.168.128.253 281
192.168.128.255 255.255.255.255 En vínculo 192.168.128.253 281
224.0.0.0 240.0.0.0 En vínculo 127.0.0.1 331
224.0.0.0 240.0.0.0 En vínculo 192.168.100.188 257
224.0.0.0 240.0.0.0 En vínculo 192.168.128.253 281
255.255.255.255 255.255.255.255 En vínculo 127.0.0.1 331
255.255.255.255 255.255.255.255 En vínculo 192.168.100.188 257
255.255.255.255 255.255.255.255 En vínculo 192.168.128.253 281
===========================================================================
 
User avatar
patrikg
Member
Member
Posts: 362
Joined: Thu Feb 07, 2013 6:38 pm
Location: Stockholm, Sweden

Re: Help with OpenVPN. Route all traffic through the VPN

Tue Feb 20, 2024 1:10 pm

You can prioritize the default gw vpn traffic with the metric value on the interface.

https://forums.openvpn.net/viewtopic.php?t=9191

There also some another options like autolocal.
Like this
redirect-gateway autolocal

Who is online

Users browsing this forum: Qanon, sindy, tornadoro and 28 guests