a wireguard split tunnel script
This is a simple bash script that utilizes Linux network namespaces to selectively split tunnel applications.
- Require root permissions
- You must also edit the script's
$IFvariable to the external interface you're using (i.e.eth0). I'm currently usingeno1, and therefore, the script is set to useeno1
stun --init -i | --destroy -d
--init | -i Must be run before using exec. Create a new network namespace for split tunneling, along with other stuff to make this all work.
--destroy | -d Destroys the network namespace for split tunneling.
stun COMMAND
Run command in the split tunnel network namespace.
$ curl ifconfig.me
-> Your VPN's ip :(
# stun --init
# stun curl ifconfig.me
-> Your residential ip :)