I've done this to a set of static IP addresses to access the internet directly, bypassing my VPN, but in this case it should also work to only include the wireless network.
Based on @Lombus post, a wireless interface named DIRECT which is functioning.
So it's a matter of installing the ip
package, and editing /etc/config/network
and /etc/iproute2/rt_tables
, then stopping, reloading and starting services again.
Install ip package:
opkg update
opkg install ip
Define a new routing table named exvpn in/etc/iproute2/rt_tables
, by inserting 10 exvpn
NOTE: Your rt_tables
file may look different but only insert the above.
#
# reserved values
#
128 prelocal
255 local
254 main
253 default
10 exvpn
0 unspec
#
# local
#
#1 inr.ruhep
Add routes and rules in /etc/config/network
:
NOTE:
replace x.x.x.x
with your gateway IP address
replace direct
with your named wireless interface
replace x.x.x
with your wireless interface subnet
# Stage the alternative default route in table exvpn
config route
option interface 'wan'
option target '0.0.0.0'
option netmask '0.0.0.0'
option gateway 'x.x.x.x'
option table 'exvpn'
# Direct the wireless interface 'direct' to table exvpn
config rule
option in 'direct'
option src 'x.x.x.0/24'
option lookup 'exvpn'
stop VPN, reload network, start VPN
/etc/init.d/openvpn stop
/etc/init.d/network reload
/etc/init.d/openvpn start
I tried this briefly using my guest
interface and it seemed to work as intended.