Thanks Eddie, let me see if I understand...I can actually ftp into my router so creating folders etc should be easy:
create a script file and syntax using the commands bellow, dropping the echos and any other referencing to the script including the "".
call it up.sh(and ensure to chmod 700)
#!/bin/sh
iptables -t nat -I POSTROUTING -o tun1 -j MASQUERADE
ip route show table main | grep -Ev ^default | while read ROUTE ; do ip route add table 25 $ROUTE; done"
gvip=$(ifconfig | grep -A 1 tun1 | grep inet | cut -d: -f3 | cut -d' ' -f1)
ip route add table 25 default via $gvip dev tun1
ip rule add from 192.168.0.109 table 25
ip rule add to 66.171.248.172 table main
ip route flush cache
Then create a directory using your example /tmp/ovpn
Then upload the script created above into this directory /tmp/ovn, i.e. in the up directory there will be a file called up.sh and do the same for the down script.
How will I call this script automatically? up or down...maybe in the advanced setting of OpenVPN, the system has to know when it starts it runs the up and when it resets it calls the down command.
Thanks
EddieA wroteThat script creates a "canned" up and down script, which I have no idea of the contents. (Comments are mine):
mkdir /tmp/ovpn # Create a temporary directory
cd /tmp/ovpn # Make it the current directory
nvram get ovpn_up>up # Use program nvram to copy a file called ovpn_up to a new file in the current directory called up.
nvram get ovpn_dn>dn # Ditto with down
chmod +x up dn # Make those 2 new files executable
Which it then refers to in the configuration:
route-up "/tmp/ovpn/up" # At this point in the VPN start-up, execute this script
down "/tmp/ovpn/dn" # At this point in the VPN shutdown, execute this script.
There's nothing stopping you creating any other scripts, as well as, or instead of, "up" and "down".
Then in the configuration, you say which script you want run at which point in the VPN startup or shutdown.
Basic Linux scripting.
Cheers.