-
-
Save Informatic/1c232b5de86c26448de20e782ea78d71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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