Last active
June 4, 2021 19:24
-
-
Save honwen/6c93c2ca8ed45ea20e53fdf22e18e752 to your computer and use it in GitHub Desktop.
systemd-networkd_google2vpn.sh
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 | |
gw=${1:-123.234.123.234} | |
curl -skSL https://www.gstatic.com/ipranges/goog.json | | |
jq -r '.prefixes[] | .ipv4Prefix | select(length > 0)' | | |
while read cidr; do | |
cat <<EOF | |
[Route] | |
Destination=$cidr | |
Gateway=$gw | |
GatewayOnlink=yes | |
EOF | |
done | |
curl -skSL https://ip-ranges.amazonaws.com/ip-ranges.json | | |
jq -r '.prefixes[] | .ipv4Prefix | select(length > 0)' | | |
while read cidr; do | |
cat <<EOF | |
[Route] | |
Destination=$cidr | |
Gateway=$gw | |
GatewayOnlink=yes | |
EOF | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment