Skip to content

Instantly share code, notes, and snippets.

@marcaurele
Created February 12, 2021 13:29
Show Gist options
  • Save marcaurele/2e94663cad71b6195a23ed19681a4fc6 to your computer and use it in GitHub Desktop.
Save marcaurele/2e94663cad71b6195a23ed19681a4fc6 to your computer and use it in GitHub Desktop.
Inject AWS ip ranges into your VPN static routes

AWS routes insertion in NetworkManager

Change <vpn-name> with your VPN's name.

For IPv4 ranges

# IPv4
curl --silent https://ip-ranges.amazonaws.com/ip-ranges.json \
  | jq -r '.prefixes | .[].ip_prefix' \
  | tr '\n' ',' \
  | sed 's/,$//' \
  | xargs nmcli connection modify <vpn-name> ipv4.routes

For IPv6 ranges

# IPv6
curl --silent https://ip-ranges.amazonaws.com/ip-ranges.json \
  | jq -r '.ipv6_prefixes | .[].ipv6_prefix' \
  | tr '\n' ',' \
  | sed 's/,$//' \
  | xargs nmcli connection modify <vpn-name> ipv6.routes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment