-
Notifications
You must be signed in to change notification settings - Fork 20
/
aggregate6.7
95 lines (89 loc) · 2.68 KB
/
aggregate6.7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "AGGREGATE6" "7" "December 2017" "" ""
aggregate6 will compress an unsorted list of IP prefixes (both IPv4 and IPv6)\.
.
.SH "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, \fB2001:67c:208c:10::/64\fR would be removed if \fB2001:67c:208c::/48\fR was also supplied\.
.
.P
The second optimisation identifies adjacent prefixes that can be combined under a single, shorter\-length prefix\. For example, \fB2001:67c:208c::/48\fR and \fB2001:67c:208d::/48\fR can be combined into the single prefix \fB2001:67c:208c::/47\fR\.
.
.P
The above optimalisation steps are often useful in context of compressing firewall rules or BGP prefix\-list filters\.
.
.P
The following command line options are available:
.
.IP "" 4
.
.nf
\-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
.
.fi
.
.IP "" 0
.
.SH "Installation"
OpenBSD 6\.3:
.
.P
\fB$ doas pkg_add aggregate6\fR
.
.P
Other platforms:
.
.P
\fB$ pip3 install aggregate6\fR
.
.SH "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\.
.
.IP "" 4
.
.nf
$ # 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
.
.fi
.
.IP "" 0
.
.SH "Library Usage"
Aggregate6 can be used in your own pyp/python2/python3 project as python module\. Currently there is just one simple public function: \fBaggregate()\fR which takes a list as parameter\.
.
.IP "" 4
.
.nf
>>> import from aggregate6 import aggregate
>>> aggregate(["10\.0\.0\.0/8", "10\.0\.0\.0/24"])
[\'10\.0\.0\.0/8\']
>>>
.
.fi
.
.IP "" 0
.
.SH "Bugs"
Please report bugs at https://github\.com/job/aggregate6/issues
.
.SH "Author"
Job Snijders \fIjob@instituut\.net\fR