What's new

Pavadan Firmware script help

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Rick Mathes

Regular Contributor
I have an Asus RT-N56U with latest Pavadan firmware on it. I have it working fine to route all connections through my PIA vpn. My problem is I only want to run one device through the vpn connection. On my Asus RT-Ac68U it was simple but on this router I have to use a script. There are some examples but I am still totally confused. Any help would be greatly appreciated. Below are the examples within the firmware. I just want to route 192.168.1.200 to my vpn. Thanks in advance.

#!/bin/sh

### Custom user script
### Called after internal VPN client connected/disconnected to remote VPN server
### $1 - action (up/down)
### $IFNAME - tunnel interface name (e.g. ppp5 or tun0)
### $IPLOCAL - tunnel local IP address
### $IPREMOTE - tunnel remote IP address
### $DNS1 - peer DNS1
### $DNS2 - peer DNS2

# private LAN subnet behind a remote server (example)
peer_lan="192.168.9.0"
peer_msk="255.255.255.0"

### example: add static route to private LAN subnet behind a remote server

func_ipup()
{
# route add -net $peer_lan netmask $peer_msk gw $IPREMOTE dev $IFNAME
return 0
}

func_ipdown()
{
# route del -net $peer_lan netmask $peer_msk gw $IPREMOTE dev $IFNAME
return 0
}

logger -t vpnc-script "$IFNAME $1"

case "$1" in
up)
func_ipup
;;
down)
func_ipdown
;;
esac
 
example code:
Code:
# By default all traffic bypasses the VPN
iptables -t mangle -A PREROUTING -i br0 -j MARK --set-mark 1
 
# explicitly uses the VPN
iptables -t mangle -A PREROUTING -i br0 -m iprange --dst-range 78.31.8.1-78.31.15.254 -j MARK --set-mark 0
iptables -t mangle -A PREROUTING -i br0 -m iprange --dst-range 193.182.8.1-193.182.15.254 -j MARK --set-mark 0

of course you will need to substitute the IPs/Range and the ethernet's device name
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top