Hi Everyone!
Please tell me how can I preroute all traffics on local device to VPN connection?
for example my device IP: 192.168.1.95
I want all the packets sent and received by this device to be done through VPN
Good Morning,
what kind of VPN are you using ?
Can you Post your Config ?
/ip firewall nat
add chain=srcnat out-interface=l2tp-out1 action=masquerade
/ip route
add gateway=l2tp-out1 routing-mark=via-l2tp
/ip route rule
add src-address=192.168.1.95 action=lookup-only-in-table table=via-l2tp
Depending on your current configuration, you may need to place the firewall rule and the routing rule to a proper position among the other rules in the respective tables and chains.
You could use /ip firewall mangle rules as well, but it would be a bit slower and a bit more complex. So it only makes sense to use mangle rules to assign routing-marks when you need to be able to take into account finer details, like protocol and port, or when you need address lists, or when you need to distribute the traffic among several paths.
Sindy, thanks a lot for these commands! It was the only solution that worked for me among others./ip firewall nat
add chain=srcnat out-interface=l2tp-out1 action=masquerade
/ip route
add gateway=l2tp-out1 routing-mark=via-l2tp
/ip route rule
add src-address=192.168.1.95 action=lookup-only-in-table table=via-l2tp
If you mean something like *.domain.com, I'm afraid there is even no reliable one, let alone simple. It is quite common that multiple services using different domains use same IP addresses. So e.g. it is not possible to treat youtube differently from google search.What is the simplest way to exclude a domain from being routed through VPN here?