Displays all IPv4 Uruguayan networks https://gitlab.com/pilasguru/uy-ip-networks
Find a file
Rodolfo Pilas 065ded73e3 Merge branch 'codex/fix-ip-range' into 'master'
refactor script and add debug output

See merge request pilasguru/uy-ip-networks!2
2026-03-12 00:21:53 +00:00
.gitignore Enables offline execution with pre-downloaded DB 2015-09-10 12:47:55 -03:00
LICENSE Initial commit 2015-09-08 23:24:07 -03:00
README.md refactor script and add debug output 2026-03-11 21:17:29 -03:00
uy-ip-networks.sh refactor script and add debug output 2026-03-11 21:17:29 -03:00

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>