lindstrom :
You access the command line with ssh and according to your other post you have already created the script on the router. chmod 755 will set permissions to the file, user have full permissions, group and everyone else has read and execute permissions. As stated, you should set the vpn devices outside the dhcp pool and they should match the iptables rule. Your issue most likely is that you have not set static IP to the vpn devices which is why the scripts doesnt work correctly, the scripts changes the static ip on the vpn devices to dhcp.
Thanks for responding. Anyway, I finally managed to input the code in my SSH session via the command line as well as configure my selected devices to operate outside the DHCP pool when I want them to. Unfortunately, now my problem is that whenever I turn on the VPN client all my devices go through it instead of only the ones I've specified.
*sigh* This is getting tiring. Can anyone tell me what's wrong with this script?
#!/bin/sh
ip route flush table 11
ip route del default table 11
ip route flush cache
tun11_ip=$(ifconfig tun11 | grep 'inet addr:'| cut -d: -f2 | awk '{ print $1}')
ip route add default via $tun11_ip dev tun11 table 11
ip rule add from 192.168.xx.xx table 11
ip rule add from 192.168.xx.xx table 11
ip route flush cache
DNS_SERVER="208.67.222.222 208.67.220.220"
for ip in $DNS_SERVER
do
iptables -t nat -A PREROUTING -s 192.168.xx.xx -p udp --dport 53 -j DNAT --to $ip
iptables -t nat -A PREROUTING -s 192.168.xx.xx -p tcp --dport 53 -j DNAT --to $ip
iptables -t nat -A PREROUTING -s 192.168.xx.xx -p udp --dport 53 -j DNAT --to $ip
iptables -t nat -A PREROUTING -s 192.168.xx.xx -p tcp --dport 53 -j DNAT --to $ip
done
iptables -I FORWARD ! -o tun11 -s 192.168.xx.xx -j DROP
exit 0