• Stars
    star
    144
  • Rank 255,590 (Top 6 %)
  • Language
    Python
  • License
    BSD 2-Clause "Sim...
  • Created almost 10 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

IPv4 and IPv6 prefix aggregation tool

Requirements Status Coverage Status

aggregate6

aggregate6 will compress an unsorted list of IP prefixes (both IPv4 and IPv6).

Description

Takes a list of IPv6 prefixes in conventional format on stdin, and performs two optimisations to attempt to reduce the length of the prefix list. The first optimisation is to remove any supplied prefixes which are superfluous because they are already included in another supplied prefix. For example, 2001:67c:208c:10::/64 would be removed if 2001:67c:208c::/48 was also supplied.

The second optimisation identifies adjacent prefixes that can be combined 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.

The above optimalisation steps 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

On EL8 systems you must first install some prerequisites:

$ dnf install gcc install python3-devel platform-python-devel

On EL7 systems you must first install some prerequisites:

$ yum install gcc python3 python3-devel

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.

$ # 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

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.

>>> 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

Author

Job Snijders [email protected]

More Repositories

1

irrexplorer

IRR explorer
Python
77
star
2

irrtree

IRRTree - quickly check potential resource consumption for AS-SETs in the IRR
Python
63
star
3

ipv6-traceroute-faker

An IPv6 ICMPv6 path faker
Python
35
star
4

peerlock

Proof of Concept to help generate AS_PATH filters
Python
32
star
5

rpki-ov-checker

RPKI Origin Validator Comparison tool
Python
29
star
6

peeringmatcher

A command-line tool to quickly discover what IXPs certain ASNs have in common according to PeeringDB
Python
23
star
7

aclhound

ACLHound
Python
19
star
8

rtrsub

RTR Substitution
Python
17
star
9

cdn.openbsd.org-ansible

Ansible playbooks to manage cdn.openbsd.org
Shell
14
star
10

bgp-ansible

Ansible repository for AS 15562 - my personal BGP speakers
Jinja
9
star
11

draft-rpki-communities-harmful

Makefile
6
star
12

console.rpki-client.org

script to generate rpki console website
Perl
5
star
13

rpki-ov-route-map

Python
5
star
14

py-rpsl

Python implementation for some RPSL attributes
Python
4
star
15

roasort

ROA sorter in C
C
3
star
16

ripe-proposal-2018-06

RIPE Policy Proposal 2018-06 Analyser
Python
3
star
17

irr-nonauth-cleanup

IRR Non-Authoritative Cleanup Analyser
Python
3
star
18

draft-sidrops-asgroups

Makefile
2
star
19

draft-rpki-doa

RPKI Discard Origin Authorization
Python
2
star
20

debian-openbgpd

C
2
star
21

gpgpass

Keeps a local GIT repository in sync with a remote and searches GPG encrypted files in the repository for a search string.
Python
2
star
22

py-vrrpd

VRRP implementation in python
2
star
23

draft-sidrops-aspa-slurm

Makefile
2
star
24

draft-sidrops-rrdp-desynchronization

Detecting RRDP Session Desynchronization
Makefile
1
star
25

bird

BIRD dev branches
C
1
star
26

zrbackup

Shell
1
star
27

draft-rfc6482bis

Makefile
1
star
28

draft-snijders-rpsl-via

A new keyword to describe routing policy related to non-adjacent networks
Python
1
star
29

bgpdecoration

Python
1
star
30

rpkitouch

Utility to set file modification times to internal RPKI timestamps
C
1
star
31

draft-rpki-checklists

Python
1
star
32

draft-sidrops-rpki-prefixlist

Makefile
1
star
33

draft-ietf-sidrops-6486bis

HTML
1
star
34

draft-mauch-bgp-reject

HTML
1
star
35

redmirror

redmirrror: HTTP based redirection to mirrors
C
1
star
36

rpkidump

C
1
star
37

draft-rpki-crl-numbers

Handling CRL Numbers in the RPKI
Makefile
1
star