Trouble setting routing for openvpn gateway

Hi. I have set up openvpn VPN connection with route-nopull option since it replaced my default gateway. I want all connections from LAN2 to go trough this VPN. I checked gateway IP before setting route-nopull and set this gateway as gateway for LAN2 but openwrt seems to igrore that. How to use diffrent gateway for specific interface?

Policy-Based routing.

Thanks, basing on this https://blog.scottlowe.org/2013/05/29/a-quick-introduction-to-linux-policy-routing/
i have added table 50 vpn to rt_tables and following options to openvpn config

route-up "/sbin/ip route add 0.0.0.0/0 dev tun33 table vpn"
down "/sbin/ip route delete 0.0.0.0/0 dev tun33 table vpn"

added NAT for VPN and added folowing routing rule

config rule
option lookup 'vpn'
option dest '0.0.0.0/0'
option priority '10'
option src '192.168.33.0/24'

and set my LAN2 interface to use "vpn" routing table

And it seems to work :slight_smile:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.