See CompTIA A+ study notes
check out my vegan recipes

IP Addressing and Subnetting
The Why and the How. IPv4

© 2009 by Theodore Zuckerman
CompTIA A+ certified Computer Technician

Configuration of networks and assigning of addresses

I still don't have as solid an understanding of this stuff as I would like, but I have these study notes, that I've taken, originally for the purpose of helping myself understand the concepts, and for the purpose of remembering them. I'm thinking they might help you, too. I've edited them — to clean them up for public consumption. So now I am calling them an "article." But they are still basically just my study notes, and they are still bound to have mistakes. When you find the mistakes, could you please let me know? Thank you. You can use this form.

  1. Since this article is about IP addressing and subnetting, I am going to keep the details about everything else, about all the related hardware and software, as simple as possible.
  2. So, as simply as possible, a network hub is a physical device into which you plug a network node. A hub enables us to have connectivity between network nodes plugged into it. A hub does not have an ip address of its own, or keep any records of what devices have been attached to it. Thus while it may be a physical network node, it is not a logical network node. The synonym for a hub, network repeater, is descriptive of what the device does: it repeats the same thing on every one its ports – whatever any network node is putting out – a physical electrical signal, a stream of digital data – the repeater just repeats it on each of its ports. Generally, these days, year 2009, we are talking about RJ45 Ethernet ports. RJ45 refers to the specifictions for construction of the plastic plugs crimped onto each wire end, and for the jacks in the hubs and nodes that the wire-end plugs plug into. In the past, other types of connectors were used. If you want to, you can look the fascinating history of physical ports.
  3. A logical network node is anything on the network with an interface to which an IP number can be assigned, and which you can connect to the network through a network hub.
  4. For the purposes of this article, a network host is a kind of network node; generally it is a computer workstation with a network interface card, that is connected to a local computer network consisting of several hosts, each connected to a network hub. The only nodes we will be talking about are hosts and routers, and the only hosts we will be talking about are comptuters. Just keep in mind there are others.
  5. So now let’s start getting into IP addresses.
  6. We will be working with networks where each computer has only 1 network interface card (NIC) (and where each card has only one IP address assigned to it), making each computer a host with a single IP address. Again, this is to simplify learning; keep in mind that computers can be multi-homed; that is, they can have more than one NIC. The routers on our networks will, however, have more than one IP address. We won’t be worrying about the distinction between software routers, and hardware routers. We will just have routers. As you may already know, because of the nature of what routers do, there is no point in having a router with just one IP address.
  7. IP stands for Internet Protocol. Internet Protocol addresses are used to identify nodes on a network. Here is a key point: Internet Protocol works with TCP (Transmission Control Protocol) and UDP (User Datagram Protocol), to encapsulate data from applications programs on an origin host; to send the encapsulated data over the network; and to pick up the data, and unencapsulate it, on a destination host (destination computer), so as to enable applications programs on the destination host to use the data. TCP is like UDP, but with more "handshaking."
  8. Public IP addresses originally were assigned by InterNIC. Remember that name, Internic. Look it up if necessary. Now public IP addresses are assigned by IANA. Which is operated by ICANN. Seriously, look these acronyms up you lazy so and so. Perhaps looking them up may help you put the information in this article into historical context, which may help you make more sense out of it.
  9. A company gets an address or addresses by contacting an Internet Service Provider (ISP), which contacts a regional registry or upstream provider.
  10. OK, here we will start getting into the rice and beans of IP addressing. Each version-4 IP address has 32 bits (its binary value or value in base 2 has 32 binary digits. We won’t be talking about version 6 until we are finished with version 4). The 32 bits can be broken up into 4 8-bit bytes. Each 8-bit byte can be broken up into 2 4-bit nibbles. Each nibble can be converted to, that is, represented by, a single  hexadecimal digit (a single digit in a base 16 number) Note that the word digit is a misnomer here, as it means finger, or one of ten, and in this case it is referring to one of sixteen.
  11. Review: a nibble conists of 4 bits. A single hexadecimal digit identifies a nibble; 2 hexadecimal digits identify a byte. 4 bytes are equal to 8 nibbles are equal to 8 hexadecimal digits are equal to 32 bits - which identifies an ip address. Thus an ip address, which consists of 32 bits - which equals 4 8-bit bytes - can be expressed with 8 hexadecimal digits. The 8 hexadecimal digits are generally arranged in 4 groups, with 2-digit hexadecimal digits in each group.
  12. Going from small to large: 32 bits = 8 nibbles = 4 bytes = 1 ip address.
  13. Furthermore, each of the 4 groups, that is, each pair of hexadecimal digits, each byte, can be converted to a 3-digit decimal equivalent. Be aware that the digits in the 3-digit decimal equivalents are base 10 digits, decimal digits (going from 0 to 9), and are not hexadecimal digits (going from 0 to F). When you use these 4 groups of 3-digit decimal equivalents (base 10 digits) to describe a 32 bit ip address, with each group separated by a period, or dot, in computer parlance, you are using dotted-decimal notation (dd notation).
  14. Also be aware that, in dotted-decimal notation, each of the 4 groups of 3 digits is used to represent a decimal number from 000 to 255. Remember that the 3 decimal digits in dotted-decimal notation are equivalent to 2 hexadecimal digits, and that 2 hexadecimal digits can be used to count from 00 to FF. 00 in hexadecimal equals 000 in decimal; FF in hexadecimal equals 255 in decimal.
  15. Note that if you replaced each set of three decimal digits which represent values from 0 to 255, with a set of 256 distinct symbols which were able to represent the values 0 to 255, there being a single symbol for each value, and if you removed the 4 dots, and placed a series of 4 (or more) of these 256 distinct symbols right next to each other, you would have base 256 notation. 0, 1, 2, 3...9, A, B, C, D...Z. We have only 36 symbols so far - for base 256 notation, we would need 220 more distinct symbols. As far as I know there is no standardized system of symbols in use for doing this, for having a full set of 256 distinct symbols to use for base 256 notation. Dotted-decimal notation is the standard system that is used instead. If you think of dotted-decimal notation as base 256 notation, with (a) dots between symbols, and (b) base 10 representations of the 256 base 256 symbols, this may help make dotted-decimal notation easier to understand. Think of each of the 2-symbol or 3-symbol values from 10 to 255, as a being a single symbol in base 256 — a single symbol with discontinuous lines. This should not be too difficult. We have precedents for "single" symbols with discontinuous elements. Lower case i and j are each a single symbol with discontinuous elements. Accented letters such as é and ñ are each a single symbol with discontinuous lines. So is the percent symbol, %. I'm working on inventing a set of 256 symbols to be used for base 10 representations. These would be simplifications of the existing 2-digit or 3-digit base-10 numbers used in dotted-decimal notation. If I get a chance I'll upload a drawing. I might want to use A to Z to represent decimal values 10 to 35 and only rely on new symbols after that.
  16. So far we have, to make things easy, assumed that each host gets a single IP address assigned to it, and that each host is plugged into the same single hub. Now let’s define a subnet. An IP subnet is the set of ip addresses that allow the hosts that have them to communicate with each other without the help of a router (with just the hub, and cables). That is, if 2 addresses are on differnet subnets, the hosts having these addresses on different subnets won’t be able to communicate with each other without the help of a router; and as I said before, if any 2 addresses are on the same subnet, the computers having these addresses will be able to communicate with each other without a router.
  17. That is just the way the TCP-IP protocol is designed to work.
  18. There are some definitions that you need to know. Start with broadcast domain. When, in addition to hubs and routers, you start using switches, you will need to distinguish between a broadcast domain and a collision domain.
  19. Given the above (partial) definition of a subnet, the question you should be asking is: what is it about any 2 IP addresses that characterize them as both being on the same subnet?
  20. Answer: If 2 IP addresses have the same subnet address, they are on the same subnet. Huh? Now you have to ask: but how do you know what the subnet address is, of any ip address? Answer: a subnet mask, when ANDed with an IP address, is used to calculate the subnet address of an IP address.
  21. Huh? Huh? Now the question is: what on earth is a subnet mask?
  22. By the way, in the future, instead of saying that “computers having these addresses communicate” I may use an abbreviation, and say that “these addresses communicate.” But of course, we know it the computers that communicate, not the addresses.
  23. OK, so what (on earth) is a subnet mask?

  24. A subnet mask, like a network address, is 32 binary digits. It can, and frequently is, expressed in hexadecimal, or dotted decimal, the same way a subnet address is. But it is in binary that we can do the Boolean ANDing that we need to do.
  25. It is a set of 32 binary digits that are used, by network administrators, to divvy up a set of ip addresses into network addresses or subnet addresses, and host addresses. It is used to identify which part of any host ip address is its network portion and which part is its host portion, by Boolean ANDing the mask with the ip address. Boolean ANDing the mask with the ip address is synonymous with masking the ip address.
  26. In binary, each subnet mask has a succession of 1’s for the leftmost (most significant) places, and a succession of 0’s for the rightmost (least significant) places. Always 1’s grouped together on the left and zeros grouped together on the right. Proceeding from left to right, once you reach a zero in a subnet mask, you can’t have any more 1’s to the right of it. If you see a 32 bit number that departs from this configuration — it is not a subnet mask.
  27. Key point repeated: a subnet mask, as defined above, along with IP addresses, allows you to determine an addressing scheme for a network. With the same set of ip addresses – by changing the subnet mask that you use with all of them, you can determine how you want to divvy up those addresses among subnets. Key point of key points: you can divvy up those IP addresses so that you have either less subnets, with more hosts in each subnet, or more subnets, with less hosts in each subnet.
  28. Again, the way we divvy up the ip addresses with a subnet mask is: we use Boolean ANDing of (1) a subnet mask and (2) a given IP address, to determine the subnet address of the given IP address. The word mask here is used as a synonym for Boolean ANDing. The term mask is used because a binary process in the computer is conceived as physically acting as a mask. How is that? A 1 in the subnet mask lets the value in the ip address "get through" to the subnet address. Whatever value there is in the ip address, is repeated in the subnet address. A 0 in the subnet mask "masks out" the value in the ip address, preventing it from getting through to the subnet address. Whatever value there was in the ip address, there is a 0 in the subnet address. Do the ANDing. ip address AND mask = subnet address. Ask yourself: did the value in the ip address get through, or was it masked out? Below is a table showing 4 possible scenarios for any way that an of address bit and mask bit can be ANDed
    ip address bit 1 0 1 0
    mask bit 1 1 0 0
    subnet address bit 1 (the 1 got thru ) 0 (the 0 "got thru") 0 (the 1 was masked out) 0 (there was no 1 to mask out, but if there were, it would have been)
  29. Any 2 or more 32-bit addresses that turn out to have the same subnet address, when all of their 32 bits are ANDed with all of the 32 bits of a subnet mask, are on the same subnet as each other. If the subnet address that you calculate this way turns out to be the same number as the IP address you were given, then that IP address you were given was the actual subnet address, an address that identifies the network, rather than indentifies a node or host on the network. If the subnet address that you calculate turns out to be a different number than the given IP address, then the given IP address was either a host address, or a broadcast address. There is only 1 broadcast address; see below for one way to determine the broadcast address.
  30. The subnet address serves as a "name" that you can use to identify the subnet, and identify all the host addresses that belong to that subnet. In addition to the subnet addresses, there is also a broadcast address (the last address in the subnet). The rest of the addresses, between the subnet address and the broadcast address, are host addresses.
  31. Send data to the broadcast address of a network and it will be sent to all the devices on that subnet. This “directed broadcast” is capable of being routed.
  32. The network address is never assigned to a specific port on a specific device — much the way the name of a street, a street name address, is never assigned to a specific house. A specific port on a specific device has a network address and host address, much like a house has a street name address and a number address. Network addresses are placed into the routing tables of routers, and routers search their routing tables for the location of a particular network. That is, the routing table shows which port on the router to send data out onto, either to one of the ports connected to one of the local subnets, or if no such subnet is connected to the router, to a gateway port that connects to another router. Maybe the subnet will be accessible from that next router. If not, it goes out on the next router's gateway port.
  33. We can find the broadcast address for any IP address by doing a Boolean OR with the ip address and the reversed subnet mask. Find the reverse of the subnet mask by changing all the 1’s to 0’s and all the 0’s to 1’s. Then take the result, and logically OR it with the IP address to get the broadcast address.
  34. Between the subnet address, and the broadcast address, lie the host addresses. As previously mentioned, every address that is not a subnet address, or broadcast address, can be used as a host address, can be assigned to a host's communication port.
  35. As mentioned above, to communicate from a node within a subnet to another node within the same subnet, using TCP-IP, all you need is cabling and a hub –  and of course you need appropriate host addresses that are in the same subnet. To communicate from a node in one subnet to a node in another subnet, you you need a router, a network IP address for each subnet, a host IP address for each host, plus at least 1 hub for each subnet. Yes you could use a direct connection without a hub, but let’s leave this out of the picture for now. For one, it is impractical unless you have only 2 computers. To communicate between any host, in any subnet, the number of routers you need equals the number of subnets you have, minus 1. A router hooks two subnets together, or keeps them apart, depending upon how you configure the router. Thus for 2 subnets you will need 1 router. For 3 subnets, you will need at least 2 routers, etcetera.

    A singular bit of information about subnet masks: the least significant One is the most significant to you. Or, if you have one One after another, where do you find the least significant One?

  36. If you have a set of ip addresses, and you have an existing subnet mask that configures it into subnets and hosts, then, if you want to have more subnets, and less hosts, within each subnet, you take the existing subnet mask that you have, and as you go from left to right, change the first 0 that you find, to a 1. Note that when going from L to R changing 0’s to 1’s, you must never skip over a zero. If you want to have less subnets, and more hosts within each subnet, then as you go from right to left, you change the first 1 that you find, to a 0. Any of several IP address calculating applications programs, may help you visualize what is going on.
  37. OK, so let’s get down to the nitty-gritty now. How does a subnet mask identify a network or subnet address, a broadcast address, and host addresses?
  38. I've said it before and I'll say it again, here is how you find the network address: A bitwize AND of an IP address and subnet mask equals the network address, which equals the first address in a subnet. Add 1 to that network address and you have the first host address. The last address of the subnet, is the broadcast address. In between are the host addresses. Both routers and hosts get host addresses assigned to their network ports.
  39. In short: Network address = IP address AND subnet mask
  40. Example: say your network mask, in binary, has 24 1’s and 8 zeros. That is, say your network mask, in binary, is as follows::
    1111 1111 . 1111 1111 . 1111 1111 . 0000 0000
    (that would be in dotted decimal form). And say you have a single network address of whose dotted decimal value is The subnet mask tells you that the network address has 24 network bits and 8 host bits, and that therefore the network has 2^8 -2 hosts. That is,  256-2 hosts. 254 hosts.
  41. Where n = the number of host bits, and h = hosts, the formula is
    h = 2^n -2
  42. This same mask identifies the address as having 24 network bits. Given the entire range of all the IPver4 addresses, there would be 2^24 networks identified by the mask. Equals 16,777,216 networks (although not all of them have been assigned to you). That is, if they are classless. What about classful addresses? Since a mask of 24 bits means you have been assigned a “class C” address, and since the first 3 bits of the address have been used to identify the class of the address, and cannot be used as network addresses, the mask tells you that there are only 21 bits left that can be used to indentify classful networks. Therefore, using classful networking, there are 2^21 networks identified by the mask. 2,097,152 networks. Each with 254 hosts.
  43. However the whole point of subnetting is to change that, to solve the problem that, if you are assigned 1 network with 254 hosts, how can you, instead, have more networks, each with less hosts? If you have more than one network, you can also do supernetting: make less networks and more hosts in each network. But let’s stick to subnetting for now.
  44. To have more networks and less hosts in each, extend the mask from 24 1’s and 8 0’s, to  25 1’s and 7 zeros.
  45. That new mask would look like this in binary:
  46. 1111 1111 . 1111 1111 . 1111 1111 . 1000 0000
  47. That’s it, by replacing the least significant (rightmost) 0 with a 1, you have done subnetting. You no longer have a single address,, with 254 hosts. You now have 2 network addresses, each with 126 hosts. There are now 2,097,153 networks, instead of 2,097,152 that there were before; and you now have 2 of them (instead of the 1 you had before). And — your 2 networks each have 126 hosts (instead of the 254 you had before). Note that 2 x 126 = 252. You lost 2 hosts. One became a broadcast address for the newly created subnet, the other became its network address.
  48. Whoever the other networks 2,097,151 networks are assigned to – they decide if they are going to keep their networks as assigned, or whether they are going to subnet them or supernet them. Why? Because they don’t have to use the single network mask that they were assigned. They can’t change the network ip number or numbers that they were assigned, but they can change the network mask.
  49. You need to know that binary (bin) value
    1111 1111 . 1111 1111. 1111 1111. 1000 0000
    equals dotted decimal (dd) value
  50. Try and memorize that
    1111 1111 . 1111 1111 . 1111 1111 . 1000 0000 bin = dd
  51. Let’s do the math. You have address and mask
  52. Convert the two dotted decimal values to binary values and do the ANDing of each of the binary bits.
  53. AND =
  54. You got, which is a network address.
  55. Let us AND and
  56. AND =
  57. is a host address, and its network address is
  58. AND
  59. is a host address, and again, its network address is
  60. All the way up to, by ANDing the address with the subnet mask, you’ll get a network address of
  61. This last address, however, is not a host address, but by definition the last address is a broadcast address. is a broadcast address.
  62. Now let’s use the same range of address with a new network mask,
  63. AND =
  64. AND =
  65. AND =
  66. But here is the rub
  67. AND =, and not
  68. Your network address for is
  69. AND =
  70. Your network address for is, again,, not
  71. is in a different subnet than
  72. is in subnet and is in subnet
  73. AND = Also in subnet
  74. Now we see that if you change the mask (in binary) by adding an extra 1, you have 2 networks with 126 hosts each, and the network addresses are either and 126 hosts are in one subnet, 126 in the other.
  75. As I said before: every IP address has a network portion and a host portion and the network mask identifies which is which. The network mask always has 1 on the left and 0’s on the right. If you line up the binary digits of the mask with the binary digits of the ip address, you determine which address bits are network bits, and which address bits are host bits. How?
  76. Wherever you have a 1 in the network mask, you have a network bit in the corresponding address. Wherever you have a  0 in the network mask, you have a host bit in the corresponding address.
  77. Then, if you do a bitwize AND of the mask and the address, you get the network address. A bitwize AND of a host address and a mask will tell you the host address's network address. A bitwise AND of a network address with a mask will produce the very same address as the network address, and will tell you that it is a network address.
  78. The addresses in a subnet consist of the subnet address itself, and the host addresses. The subnet address is the address where, in binary, the host portion of this ip address is all 0’s, and this address is the first address in the subnet. After the subnet addresses, come host addresses. The host portion of the any ip address, network or host, is identified by lining it up, in binary, with the subnet mask, which has 1’s in the network portion and 0’s in the host portion. The host portion of the subnet address is, like the host portion of the mask, all zeros. The host portion of each host address may have either 1’s or zero’s. If you AND a host address with the mask, you will get the subnet address – where 1 address in a subnet where the host portion is all zeros. Note that the broadcast address is all 1’s.
  79. As already mentioned, in addition to enabling you to locate which address is a network address, you can use a subnet mask to determine which part of an any ip address, network address, host address, or broadcast address, is its network part, and which part is its host part. And as already mentioned, if you do a Boolean AND of the subnet mask and the ip address (see 2 above), you will get the network address for the segment that the IP address is in, that is, the address where the host portion is all 0’s, and this address is the first node in the subnet. The second and subsequent nodes, all the way up to the next subnet minus 1 (which is a broadcast address), are all host addresses. An address is either a network address, a host address, or a broadcast address.
  80. More examples:
  81. If ip address is and subnet mask is, convert both to binary, do Boolean AND, convert back to decimal. You’ll get This is the network address.
  82. Here is the whole thing laid out
  83. Converting the above dotted decimal IP address and subnet mask
  84. binary address
    1100 0000 . 1010 1000 . 0000 1011 . 0000 0100
  85. subnet mask
    1111 1111 . 1111 1111 . 1111 1111 . 0000 0000
  86. AND them, and you get
  87. Network address: 1100 0000 . 1010 1000 . 0000 1011 . 0000 0000
  88. Note that the last octet is all 0’s. Converting that binary network address back to decimal, you get
    Network address:
  89. And there is also the Broadcast Address,  which is the last address in the subnet. This is the address where all the host bits are made to be 1’s. For example if the first 3 bits of the subnet mask are network bits and last 5 mask bits are host bits, make each of those last 5 bits in the IP address, be 1’s. Or add the number of hosts in the subnet, to the subnet address, then subtract 1.
  90. As mentioned early in “so what is a subnet mask” section, we can also find the broadcast address for any IP address by doing a Boolean OR with the ip address and the reversed subnet mask.
  91. Find the reverse of the subnet mask by changing all the 1’s to 0’s and all the 0’s to 1’s. Then take the result, and logically OR it with the IP address to get the broadcast address.
  92. By the way, it would be a good idea to memorize all the conversions from decimal to binary, for every possible value in an octet. Start at 0000 0000 and proceed all the way up to 1111 1111. The decimal values will start at 000 and proceed up to 255. Just do it. I don't need to give you a chart. Make your own.
  93. Another way to note these classless addresses, rather than use address plus subnet mask, is to indicate just the address, followed by slash, and represent the subnet mask with a number from 0 to 30 indicating how many of the 32 places (in binary) are network places, that is represented by a 1 in the mask. The remainder will of course be host places. Remind me to include an example here later.
  94. IP Address Classes

  95. The above described classless addressing. There is also something called classful addressing. Although it is probably obsolete, perhaps you ought to be familiar with it anyway.
  96. Whether an addresses is of class A, B, or C, or D or E, is defined by the first 4 bits of an address, the first nibble.
  97. To find range of possible addesses in a class, that is, the range of classful addresses, in class A, B, C, D, or E, determine where the 0 falls in the first nibble of a the address, using the table below. For a Class A address you put the 0 under the A clolumn, class B, under the B column. In the remaining places, to the Left of the 0, put 1’s. And to the right of the 0, put either a 0 or a 1. If all the places in the first nibble are occupied by a 1, then you have a class E address.
  98. First nibble: A B C D      Bits for network, hosts
    Class A:      0 x x x      7, 24
    Class B:      1 0 x x      14, 16
    Class C:      1 1 0 x      21, 8
    Class D:      1 1 1 0      undefined
    Class E:      1 1 1 1      undefined
  99. I suggest you do conversion from binary to decimal, to determine the range of possibilities of the decimal value for the first byte of each class.
  100. At the same time, classes are defined by the number of bits allocated to networks, and the number to hosts, as follows: Class A is allocated 7 bits for networks and 24 for hosts (first octet for network). B is 14 and 16 (first 2 octets), C is 21 and 8 (first 3 octets).
  101. Calculate number of networks and hosts by using number of bits as an exponent of 2. Example Class A has 2^7=128 networks and 2^24=16,777,216 (-2) nodes per net. Class B has 16384 networks and 65,536 (-2) hosts per net. Class C has 2,097,152 networks and 256 (-2) hosts per net.
  102. Class D not used for networks. Multicast destination addresses. 28 bit for addresses. 2^28= 268,435,456
  103. Class E is for experimental purposes.
  104. Note that while on a class A network you can have theoretically have 16,777,214 hosts per net, Cisco recommends that to avoid broadcast problems, you not exceed 500. I suppose you can use subnetting or switches to ameliorate.
  105. Class A 0. Class B 10 Class C 110 Class D 1110 class E 1111. Loopback is 0111 1111. This equals decimal 127.
  106. If zero is under the A, it is class A, under the B, class B, etc.
  107. In other words, use the first 3 significant bits of the first octet to define class A B or C. A, most significant bit is 0. Plus next 7 bits. Class B, second most signifant bit is 0, plus use the nex 14 bits. Class C, third most significant bit is zero, use next 21 bits. Number of bits used can be used to calc number of networks in each class . 2^7, 2^14, or 2^21.  or (2^7)-2. See chart on widipedia.
  108. Class A 0XXX, Class B, X0XX, Class C, XX0X. However make everything to the left of the zero, a 1.
  110. Class B is  10XX XXXX . XXXX XXXX . XXXX XXXX . XXXX XXXX
  111. Class C is  110X XXXX . XXXX XXXX . XXXX XXXX . XXXX XXXX
  112. Class D is  1110 XXXX . XXXX XXXX . XXXX XXXX . XXXX XXXX
  113. Class E is  1111 XXXX . XXXX XXXX . XXXX XXXX . XXXX XXXX
  114. Class A first octet,  dec is 0 to 127, hex is 0 to 7F.
  115. Class B, dec is 128 to 191, hex is to 80 to BF.
  116. Class C, dec is 192 to 223, hex is C0 to DF.
  117. Class D, dec is 224 to 239, hex is E0 to EF
  118. Class E, dec is 240 to 255, hex is F0 to FF
  119. Loopback address is 127
  120. (The correct Class A range is to, to is reserved per RFC 1700)
  121. Today, IP addresses are associated with a subnet mask. Historically, subnet masks were not required in classful networks because the mask was implicitly derived from the IP address itself. That is, the subnet mask of a classful address is defined by the form of the first nibble. Any network device would inspect the first few bits of the IP address to determine the class of the address.
  122. Subnet masks show the number of networks and the number of hosts available in each class. The number of networks in a class is calculated by counting the number of X bits in the network portion of the addresses in the chart above (as determined by the mask), and raising 2 to that power. The number of hosts in a class are calculated by counting the  number of X bits in host portion of address, in the chart above. Network masks that end at octet, are called standard masks.
  123. As we discovered above in the the key bit of information you need to know about subnetting section, network masks that end somewhere within an octet require calculations to express the number of subnets and hosts per subnets.
  124. Class A  2^7 networks
  125. Class B  2^14 networks
  126. Class C  2^21 networks
  127. Conversion between binary, decimal, and hexadecimal: to preserve dotted decimal format, you must do the conversion octet to octet.
  128. See spreadsheet.
  129. Each class has a small block for private use. (RFC 1918):
  130. Class A: – Prefix notation
  131. Class B: – Prefix notation
  132. Class C: – Prefix notation
  133. These private ranges should not be hard to memorize. C you already know. 192.168.x.x. A is 10.x.x.x.. The only slightly hard one to memorize is B. – 172/10.75 = 16. Think 7-11. 172/11=15.6, rounds to 16. ½ of 11 is 5.5. 172/5.5=31.27. Rounds to 31.
  134. Autoconfiguration range is reserved. Class A. 169.254.x.x
  135. Subnetting with respect to Cisco Router

  136. Subnetting means starting with an ip address range which is a single network, with a number of hosts, as indicated by a subnet mask, and changing the subnet mask so as to make more networks, with less hosts in each network, and doing the calculations to see how many networks and how many hosts there are.
  137. You just add more bits to the right, in the subnet mask, one by one. Then do the calculations to see how many more subnets you have, and how many hosts are in each.
  138. Subnet bits and host bits in mask, correspond to subnet bits and host bits in the ip address.
  139. Number of subnets = 2n
    where n = number of subnet bits
  140. Number of hosts = 2n-2
    where n = number of host bits
  141. You always need to subtract 2 from the number of hosts.
  142. You may possibly need to subtract 2 from the subnets. How to determine whether to subtract 2 from the number of subnets:
  143. You should subtract 2 if:
  144. If you see the “no ip subnet-zero” command in the configuration (this will appear near the top when you do show run).
  145. If the routing protocol is classful (RIPv1, IGRP).
  146. You should not subtract 2 if:
  147. If a classless routing protocol is being used (RIPv2, EIGRP, OSPF).
  148. If the term VLSM Variable Length Subnet Masking is used.
  149. If the “ip subnet-zero” command appears in the configuration (when you do show run). This is the default setting. To change to “no ip subnet-zero” the command is no ip subnet-zero
  150. Number of hosts per subnet: hosts = 2number of host bits-2
  151. Another way to find the number of hosts per subnet is to change all the host bits of the subnet mask to 1’s, instead of zero. Convert the binary number to decimal and add 1. For example subnet mask 1110 0000, express the 5 host bits as 1 1111. Converting to decimal you have 31. 31+1=32.
  152. Another way to find number of hosts per subnet is to find the first octet of the subnet mask that indicates subnetting (the first octet that isn’t equal to 255), and subtract its value from 256. Example if you have a subnet mask of, do 256-224 = 32. 256-128=128. 256-192=64. 254-224=32. 256-240=16. 256-248=8. 256-252=4. 256-254=2.
  153. You can also find the number of subnets, by a similar method, by subtracting the number of hosts per subnet, from 256, then convert that to binary, and see how many places it is, how many ones you have from the left. Then raise 2 to that power and add 1. For example if you have 32 hosts per subnet, to find the number of subnets do 256-32=224. 224 = 1110 0000. That is 3 ones. 2^3=8. So you have 8 subnets, with 32 hosts each.
  154. When we divide a network into subnets, for each subnet, you generally want to  be able to find
    • the network address of each subnet
    • the broadcast address of each of those subnets
    • the range of host addresses in each subnet, as idenfied by the first and last address of each range of host addresses.
  155. Variable Length Subnet Masks

  156. Normally each network has the same number of hosts per network, and each network address falls on a binary value of 10000000, 110000000, 11100000, etc. With Variable Length Subnet Masks, VLSM, each subnet can have a dif number of hosts.
  157. The plan is to add information about VLSM to this article.