What's new

How to setup VPN client routes via SSH

  • 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!

RickyPullan

New Around Here
My end goal is to route all traffic hitting a specific media service through my VPN client.

I've got a list of IPs that is dynamically updated using this service's various URLs.
I'd like to force any traffic coming from any device on my network that is destined for one of these IPs, to go over the VPN rather than the WAN. I realize that I can do this through the GUI, but I'm hoping there is way to do this via SSH. Since the list I've got is dynamic, I'd like to automate the update process for the IP routes.

Any help would be GREATLY appreciated!
 
My end goal is to route all traffic hitting a specific media service through my VPN client.
@Xentrk's Selective Routing script option 3 will allow you to do just that. Instructions and the script(s) at:
Code:
https://github.com/Xentrk/x3mRouting

It can also be installed through 'amtm' item 6.
 
I assume you're presently using Routing Policy and this is for those clients NOT already bound to the VPN.

Since this only requires adding static routes, it' a simple matter to create a script (or even just a one-liner).

Assuming you have a file w/ a list of public IPs (one per line)...

Code:
while read ip; do ip route add $ip dev tun11; done < /path/filename

Of course, I'm assuming OpenVPN client #1 (tun11) for illustration purposes. You could get fancier and perhaps delete the old routes before adding the new ones.
 

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