Skip to content

Instantly share code, notes, and snippets.

Created Dec 12, 2018
What would you like to do?
# Replace all metrics for all routes on this openvpn connection.
# Usage:
# script-security 2
# up "/etc/openvpn/ 3000"
# route-up "/etc/openvpn/ 3000" # Alternatively
set -ex
metric="$1"; shift
[[ -z "$dev" ]] && dev="$1" && shift
ip route show dev $dev | while read route; do
ip route del $route dev $dev
ip route add $route dev $dev metric $metric
echo "route [[ $route ]] $metric | $dev"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment