I got it working now!
Used some command from my old thread where I tried to bind transmission (running on OpenWrt) to my vpn. Bind Transmission to VPN using VPN Policy-Based Routing
The problem was that the environmental variables can of course not be called from outside the openvpn instance as they get passed over to the script.
So I added another line which needs to be used if one wants to call the script manually to see if it is working. It is also possible to always read the gateway address from ifconfig of dev_tun but I prefer to use the environmental variables.
route_up.sh
#!/bin/sh
#
############################
# route_up script #
############################
# add static AirVPN routes #
############################
#
# this script adds static routes that route specific clients through AirVPN
# get tun interface config
tun_dev=tun_airvpn
# read gateway from ifconfig, f.e. when manually calling the script
# gateway=`ifconfig | grep -A 5 "tun_airvpn" | grep "inet addr:" | cut -d: -f2 | awk '{ print $1}'`
# get gateway from OpenVPN environmental variables
gateway=${ifconfig_local}
# define clients
client_1=xx.xx.xx.249
# add routes
# client_1
echo "Routing client $client_1 traffic trough AirVPN"
ip rule add from $client_1 priority 10 table airvpn
ip route add $client_1 dev $tun_dev table airvpn
ip route add default via $gateway dev $tun_dev table airvpn
ip route flush cache
route_down.sh
#!/bin/sh
#
###############################
# route_down script #
###############################
# remove static AirVPN routes #
###############################
#
# this script removes static routes that route specific clients through AirVPN
# get tun interface config
tun_dev=tun_airvpn
# read gateway from ifconfig, f.e. when manually calling the script
# gateway=`ifconfig | grep -A 5 "tun_airvpn" | grep "inet addr:" | cut -d: -f2 | awk '{ print $1}'`
# get gateway from OpenVPN environmental variables
gateway=${ifconfig_local}
# define clients
client_1=xx.xx.xx.249
# remove routes
# client_1
echo "Delete client $client_1 traffic routing through AirVPN"
ip rule del from $client_1 priority 10 table airvpn
ip route del $client_1 dev $tun_dev table airvpn
ip route del default via $gateway dev $tun_dev table airvpn
ip route flush cache
Are there any lines that I can remove which are unnecessary?
# add routes
ip rule add from $client_1 priority 10 table airvpn
ip route add $client_1 dev $tun_dev table airvpn
ip route add default via $gateway dev $tun_dev table airvpn
ip route flush cache
# remove routes
ip rule del from $client_1 priority 10 table airvpn
ip route del $client_1 dev $tun_dev table airvpn
ip route del default via $gateway dev $tun_dev table airvpn
ip route flush cache
EDIT:
I just notized that with these rules I am unable to access the webserver (pyload, qbittorrent) running on the client from my Wireguard network. With VPBR it is working.