OpenVpn to allow a particular ip address

echo "100 vpn" >> /etc/iproute2/rt_tables

Add the following rule and routes in /etc/config/network

config rule
        option in     'lan'
	option src   '192.168.1.5/32'
	option lookup '100'

config 'route' 'name_your_route'
        option 'interface' 'vpn'
        option 'target' '0.0.0.0'
        option 'netmask' '0.0.0.0'
        option 'gateway' 'gw_to_the_vpn'
        option 'table' '100'

config 'route' 'lan route'
        option 'interface' 'lan'
        option 'target' '192.168.1.0'
        option 'netmask' '255.255.255.0'
        option 'table' '100'

Restart network.

2 Likes