Docsity

Understanding IP Addressing: Subnetting and Host Components, Slides of Communication

Toggle sidebar
bg1
Concepts in IP Addressing
Terms You’ll Need to Understand:
✓Binary
✓Hexadecimal
✓Decimal
✓Octet
✓IP address
✓Subnet Mask
✓Subnet
✓Host
✓Increment
Techniques You’ll Need to Master:
✓Identifying Address Class and Default Mask
✓Determining Host Requirements
✓Determining Subnet Requirements
✓Determining the Increment
...............................................
3
03_0789735024 CH03.qxd 11/17/05 1:17 PM Page 37
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b

Partial preview of the text

Download Understanding IP Addressing: Subnetting and Host Components and more Slides Communication in PDF only on Docsity!

Concepts in IP Addressing

Terms You’ll Need to Understand:

✓ Binary ✓ Hexadecimal ✓ Decimal ✓ Octet ✓ IP address ✓ Subnet Mask ✓ Subnet ✓ Host ✓ Increment

Techniques You’ll Need to Master:

✓ Identifying Address Class and Default Mask ✓ Determining Host Requirements ✓ Determining Subnet Requirements ✓ Determining the Increment

...............................................

(^38) Chapter 3................................................

Introduction The CCNA exam(s) require a near-perfect fluency in subnetting. Success requires speed and accuracy in answering the many questions you will see on this topic. The key to this level of fluency is practice—you must work at your skills until they become second nature. The following sections discuss binary and hexadecimal numbering systems as compared with the more familiar decimal system. An understanding of bina- ry, in particular, is crucial to success on the test as it is fundamental to computer systems in general, and to topics such as subnetting, access lists, routing, and route summarization in specific.

Binary Binary is the language of digital electronic communication. Binary is anoth- er name for Base2 numbering. Our usual numbering system is Base10, in which a single character or column can represent one of 10 values: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9. The first column indicates how many ones there are in a given value. To represent a value greater than 9, we need another column, which represents how many “tens” there are; if the value we want to repre- sent is greater than 99, we use another column for the “hundreds,” and so on. You might notice that each additional column is ten times greater than the preceding one: ones, tens, hundreds, thousands, and so forth—all “Powers of 10”: 10^1 , 10 2 , 10 3 , and so on. Base10 is easy because most of us have 10 fingers and have known how to count from an early age. In binary, or Base2, a single character or column can represent one of only two values: 0 or 1. The next column represents how many “twos” there are; the next column how many “fours,” and so on. You’ll notice here that the value of each additional column is two times greater than the previous—all “Powers of 2”: 2 1 , 2^2 , 2^3 , and so on. This is not a coincidence. Given that a Base2 or binary column can have only two possible values (0 or 1), this makes it easy to represent a binary value as an electrical value: either off (0) or on (1). Computers use binary because it is easily represented as electrical signals in memory or digital values on storage media. The whole system works because computers are quick at computing arithmetic, and as you’ll learn, pretty much all computer operations are really just fast binary math. Let’s take a look at some Base10 (or decimal) to binary conversions. Take the decimal number 176. Those three digits tell us that we have one 100, plus

(^40) Chapter 3................................................

Table 3.3 Building a Binary String, Part 1 128 64 32 16 8 4 2 1 1

Now, we try to subtract the next highest column value from the remainder. We get 176 – 128 = 48. We take the 48 and subtract 64 from it. Notice that you can’t do this without getting a negative number; this is not allowed, so we can’t use the 64 column. Therefore, we put a 0 in that col- umn, as shown in Table 3.4.

Table 3.4 Building a Binary String, Part 2 128 64 32 16 8 4 2 1 1 0

Move along and do the math for the rest of the columns: 48 – 32 = 16. We then subtract 16 from 16 and get 0. Note that when you get to 0, you are finished! So, we used only the 128 col- umn, the 32 column, and the 16 column. Table 3.5 is what we end up with.

Table 3.5 Completed Binary Conversion 128 64 32 16 8 4 2 1 1 0 1 1 0 0 0 0

176 decimal = 10110000 binary. If you add up 128+32+16, you get 176. That is how you convert from bina- ry to decimal: Simply add up the column values where there is a 1.

