AGGREGATE6(7)

πŸ’– AGGREGATE6 πŸ’–

okay so bestie, meet aggregate6 β€” the little icon that takes your messy unsorted pile of IP prefixes (both IPv4 and IPv6, we love a versatile queen) and compresses them down into something cute and tidy. ✨


🌸 DESCRIPTION 🌸

So here's the vibe: you pipe a list of IPv6 prefixes in conventional format into it on stdin, and it runs two optimisations to try and shrink that prefix list down. Two. Because one was simply not enough. πŸ’…

Optimisation numero uno: it yeets any prefixes that are straight-up superfluous, i.e. ones already covered by another prefix you handed it. Example, because examples are everything:

  • 2001:67c:208c:10::/64 would get removed if 2001:67c:208c::/48 was also supplied. Like, girl, you're already in there. 🫢

Optimisation numero dos: it hunts down adjacent prefixes that can be smooshed together under a single, shorter-length prefix. For example:

  • 2001:67c:208c::/48 and 2001:67c:208d::/48 can be combined into the single prefix 2001:67c:208c::/47. ✨ iconic behaviour, no notes ✨

These optimalisation steps (yes we're spelling it like that, that's the original, periodt) are often useful in context of compressing firewall rules or BGP prefix-list filters. 🧚

The following command line options are available:

  • -4 β€” Only output IPv4 prefixes
  • -6 β€” Only output IPv6 prefixes
  • -h, --help β€” show help message and exit
  • -m N β€” Sets the maximum prefix length for entries read, longer prefixes will be discarded prior to processing
  • -t β€” truncate IP/mask to network/mask
  • -v β€” Display verbose information about the optimisations
  • -V β€” Display aggregate6 version

πŸŽ€ INSTALLATION πŸŽ€

OpenBSD 6.3:

$ doas pkg_add aggregate6

Other platforms:

$ pip3 install aggregate6

πŸ¦‹ CLI USAGE πŸ¦‹

Either provide the list of IPv4 and IPv6 prefixes on STDIN, or give filenames containing lists of IPv4 and IPv6 prefixes as arguments. Both. Either. Whatever feels right for you, bestie. πŸ’–

$ # via STDIN
$ cat file_with_list_of_prefixes | aggregate6
   ... output ...

$ # with a filename as argument
$ aggregate6 file_with_list_of_prefixes [ ... optional_other_prefix_lists ]
   ... output ...

$ # Whitespace separated works too
$ echo 2001:67c:208c::/48 2000::/3 | aggregate6
2000::/3

$ # You can combine IPv4 and IPv6
$ echo 10.0.0.0/16 10.0.0.0/24 2000::/3 | aggregate6
10.0.0.0/16
2000::/3
ngl the whitespace-separated one is such a serve, it just works 🌈

πŸ’œ LIBRARY USAGE πŸ’œ

Aggregate6 can be used in your own pyp/python2/python3 project as python module. Currently there is just one simple public function: aggregate() which takes a list as parameter. One function. Minimalist. Main character energy fr fr. πŸ‘‘

>>> import from aggregate6 import aggregate
>>> aggregate(["10.0.0.0/8", "10.0.0.0/24"])
[Β΄10.0.0.0/8Β΄]
>>>

πŸ’€ BUGS πŸ’€

Please report bugs at https://github.com/job/aggregate6/issues β€” do NOT suffer in silence, bestie, that's not the vibe. 😭


πŸ‘‘ AUTHOR πŸ‘‘

Job Snijders job@instituut.net


and that's the whole entire page, mwah πŸ’… December 2017, AGGREGATE6(7) β€” go compress some prefixes, you absolute legend πŸŽ€βœ¨πŸ¦‹