Created
April 26, 2021 15:23
-
-
Save jjo/2285e3c6fb3f683fa13b575994595674 to your computer and use it in GitHub Desktop.
This file contains 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/zsh | |
which ip >& /dev/null || { echo "Needs 'brew install iproute2mac'" ; exit 1;} | |
[[ $(id -u) == 0 ]] || { echo "Needs root (sudo)" ; exit 1;} | |
fix() { | |
(set -x | |
ip r $DEL 0.0.0.0/1 via 10.99.0.1 dev utun2 | |
ip r $DEL 128.0.0.0/1 via 10.99.0.1 dev utun2 | |
## Specific routes: | |
# whois $(dig +short github.com)|egrep CIDR | |
ip r $ADD 140.82.112.0/20 via 10.99.0.1 dev utun2 | |
# https://bgp.he.net/net/185.199.108.0/22 | |
ip r $ADD 185.199.108.0/22 via 10.99.0.1 dev utun2 | |
) | |
} | |
case "$1" in | |
""|fix) ADD=add; DEL=del; fix;; | |
unfix) ADD=del; DEL=add; fix;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment