diff options
author | Marco Ceresa <ceresa@gmail.com> | 2010-05-14 10:36:03 +0100 |
---|---|---|
committer | Marco Ceresa <ceresa@gmail.com> | 2010-05-14 10:36:03 +0100 |
commit | 3d841526376d341e54bec0a2acd7fdf2cb86a5a3 (patch) | |
tree | 2a361a516d243d7d892fc9f527b1065a735efd5f /README.rdoc | |
parent | 2bab73454b056daec31c880d91419f7a44957309 (diff) | |
download | ipaddress-3d841526376d341e54bec0a2acd7fdf2cb86a5a3.tar.gz |
Finished Network Design documentation part in README.rdoc
Diffstat (limited to 'README.rdoc')
-rw-r--r-- | README.rdoc | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/README.rdoc b/README.rdoc index 7082a32..892ad27 100644 --- a/README.rdoc +++ b/README.rdoc @@ -376,6 +376,100 @@ We can go even further and divide into 11 subnets: As you can see, most of the networks are /28, with a few /27 and one /26 to fill up the remaning space. +=== Summarization + +Summarization (or aggregation) is the process when two or more +networks are taken together to check if a supernet, including +all and only these networks, exists. If it exists then this supernet +is called the summarized (or aggregated) network. +It is very important to understand that summarization can only +occur if there are no holes in the aggregated network, or, in +other words, if the given networks fill completely the address space +of the supernet. So the two rules are: + + 1) The aggregate network must contain +all+ the IP addresses of the + original networks; + 2) The aggregate network must contain +only+ the IP addresses of the + original networks; + +A few examples will help clarify the above. Let's consider for +instance the following two networks: + + ip1 = IPAddress("172.16.10.0/24") + ip2 = IPAddress("172.16.11.0/24") + +These two networks can be expressed using only one IP address +network if we change the prefix. Let Ruby do the work: + + IPAddress::IPv4::summarize(ip1,ip2).to_s + #=> "172.16.10.0/23" + +We note how the network "172.16.10.0/23" includes all the +addresses specified in the above networks, and (more important) includes +ONLY those addresses. + +If we summarized +ip1+ and +ip2+ with the following network: + + "172.16.0.0/16" + +we would have satisfied rule #1 above, but not rule #2. So + + "172.16.0.0/16" + +is not an aggregate network for +ip1+ and +ip2+. + +If it's not possible to compute a single aggregated network for +all the original networks, the method returns an array with all the +aggregate networks found. For example, the following four networks can be +aggregated in a single /22: + + ip1 = IPAddress("10.0.0.1/24") + ip2 = IPAddress("10.0.1.1/24") + ip3 = IPAddress("10.0.2.1/24") + ip4 = IPAddress("10.0.3.1/24") + + IPAddress::IPv4::summarize(ip1,ip2,ip3,ip4).to_s + #=> "10.0.0.0/22", + +But the following networks can't be summarized in a single +network: + + ip1 = IPAddress("10.0.1.1/24") + ip2 = IPAddress("10.0.2.1/24") + ip3 = IPAddress("10.0.3.1/24") + ip4 = IPAddress("10.0.4.1/24") + IPAddress::IPv4::summarize(ip1,ip2,ip3,ip4).map{|i| i.to_s} + #=> ["10.0.1.0/24","10.0.2.0/23","10.0.4.0/24"] + +In this case, the two summarizables networks have been aggregated into +a single /23, while the other two networks have been left untouched. + +=== Supernetting + +Supernetting is a different operation than aggregation, as it only +works on a single network and returns a new single IPv4 object, +representing the supernet. + +Supernetting is similar to subnetting, except that you getting as a +result a network with a smaller prefix (bigger host space). For +example, given the network + + ip = IPAddress("172.16.10.0/24") + +you can supernet it with a new /23 prefix + + ip.supernet(23).to_s + #=> "172.16.10.0/23" + +However if you supernet it with a /22 prefix, the network address will +change: + + ip.supernet(22).to_s + #=> "172.16.8.0/22" + +This is because "172.16.10.0/22" is not a network anymore, but an host +address. + =IPv6 Coming soon |