Skip to content

Instantly share code, notes, and snippets.

@Informatic Informatic/change-metric.sh Secret
Created Dec 12, 2018

Embed
What would you like to do?
#!/bin/bash
#
# Replace all metrics for all routes on this openvpn connection.
#
# Usage:
#
# script-security 2
# up "/etc/openvpn/change-metric.sh 3000"
# route-up "/etc/openvpn/change-metric.sh 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"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.