📄 rfc1219.txt
字号:
between the rootAA and a subnetAA. These are the cases where either the rootAA or the subnetAA "grabs" the last growth bit (in the former case because another subnet has been added, and in the latter because another host has been added). Since it is impossible for the rootAA and a subnetAA to simultaneously grab the last growth bit, either one or the other must do it. Finally, note that the following C language style notation is used: & bit-wise AND function == is equal to != is not equal to x-mask(X) the x-mask of X (where x is s or g) Initialize(): Assign the first subnet value to be 0 (the value reserved to mean "this subnet"). This is not assigned to any real subnet. AddSubnet(): 1. Find the lowest non-zero (in MI counting) non-assigned subnet number S such that (S & g-mask(Y)) != (Y & g-mask(Y)) for all existing subnet numbers Y, (Y != S). 2. If all bits in S from the rightmost one bit left are ones, then label all bits to the left of and including one bit position to the right of the rightmost one bit in S to beTsuchiya [Page 7]RFC 1219 On the Assignment of Subnet Numbers April 1991 s-bits. Else, label all bits to the left of and including the rightmost one bit in S to be s-bits. This prevents the "all ones" value (which is the "all subnets" broadcast address) from being assigned to a subnet. (Since no hosts have been added, the rightmost one bit is a subnet bit.) 3. Label all other bits in the address to be g-bits. (By address, we mean that part of the IP address not including the network number.) 4. Set the subnet mask to include at least all s-bits, and optionally some g-bits. The subnet mask must be contiguous. (Section 2.2 discusses the pros and cons of choosing a mask.) 5. For all existing subnet numbers Y (Y != S): 51. If (S & s-mask(Y)) == (Y & s-mask(Y)), then: 511. Change the leftmost g-bit of Y to an s-bit. If the rootAA and YAA (the address authority for Y) are separate AAs, then the YAA must be informed of the change of bit status. If this is the last g-bit, then this change must be coordinated with YAA. 512. Expand the subnet mask for all hosts in Y if necessary (that is, if the subnet mask no longer includes all s-bits). RemoveSubnet(S): 1. Consider B to be the bit position of the rightmost s-bit in S. 2. Remove S. 3. For all existing subnet numbers Y: 31. If the bit in position B is not an s-bit, or if the bit in bit position B is a one, or if the bit in bit position B is a zero and all bits to the left of bit position B are ones, then do nothing (skip steps 32 and 33). 32. Change the s-bit in position B to a g-bit. 33. If for any other existing subnet numbers X (X & s-mask(Y)) == (Y & s-mask(Y)), then change the g-bit in position B back into an s-bit for Y. Else, inform YAA that of the change of bit status. AddHost(S): 1. Create an address A consisting of subnet number S concatenated with zeros. 2. Assign to A the same h-bits, g-bits, and s-bits as the other host addresses. 3. Find the lowest non-zero (using normal counting) non-assigned host number H. 4. If all bits from the leftmost one bit to bit position 0 are ones, then execute steps 5 and 6 using bit position B equals one bit position to the left of the leftmost one bit in H. Else, execute steps 5 and 6 with bit position B equals the leftmost one bit in H. This prevents the "all ones" valueTsuchiya [Page 8]RFC 1219 On the Assignment of Subnet Numbers April 1991 (which is the "all hosts" broadcast address) from being assigned to a host. 5. If bit position B is an s-bit, then the host cannot be added. Skip the remaining steps. 6. If bit position B is a g-bit: 61. Change the g-bit to an h-bit for all hosts in S. Note that if this is the last g-bit, this change must be coordinated with the address authority assigning subnet numbers (see section 2.2). 62. Modify the subnet mask in all hosts if necessary. 7. Create a new address A consisting of S concatenated with H 8. Assign A to the host. RemoveHost(S,H): 1. Remove H. 2. If for all remaining host numbers in S, the value of the bit position of the leftmost h-bit is zero, and there is a zero in at least one of the bit positions to the right of the leftmost h-bit, then for all hosts change the leftmost h-bit into a g-bit. It is worth noting here that this technique is a 2-level subset of the more general n-level kampai addressing [5]. The main difference here is that n-level kampai results in non-contiguous masks, while 2-level does not. In the description of kampai addressing in [5], g-bits are called a-bits, h-bits are called g-bits, and s-bits are called i-bits. 2.2 An Example For this example, we assume a class C network, so we will only need to work with 8 bits. We start with 3 subnets, A, B, and C. Our nomenclature is h for h-bit and g for g-bit. Note that h-bits can be one or zero, but g-bits are all zero. The remaining bits are s-bits, but are shown as 1's and 0's according to the subnet number assignment. The space is just to make the addresses and masks easier to read. Finally, we number our bits 0 to 7 from right to left as shown below. Subnet Address Mask A 10gg ghhh 1111 0000 B 01gg ghhh 1111 0000 C 110g ghhh 1111 0000 bit 7 bit 0 We see that each subnet has at most 6 hosts (because of the three h- bits). Notice that we have chosen the masks so that there is room for growth in both hosts and subnets without requiring a mask change.Tsuchiya [Page 9]RFC 1219 On the Assignment of Subnet Numbers April 1991 However, we have generally allowed for more growth in subnets than in hosts because adding new subnets can cause mask changes in existing subnets, while adding new hosts in a subnet only causes that subnet's mask to change. Further, if a subnet's mask must change, but not all hosts are reconfigured at the same time, then it is less damaging if the not yet reconfigured hosts have too large a mask (too many ones) than if they have too small a mask. This is because with too large a mask, a host may think that another host which is in fact on the subnet is on another subnet. In this case, the host will send packets to the gateway, and will be redirected to the host. However, with too small a mask, a host may think that another host which is in fact not on the subnet is on the subnet, and will ARP for that host but receive no reply. (Note that broadcasts may fail if all masks do not match.) Finally, notice that subnet C requires three s-bits instead of just two. This is because with just two, the subnet address of C could be "11" (rather than "110"), which is a broadcast value. Step 2 of AddSubnet checks for this case. Now, a fourth subnet, D, also with 6 hosts, is added. We get: Subnet Addr Mask A 10gg ghhh 1111 0000 B 01gg ghhh 1111 0000 C 110g ghhh 1111 0000 D 001g ghhh 1111 0000 Notice that none of the original subnets required a change in any of their status bits. This is because, when D compared its subnet number with the others (step 5 of AddSubnet(), using the s-mask), they were all different. In other words, a router would be able to distinguish an address in D from addresses in A, B, and C. Next, a fifth subnet, E, is added. We get: Subnet Addr Mask A 100g ghhh 1111 0000 B 01gg ghhh 1111 0000 C 110g ghhh 1111 0000 D 001g ghhh 1111 0000 E 101g ghhh 1111 0000 Notice that this time, A was forced to change its leftmost g-bit (bit 5) into an s-bit, because bit 5 is needed to distinguish subnet ATsuchiya [Page 10]RFC 1219 On the Assignment of Subnet Numbers April 1991 from subnet E (step 511 of AddSubnet()). Changing bit 5 into an s- bit prevents hosts from being added to A to the point where bit 5 would be changed into a one (that is, step 5 of AddHost() would fail). Notice also that if the masks in A, B, and C were originally set to 1100.0000, then the addition of E would have caused A's mask to change to 1110.0000 (Step 512 of AddSubnet()). Next, 8 hosts each are added to subnets A and C, thus causing the right-most g-bit in each to change to an h-bit. Subnet Addr Mask A 100g hhhh 1111 0000 B 01gg ghhh 1111 0000 C 110g hhhh 1111 0000 D 001g ghhh 1111 0000 E 101g ghhh 1111 0000 Notice again that no masks have changed. If the masks for A, B, and C were originally set to 1111 1000, then they would have required changing (step 62 of AddHost()). Next, enough hosts are added to subnet B that all of its remaining g-bits become h-bits. Subnet Addr Mask A 100g hhhh 1111 0000 B 01hh hhhh 1100 0000 C 110g hhhh 1111 0000 D 001g ghhh 1111 0000 E 101g ghhh 1111 0000 Notice here that the masks in B's subnet had to be changed to accommodate the new h-bits (step 62 of AddHost()). Notice also that if the person assigning host addresses for B (B Address Authority, or BAA) is different than the person assigning network numbers (RootAA), then BAA must coordinate the change of its last g-bit to an h-bit with the RootAA. This allows the RootAA to properly assign additional subnet numbers, as in the next step, where we add another subnet F: Subnet Addr Mask A 100g hhhh 1111 0000 B 01hh hhhh 1100 0000 C 110g hhhh 1111 0000 D 001g ghhh 1111 0000 E 101g ghhh 1111 0000Tsuchiya [Page 11]RFC 1219 On the Assignment of Subnet Numbers April 1991 F 1110 ghhh 1111 0000 Notice that F received subnet number 1110 rather than subnet number 011 (which is what comes after 101 in MI counting). The reason is that 1) 011 is not distinguishable from B's subnet address using B's mask, and 2) we can't increase B's mask to make it distinguishable because B has already assigned hosts at bit position 5. In other words, when the comparison of step 1 in AddSubnet() was tried on number 011, the two values were equal, and so the next number was tried. In fact, no subnet numbers with 01 in bit positions 7 and 6 can be assigned (unless B loses hosts). Next, subnet E is removed: Subnet Addr Mask A 10gg hhhh 1111 0000 B 01hh hhhh 1100 0000 C 110g hhhh 1111 0000 D 001g ghhh 1111 0000 F 1110 ghhh 1111 0000 Notice that this caused subnet A to change an s-bit back into a g- bit. This is because the equality of step 33 of RemoveSubnet() did not hold true for subnet A with respect to the remaining subnets.References [1] Braden, R., "Requirements for Internet Hosts -- Communication Layers", RFC 1122, USC/Information Sciences Institute, October 1989. [2] Mogul, J., and J. Postel, "Internet Standard Subnetting Procedure", RFC 950, USC/Information Sciences Institute, August 1985. [3] Moy, J., "OSPF Specification", RFC 1131, Proteon, October 1989. [4] Postel, J., "Internet Control Message Protocol", RFC 792, USC/Information Sciences Institute, September 1981. [5] Tsuchiya, P., "Efficient and Flexible Hierarchical Address Assignment", TM-ARH-018495, Bellcore, February 1991. [6] Hedrick, C., "Routing Information Protocol" RFC 1058, Rutgers University, June 1988. [7] Braden, R., and J. Postel, "Requirements for Internet Gateways", RFC 1009, USC/Information Sciences Institute, June 1987.Tsuchiya [Page 12]RFC 1219 On the Assignment of Subnet Numbers April 1991Security Considerations Security issues are not discussed in this memo.Author's Address Paul F. Tsuchiya Bellcore 435 South St.5 South St. MRE 2L-281 Morristown, NJ 07960 Phone: 201 829-4484 EMail: tsuchiya@thumper.bellcore.comTsuchiya [Page 13]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -