Skip to content

Instantly share code, notes, and snippets.

@r-k-b
Created May 29, 2016 06:32
Show Gist options
  • Save r-k-b/e35f90d09dc998a74f6fbd2ce6d016b7 to your computer and use it in GitHub Desktop.
Save r-k-b/e35f90d09dc998a74f6fbd2ce6d016b7 to your computer and use it in GitHub Desktop.
Toggle the default route to be through a particular IP. Quickly switches between active ADSL & 4G connections with minimal disruption.
#!/bin/bash
if ip route list | grep 'default via 192.168.1.68' 1>/dev/null
then
ip route del default via 192.168.1.68 &&
echo Removed adsl default route.
else
ip route add default via 192.168.1.68 &&
echo Added adsl default route.
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment