- Shell 100%
|
|
||
|---|---|---|
| .gitignore | ||
| LICENSE | ||
| README.md | ||
| uy-ip-networks.sh | ||
Display all IPv4 networks of Uruguay
This script downloads the latest delegated IPv4 database from lacnic.net and prints the Uruguayan IPv4 ranges as CIDR subnets.
The default output is a plain list of subnets in IP/prefix format, ready to include in firewall software.
Usage:
$ ./uy-ip-networks.sh
$ ./uy-ip-networks.sh 2>/dev/null # Disable status messages
$ ./uy-ip-networks.sh offline # Use local file only
$ ./uy-ip-networks.sh debug # Show validation details on stderr
$ ./uy-ip-networks.sh offline debug # Local file only + validation details
Execution
By default each execution checks the latest MD5 from lacnic.net with curl and compares it against the local database file. If the local database does not exist or the checksum differs, the file is downloaded again.
With the offline switch the script runs only against the local delegated-lacnic-latest file.
With the debug switch the script keeps printing the subnet list to stdout, and additionally writes validation details to stderr. The validation confirms that the CIDR output covers the full amount of delegated IPv4 addresses for Uruguay.
When a delegated block cannot be represented by a single CIDR, the script splits it into the minimum set of aligned subnets required to cover the entire range exactly.
License
The MIT License (MIT)
Copyright (c) 2015 Rodolfo Pilas <rodolfo@pilas.guru>