Bypass VPN for one address to a SOCKS 5 Proxy?

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
Rocktek
DD-WRT Novice


Joined: 29 Jun 2017
Posts: 12

PostPosted: Tue Aug 01, 2017 18:55    Post subject: Bypass VPN for one address to a SOCKS 5 Proxy? Reply with quote
Hi, been searching for an answer to my problem which seems quite simple in theory but I'm a novice at networking.

I have OpenVPN set up with most traffic going through that apart from selected devices(firewall script), this is working but for one particular server which needs lower latency so performance isn't reliable enough for this purpose.

I have found a startup script that will exclude selected addresses and route them through my WAN IP(ISP) but I want to tailor this script to send the selected addresses over a SOCKS 5 Proxy instead.

Quote:
SCRIPT_DIR="/tmp/etc/config"
SCRIPT="$SCRIPT_DIR/add-routes.wanup"
mkdir -p $SCRIPT_DIR

cat << "EOF" > $SCRIPT
#!/bin/sh

# dd-wrt selective domain routing
WAN_GW="$(nvram get wan_gateway)"

# list domains for selective routing
for domain in \
"netflix.com" \
"ichnaea.netflix.com" \
"movies.netflix.com" \
"www.netflix.com" \
"nflxext.com" \
"cdn1.nflxext.com" \
"nflximg.com" \
"nflxvideo.net" \
"ipv4_1.cxl0.c145.sjc002.ix.nflxvideo.net"
do
# extract ip addresses
for ip in $(nslookup $domain | awk '/^Name:/,0{if (/^Addr/)print $3}'); do
# add class c route for each ip address to wan gateway
ip route add `echo $ip | cut -d . -f 1,2`.0.0/16 via $WAN_GW
done
done

# flush cache
ip route flush cache
EOF

chmod +x $SCRIPT
sleep 60
$SCRIPT


I'm guessing the part I've highlighted in bold is the part I need to change, do I just change the part that says "via $WAN_GW" to a SOCKS 5 address? If I'm using my VPN providers SOCKS 5 address I'd need to authenticate the connection somewhere too wouldn't I?

Any help with this would be appreciated.
Sponsor
Rocktek
DD-WRT Novice


Joined: 29 Jun 2017
Posts: 12

PostPosted: Wed Aug 09, 2017 4:22    Post subject: Reply with quote
Still looking for help with this:

Code:
#!/bin/sh
echo USERNAMEHERE > /tmp/userpass.txt
echo PASSWORDHERE >> /tmp/userpass.txt

SCRIPT_DIR="/tmp/etc/config"
SCRIPT="$SCRIPT_DIR/add-routes.wanup"
mkdir -p $SCRIPT_DIR

cat << "EOF" > $SCRIPT
#!/bin/sh

# dd-wrt selective domain routing
WAN_GW="$(nvram get wan_gateway)"

# list domains for selective routing
for domain in \
"whatsmyip.org" \
"iptvserver.com"
do
  # extract ip addresses
  for ip in $(nslookup $domain | awk '/^Name:/,0{if (/^Addr/)print $3}'); do
    # add class c route for each ip address to wan gateway
    ip route add `echo $ip | cut -d . -f 1,2`.0.0/16 via uk104.nordvpn.com 1080 userpass.txt
  done
done

# flush cache
ip route flush cache
EOF

chmod +x $SCRIPT
sleep 60
$SCRIPT


Any ideas how I can authenticate to allow me to connect?
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum