Hi. I know virtually nothing about scripting and need some help. I used to have a script to enable split-tunneling when connected to a VPN. It worked great until I got this new machine running Sonoma. Now it won’t run even though the commands work fine when run as Sudo in Terminal.
This is the script text:
$ cat vpn.sh
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo “Run this as root”
exit 1
fi
route -nv add -net 192.168.2.0/24 -interface ppp0
route -nv add -net 192.168.3.0/24 -interface ppp0
route change default 192.168.1.1
When I try to recreate the script I get an error about syntax. Since I know nothing about scripting, I have no way to troubleshoot.
I’m sure someone is going to ask why I want to do this when I could just enable split tunneling in the VPN settings. Well, that’s easy. If split tunneling is enabled, I can’t connect to my computer on the other end. That’s just how our IT department set things up. But leaving split tunneling disabled and adding the routes via terminal works great, except I have to do it every time I connect.
It used to be that I had the script run on startup and that was enough. Now I think I may need to have it run every time I connect the VPN.
If there’s a better way to make these routes persistent, I’m all eyes (on the screen to read the responses).