#!/bin/bash table=10 tun_dev=$1 tun_mtu=$2 link_mtu=$3 ifconfig_local_ip=$4 ifconfig_remote_ip=$5 echo "Routing client $ifconfig_local_ip traffic through VPN" ip rule add from $ifconfig_local_ip priority 10 table $table ip route add ifconfig_local_ip dev $tun_dev table $table ip route add default via $ifconfig_remote_ip dev $tun_dev table $table ip route flush cache