You will see several questions on converting from decimal to binary and back, so prepare accordingly.

Hexadecimal The CCNA exam(s) will ask you a few questions on the conversion of bina- ry to hexadecimal and back, so you need to understand how it works. An understanding of hex is also a useful skill for other areas of networking and computer science.

............................................... .Concepts in IP Addressing^^41

Binary is Base2; Decimal is Base10; Hexadecimal is Base16. Each column in hex can represent 16 possible values, from 0 through 15. In order to repre- sent a value of 10 through 15 with a single character, hex uses the letters A through F. It is important to understand that the values of 0 through 15 are the possible values of a 4-bit binary number, as shown in Table 3.6.

Table 3.6 Decimal, Binary, and Hex Values Compared Decimal Binary Hex 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F

You should be able to reproduce Table 3.6 as a quick reference for the exam.

Conversion Between Binary, Hex,

and Decimal The following sections provide an introduction to converting between bina- ry, hex, and decimal. Again, there is more than one mathematical approach to finding the correct answer, but the method shown is simple and reliable.

............................................... .Concepts in IP Addressing^^43

IP Address Components

CCNA candidates need to be fluent in their understanding of IP addressing concepts. The following sections detail how IP addresses are organized and analyzed, with a view to answering subnetting questions.

Address Class

Early in the development of IP, the IANA (Internet Assigned Numbers Authority) designated five classes of IP address: A, B, C, D, and E. These classes were identified based on the pattern of high-order bits (the high-value bits at the beginning of the first octet). The result is that certain ranges of networks are grouped into classes in a pattern based on the binary values of those high-order bits, as detailed in Table 3.7:

Table 3.7 Address Class and Range Class High-Order Bits 1st Octet Range A 0 1– B 10 128– C 110 192– D 1110 224– E 11110 240–

You might notice that 127 is missing. This is because at some point the address 127.0.0.1 was reserved for the loopback (sometimes called “local- host”) IP—this is the IP of the TCP/IP protocol itself on every host machine.

You absolutely must be able to identify the class of an address just by looking at what number is in the first octet. This is critical to answering subnetting questions.

Default Subnet Mask Each class of address is associated with a default subnet mask, as shown in Table 3.8. An address using its default mask defines a single IP broadcast domain—all the hosts using that same network number and mask can receive each other’s broadcasts and communicate via IP.

(^44) Chapter 3................................................

Table 3.8 Address Class and Default Masks Class Default Mask A 255.0.0. B 255.255.0. C 255.255.255.

One of the rules is that a subnet mask must be a contiguous string of 1s fol- lowed by a contiguous string of 0s. There are no exceptions to this rule: A valid mask is always a string of 1s, followed by 0s to fill up the rest of the 32 bits. Therefore, the only possible valid values in any given octet of a subnet mask are 0, 128, 192, 224, 240, 248, 252, 254, and 255. Any other value is invalid.

You should practice associating the correct default subnet mask with any given IP address; this is another critical skill in subnetting.

The Network Field Every IP address is composed of a network component and a host compo- nent. The subnet mask has a single purpose: to identify which part of an IP address is the network component and which part is the host component. Look at a 32-bit IP address expressed in binary, with the subnet mask writ- ten right below it. Figure 3.1 shows an example.

IP Address and Mask: 192.168.0.96 255.255.255. Binary IP: 11000000.10101000.00000000. Binary Mask: 11111111.11111111.11111111.

NetworkField

HostField

Figure 3.1 IP address and mask in binary, showing network and host fields.

Anywhere you see a binary 1 in the subnet mask, it means “the matching bit in the IP address is part of the network component.” In this example, the network part of the address is 192.168.0.X, and the last octet (X) will be the host component.

(^46) Chapter 3................................................

bits mathematically define how many subnets we create. Figure 3.2 uses the same IP address from our previous example, but now we have applied a sub- netted mask that is longer than the default. Note that this creates the subnet field.

IP Address and Mask: 192.168.0.96 255.255.255. Binary IP: 11000000.10101000.00000000. Binary Mask: 11111111.11111111.11111111.

NetworkField SubnetFieldHostField

Figure 3.2 IP address and non-default mask in binary illustrating the subnet field.

Figure 3.2 identifies the two extra bits past the default boundary as the sub- net field—they used to be in the host field, but we subnetted and stole them to become the subnet field.

Subnetting Subnetting is not as difficult as it initially seems. Because we are dealing with arithmetic, there is definitely more than one way to do this, but the method shown here has worked well. The following sections work through the process of subnetting. Then, we work on some shortcuts to show how you can subnet quickly because CCNA exam candidates often find that they are pressed for time on the exam.

Address Class and Default Mask Subnetting happens when we extend the subnet mask past the default bound- ary for the address we are working with. So it’s obvious that we first need to be sure of what the default mask is supposed to be for any given address. Previously, we looked at the IANA designations for IP address classes and the number ranges in the first octet that identify those classes. If you didn’t pick up on this before, you should memorize those immediately. When faced with a subnetting question, the first thing to do is decide what class the address belongs to. Here are some examples: 192.168.1. The first octet is between 192 and 223: Class C Default mask for Class C: 255.255.255.

............................................... .Concepts in IP Addressing^^47

The first octet is between 128 and 191: Class B

Default mask for Class B: 255.255.0.

24.64.208.

The first octet is between 1 and 126: Class A

Default mask for Class A: 255.0.0.

It’s important to grasp that if an address uses the correct default mask for its class, it is not subnetted. This means that regardless of how many hosts the 0s at the end of the mask create, all those hosts are on the same network, all in the same broadcast domain. This has some implications for classful net- works (ones that use the default mask for the address). Take a Class A for example: A Class A network can have 16,777,214 hosts on it. Almost 17 mil- lion PCs on one network would never work—there would be so much traf- fic from broadcasts alone, never mind regular data traffic, that nothing could get through and the network would collapse under its own size. Even a Class B network has 65,534 possible host IPs. This is still too many. So, either we waste a lot of addresses by not using the whole classful A or B network, or we subnet to make the networks smaller.

This is actually one of the most common reasons we subnet: The default or classful networks are too big, causing issues such as excessive broadcast traffic and wasted IP address space. Subnetting creates multiple smaller sub- networks out of one larger classful network, which allows us to make IP net- works the “right” size—big or small—for any given situation.

The Increment

By definition, the process of subnetting creates several smaller classless sub- nets out of one larger classful one. The spacing between these subnets, or how many IP addresses apart they are, is called the Increment. Because we are working with binary numbers, a pattern emerges in which the Increment is always one of those powers of 2 again—another good reason to memorize those numbers.

The Increment is really easy to figure out. It is simply the value of the last bit in the subnet mask. Let’s look at some examples. Figure 3.3 shows an IP address and subnet mask in binary.

............................................... .Concepts in IP Addressing^^49

Figure 3.5 Subnets created with Increment of 64.

The multiples of the Increment—0, 64, 128, and 192—are the starting addresses of the subnets we created. The subnets are all 64 addresses long, so we have room to make four subnets before we run out of addresses in the fourth octet.

Figure 3.6 shows our IP and subnet mask—note that the value of the last bit in the mask is 16—and the subnets created with that Increment of 16.

Subnets Created with Increment of 64:

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

.32. . . .

.48. . . .

.0. . . .

.16. . . .

.96. . . .

.112. . . .

.64. . . .

.80. . . .

.160. . . .

.176. . . .

.128. . . .

.144. . . .

.224. . . .

.240. . . .

.192. . . .

.208. . . .

192.168.21.0 255.255.255.

IP: 11000000.10101000.00010101. Mask: 11111111.11111111.11111111.

Subnets Created with Increment of 16:

Figure 3.6 IP address and subnet mask with Increment of 16.

First of all, you should notice that we are subnetting again—the mask extends past the default boundary. The last 1 in the mask is in the bit posi- tion worth 16, so our Increment is 16. The multiples of 16 are 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, and 240. Again, we can’t make another subnet because 240 + 16 = 256. Be careful not to start doubling as we did with the binary values; here we are just adding the Increment value each time. It’s easy to get confused! The Increment is really the key to subnetting; if you can determine the Increment, you can see how big your subnets are and how many you have created. Remember, the easy way to find the Increment is to just determine the bit value of the last 1 in the mask.

(^50) Chapter 3................................................

Number of Hosts The number of 0s at the end of the mask always defines the number of hosts on any network or subnet. There is a simple mathematical formula that defines how many IP addresses are available to be assigned to hosts.

Hosts is another word for computers, router interfaces, printers, or any other network component that can be assigned an IP address.

Now, no one expects you to be a big fan of algebra, but you need to see and understand the formula. The number of binary bits you have to use determines the maximum num- ber of different values you can express using those bits. If you have three bits, you can make eight different values—0 through 7, or 000 through 111 in binary. Three bits, and 2 3 =8—this is not a coincidence. The binary values you learned earlier—1, 2, 4, 8, 16, 32, 64, 128—are all powers of 2 and define the maximum number of different values you can create if the mask ends in that bit position. So it should come as no surprise that the formula for the num- ber of hosts on any network or subnet is 2H-2, where H is the number of 0s at the end of the mask. But why do we subtract 2 in the formula? It’s pretty straightforward: Every network or subnet has two reserved addresses that cannot be assigned to a host. The rule is that no host can have the IP address in which all the host bits are set to 0, and no host can have the IP address in which all the host bits are set to 1. These addresses are called the Network ID and the Broadcast ID, respectively. They are the first and last IPs in any network or subnet. We lose those two IP addresses from the group of values that could be assigned to hosts. Think of a network or subnet as a street with houses on it. Each house has a unique address, and the street has a name. The Network ID is like the street name, and all the houses are hosts on a subnet that is known by its Network ID street name. If two hosts have identical network and subnet fields in their addresses, they are on the same network, and can ping each other and exchange data and all that good stuff. If the network and subnet fields are different, even by one bit, they are on different networks and can’t commu- nicate until we put a router between them. The routers act like street inter- sections; you must get to the right intersection (router) before you can get on to the street you want… but we’ll save that for later.

(^52) Chapter 3................................................

the address of 255.255.255.255, which hits every IP host that can hear it; the Broadcast ID hits only hosts on a common subnet. Let’s take the previous example of an Increment of 64 and expand on the detail, as shown in Figure 3.8:

Subnets Created with Increment of 64 – NetID and Broadcast ID shown:

.128 N . . . . . .191 B

.192 N . . . . . .255 B

.0 N . . . . . .63 B

.64 N . . . . . .127 B Figure 3.8 Subnets from Increment of 64 with NetID and Broadcast ID shown.

Note that all the multiples of the Increment—the numbers that mark the start of each subnet—have been identified by an “N” for Network ID, and the last IP in every subnet is marked with a “B” for Broadcast ID. This leaves us with 62 IPs left over in each subnet, and any of these (but only these) can be assigned to a host. This leaves us with a range of IP addresses within every network or subnet that can be assigned to hosts. There is an unofficial convention that the gateway or router for a subnet is assigned the first or the last IP address avail- able, but that is entirely arbitrary.

You need to know exactly what the first and last IP addresses are in any subnet; a lot of questions ask for them, and it’s fundamental to understanding what is happening when you subnet.

The first valid IP address is defined as NetID + 1 In Figure 3.3, the first valid host IPs in each subnet are .1, .65, .129, and .193. The last valid host is defined as BroadcastID – 1 In Figure 3.8, the last valid host IPs in each subnet are .62, .126, .190, and .254.

............................................... .Concepts in IP Addressing^^53

See how the subnetted mask in the previous example has shortened the num- ber of 0s at the end of the mask as compared to the default of 8? We now have only six 0s in the host part, so our formula would be

26 – 2 = 62

Here’s something interesting: It doesn’t matter what IP address you use with this mask; that mask will always give you 62 hosts on each subnet. You can pick a Class A address, say 22.1.1.0, and that mask would still make 62 hosts per subnet. The number of 0s at the end of the mask always drives how many hosts are on each subnet, regardless of the address.

So, what happened to all the other host IPs we started with? Remember that subnetting takes a classful A, B, or C network and splits it into several equal- sized pieces. It’s just like cutting a pie into pieces; the original amount of pie is still there, but each piece is now separate.

Remember that the number of 0s at the end at the mask always defines how many hosts are on each subnet, regardless of the address in use.

Number of Subnets

