IP Anonymization breaks important structure when it anonymizes IP address
inside of interface addresses or NAT pools. For example, a link 10.0.0.1/30
and 10.0.0.2/30 will be broken 3/4 of the time because one of the IPs may
get anonymized to 10.0.0.0 (the network address) or 10.0.0.3 (the broadcast
address).
Similarly, a NAT pool like 10.0.0.0 to 10.0.0.5 might get anonymized to
10.0.0.7 to 10.0.0.1, which is invalid (backwards) and would have a different
size if we flipped the end points. This can be especially problematic for
Static NAT if we map both start and end IPs: 1.1.1.1-1.1.1.5 and 2.2.2.1-2.2.2.5.
There is no guarantee that after anonymization, the pools will be the same size!
To fix this, users can use the --preserve-host-bits B flag to prevent
netconan from anonymizing the last B bits of an IP Address (v4 or v6). That means
that while the prefix of each IP address is anonmyized, the last B bits are not.
As long as B is greater than 2, a /30 will never be disconnected by anonymization.
We choose B=8 by default as this captures most interface addresses (/24) and NAT
pool sizes.
IP Anonymization breaks important structure when it anonymizes IP address inside of interface addresses or NAT pools. For example, a link 10.0.0.1/30 and 10.0.0.2/30 will be broken 3/4 of the time because one of the IPs may get anonymized to 10.0.0.0 (the network address) or 10.0.0.3 (the broadcast address).
Similarly, a NAT pool like 10.0.0.0 to 10.0.0.5 might get anonymized to 10.0.0.7 to 10.0.0.1, which is invalid (backwards) and would have a different size if we flipped the end points. This can be especially problematic for Static NAT if we map both start and end IPs: 1.1.1.1-1.1.1.5 and 2.2.2.1-2.2.2.5. There is no guarantee that after anonymization, the pools will be the same size!
To fix this, users can use the --preserve-host-bits B flag to prevent netconan from anonymizing the last B bits of an IP Address (v4 or v6). That means that while the prefix of each IP address is anonmyized, the last B bits are not. As long as B is greater than 2, a /30 will never be disconnected by anonymization.
We choose B=8 by default as this captures most interface addresses (/24) and NAT pool sizes.
This change is![Reviewable](https://reviewable.io/review_button.svg)