Following on with the pie analogy, we know that we slice a classful network into pieces—but how many pieces? There is a simple mathematical relation- ship to this as well, but it is slightly more complex because of an old rule that we sometimes have to deal with.

The basic formula for the number of subnets is similar to the hosts formula. It is simply 2 S, where S is the number of bits in the subnet field—that means the number of 1s in the mask past the default boundary for that address. If you look at Figure 3.9, you can see how this works.

The default boundary for that Class C address should be at the 24th bit, where the third octet ends and the fourth begins. The subnetted mask

Here are some handy tips to help you keep track of the NetID, first and last hosts, and Broadcast ID: NetID: Always Even First Host: Always Odd Last Host: Always Even Broadcast ID: Always Odd

............................................... .Concepts in IP Addressing^^55

Working with Subnetting Questions

After you determine whether the zero subnets are available, use the following to get the calculation for the number of subnets right: Zero subnets not available? Subtract 2 subnets: formula is 2 S- Zero subnets available? Keep all subnets: formula is 2 S

The approach you need to take to any subnetting question is very simple. After you become fluent in subnetting, you can take some shortcuts; but to build a solid under- standing, you need to be methodical. Every subnetting question you ever see will be about one of three things: ➤ Number of hosts ➤ Number of subnets ➤ The Increment Your task will be to simply figure out what the question is asking for and solve it with- out getting confused or distracted.

Determining Host Requirements There are only two scenarios when determining the host requirements: Either you are given a mask and asked how many hosts per subnet this cre- ates, or you are given a requirement for a certain number of hosts and asked to provide the appropriate mask. Either way, the number of 0s at the end of the mask drives how many hosts per subnet there will be; the address to which that mask is applied is irrelevant. Your task is to put the correct num- ber of 0s at the end of the mask such that 2H-2 is greater than or equal to the desired number of hosts, or to determine what the value of 2H-2 actual- ly is. From there, you must choose the correct expression of the mask, either in dotted decimal or CIDR notation.

Determining Subnet Requirements The scenarios for determining subnet requirements are quite similar to the host questions; either you are told how many subnets you need and asked to provide the appropriate mask, or you are given a mask and asked how many subnets it creates. Note that in both cases (unlike hosts questions), you must know the IP address or at least the class of address you are working with. Creating subnets happens by extending the default mask, so you must know where the mask should end by default—and for that you need to know the class of address. Once you know where to start, simply extend the mask by the correct number of subnet bits such that 2S-2 (or possibly just 2S) gives you the correct number of subnets.

(^56) Chapter 3................................................

Determining Increment-based Requirements Increment questions are the most challenging and complex subnetting ques- tions, often requiring you to do a lot of legwork before you can get to the answer. Increment questions often give you two or more IP addresses and masks, and ask you things such as, “Why can’t Host A ping Host B?” The answer could be that A and B are on different subnets; to determine this, you need to understand where those subnets begin and end, and that depends on the Increment. Another popular question gives you several IP addresses and masks that are applied to PCs, servers, and routers. The system, as it is described, is not working, and you need to determine what device has been incorrectly configured—perhaps two IPs in different subnets, perhaps a host that is using a NetID or BroadcastID as its address. The key is to first determine what the Increment is or should be; then, care- fully plot out the multiples of the Increment—the Network IDs of all the subnets. Then you can add the Broadcast IDs, which are all one less than the next Network ID. Now you have a framework into which you can literally draw the host IP ranges, without risk of “losing the picture” if you do this all in your head. All of these skills take practice. Everyone goes through the same process in learning subnetting: For quite a while, you will have no idea what is going on—then suddenly, the light goes on and you “get it.” Rest assured that you will get it. It takes longer for some than others, and you do need practice or you will lose the skill.

The Subnetting Chart So now you should understand concepts and mechanics of subnetting. You can do it and get the right answer almost all of the time, but it takes you a while. This is good—congratulations! If you are not at that point yet, you should practice more before you look at this next section. What follows is one of many variations of a subnetting chart. This is a good one because it is easy to use under pressure when your brain will behave unpredictably.

Remember that the zero subnets rule might come into play here; although the major- ity of questions say that the zero subnets are not valid and therefore the formula should be 2S-2, some questions—and probably more as time goes on—will clearly state that zero subnets are available. Read the question!