Chapter1. Addressing and Subnetting Basics

Return Home

Chapter 1

Addressing and Subnetting Basics

IP Address Basics

Classful AddressingStructure and Size of Each Type

What Is a Network?

Class A

Class B

Class C

Address Assignments

Single Address per Interface

Multihomed Devices

MultinettingMultiple Addresses per Interface

Examples

Purpose of Subnetting

The Basic Fixed Length Mask

What the Mask Does

Components of a Mask

Binary Determination of Mask Values

Decimal Equivalent Mask Values

Creating Masks for Various Networking Problems

Addresses and Mask Interaction

Reserved and Restricted Addresses

Determining the Range of Addresses within Subnets

Determining Subnet Addresses Given a Single Address and Mask

Interpreting Masks

Reserved Addresses

Summary

FAQs

 

This chapter covers:

        IP Address Basics

        Purpose of Subnetting

        The Basic Fixed Length Mask

IP Address Basics

For IT Professionals Only

In this chapter you will see references to the term RFC. An RFC, Request For Comment, is a document created by the Internet community to define processes, procedures, and standards that control how the Internet and associated protocols work. Each RFC is assigned a number and a title that describes the contents. As an example, RFC791 is entitled Internet Protocol and is the standard that defines the features, functions, and processes of the IP protocol. RFCs are free and the whole text of any RFC can be downloaded from the Internet. You can find them at the following URL: http://www.isi.edu/in-notes.

As an IT Professional, you may often ask Why did they do that? Since the RFC is the official documentation of the Internet, you can often gain insight into why things are the way they are by reading RFCs related to your question.

Classful AddressingStructure and Size of Each Type

IPv4 addressing is used to assign a logical address to a physical device. That sounds like a lot to think about, but actually it is very simple. Two devices in an Ethernet network can exchange information because each of them has a network interface card with a unique Ethernet address that exists in the physical Ethernet network. If device A wants to send information to device B, device A will need to know the Ethernet address of device B. Protocols like Microsoft NetBIOS require that each device broadcast its address so that the other devices may learn it. IP uses a process called the Address Resolution Protocol. In either case, the addresses are hardware addresses and can be used on the local physical network.

What happens if device B, on an Ethernet network, wants to send information to device C on a token-ring network? They cannot communicate directly because they are on different physical networks. To solve the addressing problems of both device A and B, we use a higher layer protocol such as IPv4. IPv4 allows us to assign a logical address to a physical device. No matter what communication method is in use, we can identify a device by a unique logical address that can be translated to a physical address for actual information transfer.

The designers of IPv4 faced an addressing dilemma. In the early days of Internet development, networks were small and networking devices were big. Another issue was the future. In the early 1970s, the engineers creating the Internet were not aware of the coming changes in computers and communications. The invention of local area networking and personal computers were to have a momentous impact on future networks. Developers understood their current environment and created a logical addressing strategy based on their understanding of networks at the time.

They knew they needed logical addressing and determined that an address containing 32 bits was sufficient for their needs. As a matter of fact, a 32-bit address is large enough to provide 2 32 or 4,294,967,296 individual addresses. Since all networks were not going to be the same size, the addresses needed to be grouped together for administrative purposes. Some groups needed to be large, some of moderate size, and some small. These administrative groupings were called address classes.

For IT Professionals Only

From RFC791, page 7:

Addressing

    A distinction is made between names , addresses, and routes [4].   A

    name indicates what we seek. An address indicates where it is. A

    route indicates how to get there. The internet protocol deals

    primarily with addresses. It is the task of higher level (i.e.,

    host-to-host or application) protocols to make the mapping from

    names to addresses. The internet module maps internet addresses to

    local net addresses. It is the task of lower level (i.e., local net

    or gateways) procedures to make the mapping from local net addresses

    to routes.

    Addresses are fixed length of four octets (32 bits). An address

    begins with a network number, followed by local address (called the

    "rest" field). There are three formats or classes of internet

    addresses: in class a, the high order bit is zero, the next 7 bits

    are the network, and the last 24 bits are the local address; in

    class b, the high order two bits are one-zero, the next 14 bits are

    the network and the last 16 bits are the local address; in class c,

    the high order three bits are one-one-zero, the next 21 bits are the

    network and the last 8 bits are the local address.

IPv4 addresses are expressed in dotted decimal notation. For example, a 32-bit address may look like this in binary:

To make it easier to read, we take the 32-bit address and group it in blocks of eight bits like this:

Finally, we convert each eight-bit block to decimal and separate the decimal values with periods or dots. The converted IPv4 address, expressed as a dotted decimal address, is:

It is certainly easier to remember that your IP address is 126.136.1.47 instead of remembering a string of bits such as 01111110100010000000000100101111.

What Is a Network?

When talking about IP addressing, it is important to understand what the word network means. A network is a group of computing devices connected together by some telecommunications medium. It may be as small as a workgroup in the accounting department or as large as all of the computers in a large company, such as General Motors. From an addressing perspective, all computers in a network come under the administration of the same organization. If you want to send information to a computer, you can identify the computer by its IP address and know that the IP address is assigned to a company. The IP network can locate the computing resources of the company by locating the network. The network is identified by a network number.

Figure 2.1 Networks and the Internet.

Network numbers are actually IP addresses that identify all of the IP resources within an organization. As you can see in Figure 2.1, some organizations will require very large networks with lots of addresses. Other networks will be smaller, and still other networks will need a limited number of addresses. The design of the IPv4 address space took this factor into account.

Class A

The largest grouping of addresses is the class A group. Class A network addresses can be identified by a unique bit pattern in the 32bit address.

Figure 2.2 Class A address structure.

In the preceding group, you will see a 32-bit representation of a class A address. The first eight bits of a class A address indicate the network number. The remaining 24 bits can be modified by the administrative user of the network address to represent addresses found on their local devices. In the representation in Figure 2.2, the n's" indicate the location of the network number bits in the address. The l's" represent the locally administered portion of the address. As you can see, the first bit of a class A network address is always a zero.

With the first bit of class A address always zero, the class A network numbers begin at 1 and end at 127. With a 24-bit locally administered address space, the total number of addresses in a class A network is 2 24 or 16,777,216. Each network administrator who receives a class A network can support 16 million hosts . But remember, there are only 127 possible class A addresses in the design, so only 127 large networks are possible.

Here is a list of class A network numbers:

10.0.0.0

44.0.0.0

101.0.0.0

127.0.0.0

Notice that these network numbers range between 1.0.0.0 and .127.0.0.0, the minimum and maximum numbers.

Class B

The next grouping of addresses is the class B group. Class B network addresses can be identified by a unique bit pattern in the 32-bit address.

Figure 2.3 Class B address structure.

In Figure 2.3, you will see a 32-bit representation of a class B address. The first 16 bits of a class B address indicate the network number. The remaining 16 bits can be modified by the administrative user of the network address to represent addresses found on their local hosts. A class B address is identified by the 10 in the first two bits.

With the first two bits of class B address containing 10, the class B network numbers begin at 128 and end at 191. The second dotted decimal in a class B address is also part of the network number. A 16-bit locally administered address space allows each class B network to contain 2 16 or 65,536 addresses. The number of class B networks available for administration is 16,384.

Here is a list of class B network numbers:

137.55.0.0

129.33.0.0

190.254.0.0

150.0.0.0

168.30.0.0

Notice that these network numbers range between 128.0.0.0 and 191.255.0.0, the minimum and maximum numbers, respectively. And remember that the first two dotted decimal numbers are included in the network number since the network number in a class B address is 16 bits long.

Class C

The next grouping of addresses is the class C group. Class C network addresses can be identified by a unique bit pattern in the 32bit address.

Figure 2.4 Class C address structure.

In Figure 2.4, you will see a 32-bit representation of a class C address. The first 24 bits of a class C address indicate the network number. The remaining 8 bits can be modified by the administrative user of the network address to represent addresses found on their local hosts. A class C address is identified by the 110 in the first three bits.

With the first three bits of class C address containing 110, the class C network numbers begin at 192 and end at 223. The second and third dotted decimals in a class C address are also part of the network number. An 8-bit locally administered address space allows each class C network to contain 2 8 or 256 addresses. The number of class C networks available for administration is 2,097,152.

Here is a list of class C network numbers:

204.238.7.0

192.153.186.0

199.0.44.0

191.0.0.0

222.222.31.0

Notice that these network numbers range between 192.0.0.0 and 223.255.255.0, the minimum and maximum numbers, respectively. And remember that the first three dotted decimal numbers are included in the network number since the network number in a class C address is 24 bits long.

To summarize, each of the three IP address classes has the characteristics shown in Figure 2.5.

Figure 2.5 Address class characteristics.

Address Assignments

For IT Professionals Only

From RFC791, page 7:

Care must be taken in mapping internet addresses to local net addresses; a single physical host must be able to act as if it were several distinct hosts to the extent of using several distinct internet addresses. Some hosts will also have several physical interfaces (multi-homing). That is, provision must be made for a host to have several physical interfaces to the network with each having several logical internet addresses.

One task of address management is address assignment. As you begin the process of address allocation, you must understand how the addresses are used in the network. Some devices will be assigned a single address for a single interface. Other devices will have multiple interfaces, each requiring a single address. Still other devices will have multiple interfaces and some of the interfaces will have multiple addresses.

Single Address per Interface

Figure 2.6 Single address per interface.

A device connected to a network may have one or many networking interfaces that require an IP address. A word processing workstation in your network has a single Ethernet interface (see Figure 2.6). It needs only one IP address.

Multihomed Devices

A router is a networking device used to transfer IP datagrams from one physical network to another. The router by its very nature and function will have more than one interface and will require an IP address for each interface. Devices with more than one interface are called multihomed , and the process is called multihoming .

Figure 2.7 Multihomed device.

In Figure 2.7, the router has two interfaces. One interface is attached to the token-ring network and the other interface is attached to the Ethernet network. This is a multihomed device.

Assigning IP addresses to devices is a simple process (see Figure 2.8). A new device is installed in the network and the address administrator selects an unused address of the group of available addresses. The information is provided to the user of the device and the device is configured. The address given to the user must be from the same address group as all other devices on the same network or the IP data transmission rules will not work. The IP data transmission rules will be discussed in a later chapter.

Figure 2.8 IP address configuration

The actual configuration process for IP addresses varies from operating system to operating system and from device to device, so consult your system documentation for instructions. An important final step requires that a careful notation about assignment of the address be made in the address administrators documentation so that the address is not assigned to another device.

MultinettingMultiple Addresses per Interface

It is also possible that certain devices will have interfaces with more than one IP address assigned. Here is an example.

A new Internet site is under development for a small corporation. The network administrator knows that the site will grow in the future but today there is no need for a complex network. A server is installed that will be used as a web server, ftp server, mail server, and the corporations DNS server. Later, when the use of the network services grows, new servers will be used for each of the functions.

When the time comes to address the current server, the administrator has a choice. A single IP address can be used on the server and later, when the new servers are needed, new IP addresses can be assigned to them. Another way of assigning addresses can be used. The administrator can assign four IP addresses to the server. Each IP address will match the IP address to be used in the future on new servers. The administrator now knows what addresses will be used and can create DNS entries for the new devices with the correct addresses. The process of providing more than one IP address on an interface is often called multinetting or secondary addressing .

Examples

Assigning secondary addresses on cisco routers is done using IOS configuration commands. Here is an example of how to assign a primary IP address and two secondary IP addresses to an Ethernet interface:

interface ethernet 0

ip address 183.55.2.77 255.255.255.0

ip address 204.238.7.22 255.255.255.0 secondary

ip address 88.127.6.209 255.255.255.0 secondary

The routers Ethernet 0 interface now has addresses in the 183.55.0.0 network, the 204.238.7.0 network, and the 88.0.0.0 network.

Purpose of Subnetting

When the IP protocol was designed, the networks and computers are very different than they are today. With the advent of local area networks (LANS) and personal computers, the architecture of the computer networks changed. Instead of having big computers communicating over low-speed, wide area networks, we had small computers communicating over fast, local area networks.

To illustrate why IP subnetting is necessary, lets take a look at how IP sends datagrams. And to make it easy to understand, lets compare the process to sending mail at the post office. If you have a message to send to a member of your local family, you can deliver it to the family member by writing it down on a piece of paper and giving it directly to him or her. IP networks do the same thing. If an IP datagram is to be sent to a computer on the same physical network, the two devices can communicate directly (see Figure 2.9).

Figure 2.9 IP network with no subnetting.

The device 200.1.1.98 wants to communicate with 200.1.1.3. Since they are on the same Ethernet network, they can communicate directly. They are also on the same IP network so communication can take place without the help of any other devices.

Lets go back to our post office analogy. One of the children has now moved out of the house and has gone to college. To communicate with that child, you will need to have some help. You write a letter, put it in an envelope, and mail it. The post office makes sure that your letter reaches the addressee. Computing devices work according to the same principle. To communicate with devices not in the same physical network, the computing device needs some help. Here is how it is done.

Figure 2.10 Two networks, different locations

In the illustration in Figure 2.10, James wants to send a message to Sarah. They are all part of the same IP network, 153.88.0.0, but not a part of the same physical network. As a matter of fact, James computer is on a token-ring network in Los Angeles. Sarahs machine is located on an Ethernet network in Philadelphia. A connection between the two networks is required.

Figure 2.11 Inter/Intranet connectivity.

Just like the post office helps to deliver the letter to the student in college, routers help James to send a message to Sarah over the wide area network from Los Angeles to Philadelphia (see Figure 2.11). The IP process must send the message from James to the router. The router will send it to other routers until the message finally reaches the router on Sarahs network. Then the router on Sarahs network will send it to Sarahs machine.

The routers enable IP to send information from one physical network to another. How does IP know that Sarahs machine is not on the same physical network as James? IP must determine that Sarahs machine is on a different physical network by using the logical IP addressing scheme. In this instance, the address administrator must assist the network managers by breaking the 153.88.0.0 network into smaller components and place a block of addresses on each physical network. Each block of addresses that apply to each physical network is known as a subnet .

Figure 2.12 Two locations, subnetted .

In Figure 2.12, James machine is now found in the 153.88.240.0 subnet. Sarah's is in the 153.88.3.0 subnet. When James sends a message to Sarah, the IP process determines that Sarah is in a different subnet and sends the message to the router for forwarding.

Lets see how subnets are determined and how IP devices decide to forward datagrams to a router.

For IT Professionals Only

Numbering SystemsDecimal and Binary

Lets quickly review numbering systems before we get into subnetting. Our numbering system is based on 10 digits, the decimal system. Computers work on the binary system with two digits, 0 and 1. To group computer data elements together more efficiently , a 16 digit representation system was developed, the hexadecimal system.

There are elements of the decimal system that we understand but may not realize. When you read the number 1245, you say "one thousand two hundred forty five." But how do you know that? Because you use a decimal system that is based on the following information:

  Base

10 3

10 2

10 1

10 0

Decimal

1000

100

10

1

 

1

2

4

5

1245

   1000

200

40

5

So the number 1245 is actually:

1000   (1 thousands)

  200   (2 hundreds)

    40   (4 tens)

      5   (5 ones)

1245

The binary numbering system is similar, but based on the number 2. We often must convert binary numbers to decimal. In the following chart, you see the breakdown of the binary numbering system and the relative decimal number for each value. Given the binary number 11001011, we can convert it to decimal using the chart.

Base

2 7

2 6

2 5

2 4

2 3

2 2

2 1

2 0

Decimal

128

64

32

16

8

4

2

1

 

1

1

0

0

1

0

1

1

11001011

128

64

0

0

   8

0

2

1

So the binary number 10010101 converted to decimal is:

128

  64

    8

    2

     1

203

The Basic Fixed Length Mask

To help the IP device understand the subnetting used in the network, IP designers described the process of using a subnet mask in RFC950.

For IT Professionals Only

From RFC950, page 1Overview:

   This memo discusses the utility of "subnets" of Internet networks,

   which are logically visible sub-sections of a single Internet

   network.   For administrative or technical reasons, many organizations

   have chosen to divide one Internet network into several subnets,

   instead of acquiring a set of Internet network numbers.   This memo

   specifies procedures for the use of subnets.   These procedures are

   for hosts (e.g., workstations).   The procedures used in and between

   subnet gateways are not fully described.   Important motivation and

   background information for a subnetting standard is provided in

   RFC-940.

What the Mask Does

Simply stated, the mask is used to indicate the location of the subnet field in an IP address. What does that mean? In the previous figures, 153.88.0.0 is the network address. It is a class B address, which means that the first sixteen bits of the address is the network number. James machine is in the 153.88.240.0 subnet. How do we determine that?

James is in the 153.88.0.0 network. The administrator reserved the next eight bits to hold the subnet number. In the preceding example, James is in the 240 subnet. If James IP address were 153.88.240.22, James would be in the 153.88.0.0 network, in the 240 subnet of that network, and would have a host address of 22 in that subnet. All devices within the 153.88.0.0 network with a third octet of 240 are assumed to be on the same physical network and in the same subnet, the 240 subnet.

The subnet mask is used to interpret addresses to understand how they are subnetted. The mask is made up of 32 bits, just like the IP address. There are certain masks that are natural or default to the three classes of addresses.

For IT Professionals Only

Subnet masks frequently contain a reference to 255. The 255 reference simply indicates that all eight bits of that portion of the mask contain a 1. For instance, the binary representation of the mask 255.0.0.0 is 11111111000000000000000000000000. The mask 255.255.0.0 is 11111111111111110000000000000000.

The default or natural mask for the class A address is 255.0.0.0. In this case the mask indicates that the first eight bits represent the network number and must be used when evaluating a class A address for subnetting. If a device has a class A address assigned and has a mask of 255.0.0.0, there is no subnetting in that network. If a device has a class A address and has a mask that is not 255.0.0.0, the network has been subnetted and the device is in a subnet of the class A network.

Figure 2.13 Addresses with no subnetting.

In Figure 2.13, the 125.0.0.0 network has been subnetted. The mask is not the default mask so we know that the network has been subnetted. What does the rest of the mask mean?

As stated earlier, the mask is used to indicate the location of the subnet field in an IP address. Lets look at what makes up a mask.

Components of a Mask

The mask is a 32-bit binary number that is expressed in dotted decimal notation. By default, the mask contains two fields, the network field and the host field. These correspond to the network number and the locally administered part of the network address. When you subnet, you are adjusting the way you view the IP address. If you are working with a class B network and are using the standard mask, there is no subnetting. For example, in the address and mask in Figure 2.14 the network is indicated by the first two 255 entries and the host field is indicated by the ending 0.0.

Figure 2.14 Class B address with standard mask.

The network number is 153.88 and the host number is 4.240. In other words, the first sixteen bits are the network number and the remaining sixteen bits are the host number.

When we subnet a network we increase the hierarchy from network and host to network, subnet and host. If we were to subnet the 153.88.0.0 network with a subnet mask of 255.255.255.0, we will be adding an additional piece of information. Our view changes in that we will be adding a subnet field. As with the previous example, the 153.88 is still the network number. With a mask of 255.255.255.0, the third octet is used to tell us where the subnet number is located. The subnet number is .4 and, finally, the host number is 240.

Figure 2.15 Subnet mask fields.

The locally administered portion of the network address can be subdivided into subnetworks by using the mask to tell us the location of the subnet field. We allocate a certain number of bits to the subnet field and the remainder is then the new host field. In Figure 2.15, we took the 16-bit host field that comes with a class B address and broke it down into an 8-bit subnet field and an 8-bit host field.

Binary Determination of Mask Values

How do you determine which mask to use? On the surface it is a fairly simple process. You first determine how many subnets are required in your network. This may require you to do a lot of research into the network architecture and design. Once you know how many subnets you will need, you can decide how many subnet bits are needed to provide you with a subnet field big enough to hold the number of subnets you need.

When a network is in the design phase, the network administrator discusses the design with the address administrator. They conclude that there will be a total of 73 subnets in the current design and that a class B address will be used. To develop the subnet mask, we need to know how big the subnet field must be. The locally administered portion of a class B address contains 16 bits.

Remember that the subnet field is a portion of these 16 bits. The challenge is to determine how many bits are required to store the decimal number 73. Once we know how many bits are needed to store the decimal number 73, we can determine what the mask should be.

The first step is to convert the decimal number 73 to binary.
   The number of bits in the binary number is seven. So we need to reserve the first seven bits of the locally administered portion of the subnet mask for the subnet field and the remainder will be the host field.


In the preceding example we are reserving the first seven bits for the subnet field, indicated by the one bits, and the remainder to the host field, indicated by the zero bits. If we convert this binary information into decimal for the subnet mask and add it to the portion of the mask for the network number, we will have the entire subnet mask necessary.


Remember, 255.255.0.0 is the default mask for a class B address. We have replaced the locally administered portion of the mask, the .0.0, with the 254.0 that depicts the subnetting scheme. The 254.0 portion tells the software that the first seven bits of the locally administered portion of the address is the subnet field and the remainder is the host field. Of course, if the subnet mask numbers change, the interpretation of the subnet field changes.

Decimal Equivalent Mask Values

Tables 2.1, 2.2, and 2.3 show the possible subnet masks that can be used in class A, class B, and class C networks.

Table 2.1 Class A Subnet Table

Subnets

Hosts

Mask

Subnet Bits

Host Bits

2

            4,194,302

255.192.0.0

2

22

6

            2,097,150

255.224.0.0

3

21

14

            1,048,574

255.240.0.0

4

20

30

            524,286

255.248.0.0

5

19

62

            262,142

255.252.0.0

6

18

126

            131,070

255.254.0.0

7

17

254

            65,534

255.255.0.0

8

16

510

            32,766

255.255.128.0

9

15

1,022

            16,382

255.255.192.0

10

14

2,046

            8,190

255.255.224.0

11

13

4,094

            4,094

255.255.240.0

12

12

8,190

            2,046

255.255.248.0

13

11

16,382

            1,022

255.255.252.0

14

10

32,766

            510

255.255.254.0

15

9

65,534

            254

255.255.255.0

16

8

131,070

            126

255.255.255.128

17

7

262,142

            62

255.255.255.192

18

6

524,286

            30

255.255.255.224

19

5

1,048,574

            14

255.255.255.240

20

4

2,097,150

            6

255.255.255.248

21

3

4,194,302

2

255.255.255.252

22

2

Table 2.2 Class B Subnet Table

Subnets

Hosts

Mask

Subnet Bits

Host Bits

2

16382

255.255.192.0

2

14

6

8190

255.255.224.0

3

13

14

4094

255.255.240.0

4

12

30

2046

255.255.248.0

5

11

62

1022

255.255.252.0

6

10

126

510

255.255.254.0

7

9

254

254

255.255.255.0

8

8

510

126

255.255.255.128

9

7

1022

62

255.255.255.192

10

6

2046

30

255.255.255.224

11

5

4094

14

255.255.255.240

12

4

8190

6

255.255.255.248

13

3

16382

2

255.255.255.252

14

2

Table 2.3 Class C Subnet Table

Subnets

Hosts

Mask

Subnet Bits

Host Bits

2

62

255.255.255.192

2

6

6

30

255.255.255.224

3

5

14

14

255.255.255.240

4

4

30

6

255.255.255.248

5

3

62

2

255.255.255.252

6

2

These subnet mask tables can make it easier for you to determine which subnet mask to use for any given situation. Look at the tables for just a minute and notice what happens. As you go down the table, the number of subnets increases and the number of hosts in each subnet then decreases. Why? Look at the right-hand side of each table. As the number of subnet bits increases , the number of host bits decreases. Since we have a fixed number of bits to work with in each class of network address, each bit can be used in only one wayspecified by the mask. Each bit must be either a subnet bit or a host bit. An increase in the number of subnet bits causes a reduction in the number of host bits.

Notice too that the tables are different sizes for each class of address. Because of the 24-bit, 16-bit and 8-bit host fields for class A, B, and C networks, respectively, we have three different tables.

Creating Masks for Various Networking Problems

The tables make it easy to locate the correct mask for your networking problem. Consider the following problems:

Bob was given a class A network to administer. He needs to subnet the network into 1045 subnets with 295 devices in the largest subnet. He looks up the subnet and device numbers in the class A table and finds that the following five entries can be used to solve his problem. Which should he use?

2,046

            8,190

255.255.224.0

11

13

4,094

            4,094

255.255.240.0

12

12

8,190

            2,046

255.255.248.0

13

11

16,382

            1,022

255.255.252.0

14

10

32,766

            510

255.255.254.0

15

9

Bob must select one mask to use. As he looks at his possible solutions he also has to understand another factor involved in his decision: the growth of the network. Will his company add more subnets in the future, or will each subnet get bigger, or both?

If the number of subnets will increase without an increase in devices in each subnet, Bob could select 255.255.254.0 as his mask and be comfortable with his decision. If the number of devices in each subnet will increase, he could select 255.255.252.0 as his mask. Depending on the physical protocol in use, there may be practical limits to the number of devices in each subnet. In some networks, having more than 100 physical devices in a network segment or subnet may seriously impact the usability of the network. Using realistic estimates of devices in each subnet is essential to subnetting success.

In another example, Sarah is in charge of a small corporate network with two Ethernet segments and three token-ring segments. They are connected together with one router. Each subnet will contain no more than 15 devices. Sarah has been assigned a class C network address. As Sarah looks at the class C table, she finds that the following entry may be used to solve the problem as described:

6

30

255.255.255.224

3

5

The only entry that allows five subnets with 15 devices is 255.255.255.224.

If you have a good idea of the number of subnets and the number of hosts in each subnet, you can use these tables to find the proper mask. It is always important to know if the number of subnets will grow in the future or if the number of hosts in the subnets will grow. Once the growth factors have been included in the current need, check the tables to determine your mask.

Addresses and Mask Interaction

Lets review the concept of IP addresses. An IP address identifies a device on a network. IP addresses are assigned from classes that contain different groups of addresses. Each IP network has a network number. Each IP subnet has the network number of its parent network and a subnet number. The subnet number can be found by locating the subnet field in the subnet mask.

If you have an IP address of 153.88.4.240 with a mask of 255.255.255.0, you know that you have an address in the 153.88.0.0 network. You know you are in subnet .4 because the third octet of the mask says that all eight bits of the address in the third octet make up the subnet number. By the way, all devices with a 153.88 in the first two octets are in the same network and all devices with a 4 in the third octet are in the same subnet. Why is that?

In a class B network, the first 16 bits are the network number. If devices have the identical first 16 bits, they are in the same network with a class B address. When you want to send a datagram from the source address to the target address, IP has to make a routing decision. Look at the example in Figure 2.16.

Figure 2.16 Subnet mask interpretation.

Notice that these are different networks. They are both class B addresses, but the first 16 bits do not match. They are different; therefore, IP "assumes" they are on different physical networks and will send the datagram to the router for forwarding to the target device. IP only looks at subnetting when the network numbers of the two addresses are the same.

We had mentioned earlier that the subnet mask helps us locate the subnet number. Figure 2.17 contains another example.

Figure 2.17 Locating the subnet number.

In this example, you will see that we have modified the target address. We have also added a subnet mask that we can use to determine subnetting. Notice the mask, 255.255.255.0. The first two 255s in the mask point to the network portion of the address since we are using a class B address. The third 255 is the location of the subnet field in the locally administered portion of the addresses. The ones in the mask point to the subnet bits. Are these two devices in the same subnet? Look at the bits in the third octet of each address. The source address has a binary subnet field of 00000100 and the target address has a binary subnet field of 11000000. Since these two binary numbers are not the same, these two devices are in different subnets and the source device will send datagrams to the router for delivery to the target device in the target network.

So far we have been working with the easiest subnetting, the 255.255.255.0 mask. Using a mask of 255.255.255.0 allows us to interpret the address by reading the dotted decimal address. For example, an address of 165.22.129.66 contains the network address 165.22.0.0. The subnet number is 129. The host number is 66. Each portion of the dotted decimal address contains address information that is easy to interpret.

What happens when the mask is not so simple? In the next example we will work with a class B network, 160.149.0.0. The subnet mask selected by the administrators is 255.255.252.0. This gives the network 62 subnets with 1022 devices in each subnet.

Lets see what happens when we try to determine the subnet identity of two devices.

Figure 2.18 The same subnet?

The network portion of the two addresses in Figure 2.18 is identical, so they are in the same network. The subnet portion of the mask contains six bits, so the first six bits of the third octet contains the subnet number. The first six bits of the third octet is 011100 for 115 and 011101 for 117. These devices are in different subnets. Datagrams sent from the source machine would have to be sent to the router to reach the target device.

Why are these two devices in different subnets? First, they are in the same network and are candidates for being in the same subnet. The subnet portion of the mask says that the first six bits of the third octet of each address contains the subnet number. In comparing the subnet portion of the two addresses, bit patterns do not match. They are in different subnets.

Another example is shown in Figure 2.19.

Figure 2.19 The same subnet? Yes!

In this example 160.149.115.8 and 160.149.114.66 are in the same network and subnet. Look at the third octet. Where the ones bit exist in the mask, the bits in both addresses are identical, indicating that they are in the same subnet. Even though the third octet contains 114 in one address and 115 in the other, they are in the same subnet because the significant bits are the same in both addresses.

For IT Professionals Only

IP addresses are assigned to interfaces on devices in an IP network. Often the terms used to indicate this assignment can be confusing. The RFCs dealing with IP often refer to the devices as hosts . A host is an entity assigned an IP address. With multinetting and multihoming, it is possible to assign more than one address to a device or to an interface. With the term host address we can then relate IP addresses to the host of the IP process, regardless of the actual physical structure of the device or interfaces. So when you see host, hosts, or host address, remember that it is not all that complicated. It is just another way to refer to entities that are assigned IP addresses.

Reserved and Restricted Addresses

When assigning addresses to devices in networks and/or subnets, there are some addresses that cannot be used. We reserve two addresses in any network or subnet to uniquely identify two special functions. The first reserved address is the network or subnet address. The network address is the address that includes the network number and a host field filled with binary zeros. 200.1.1.0, 153.88.0.0, and 10.0.0.0 are network addresses. These addresses identify the network and cannot be assigned to a device.

Another reserved address is the broadcast address. When used, it is meant to attract the attention of all devices in the network. The network broadcast address is the network number followed by a host field of binary ones. The addresses in Figure 2.20 are network broadcast addresses: 200.1.1.255, 153.88.255.255, and 10.255.255.255. Since this address is supposed to attract the attention of every device, it cannot be used on any single device.

We also restrict addresses in subnets. Each subnet has a subnet address and a broadcast address. Like the network address and broadcast address, these addresses cannot be assigned to devices and contain host fields of all zeros and all ones for the subnet address and subnet broadcast.

Figure 2.20 Restricted/reserved addresses.

In this example, the subnet address is shown with all zeros in the host field, and the broadcast address is shown with all ones in the host field. Regardless of the size of the subnet field or host field, the bit structure of all zeros in the host field is the subnet address, and all ones in the host field is the subnet broadcast address.

Determining the Range of Addresses within Subnets

Once you have determined what mask to use and understand the special subnet address and subnet broadcast address, you can begin the process of determining what addresses are going to be assigned to specific devices. To do that, you will need to calculate which addresses are in each subnet.

Each subnet will contain a range of addresses with the same network and subnet number. The difference will be in the host numbers. Figure 2.21 contains an example of a set of addresses in a subnet of a class C network.

Figure 2.21 Subnet address example.

In the preceding example, we are using the 200.1.1.0 class C network. The subnet mask is 255.255.255.248. Subnetting can only occur in the fourth octet in a class C address. Each subnet can contain six devices using this mask. In creating the addresses for subnet number 1, notice that the subnet field of each address is 00001. The subnet field is indicated by the 11111 portion of the fourth octet of the mask. The subnet field exists in the first five bits of the fourth octet. The remaining three bits are used to indicate the host field.

The host field for each address increases from 000 for the subnet address to 111 for the subnet broadcast address. The addresses that can be assigned to specific hosts increase from 001 to 110, the binary equivalent of decimal 1 to decimal 6. So why do the addresses look the way they do? We simply combine the subnet number, 00001, with each host field, 000 through 111, and convert each address from binary to decimal. We begin with 200.1.1.8 (00001000) and end with 200.1.1.15 (00001111). In this case, we dont change the 200.1.1. part of the address because that is the network number.

More information and the processes used to develop an addressing plan will be found in Chapter 3.

Determining Subnet Addresses Given a Single Address and Mask

If you have an IP address and a subnet mask, you can determine the subnet where the device is located. The steps are as follows :

1.    Convert the locally administered portion of the address to binary.

2.    Convert the locally administered portion of the mask to binary.

3.    Locate the host field in the binary address and replace with zeros.

4.          Convert the binary address to dotted decimal notation. You now have the subnet address.

5.    Locate the host field in the binary address and replace with ones.

6.    Convert the binary address to dotted decimal notation. You now have the subnet broadcast address.

Everything between these two numbers represents IP addresses that may be assigned to devices.

Figure 2.22 contains an example of how to use this process. The address of the device is 204.238.7.45 and the subnet mask is 255.255.255.224. Since this is a class C address, subnetting occurs in the fourth octet.

Figure 2.22 Determining subnet address and broadcast address.

The host field is located in the last five bits of the address. Replacing the host field with zeros and converting the binary number to decimal gives us the subnet address. Replacing the host field with ones results in the subnet broadcast address. The address 200.1.1.45 subnetted with a mask of 255.255.255.224 is in the subnet 200.1.1.32. The addresses that can be assigned in this subnet are 200.1.1.33 through 200.1.1.62.

Interpreting Masks

Figure 2.23 Interpreting masks.

Each subnet mask is made up of binary values and is represented in dotted decimal notation. The allowable decimal values that can be used in the mask are seen in Figure 2.23. In order to use these values, there must be a 255 immediately to the left. The subnet mask bits must be contiguous. For example, a mask of 255.255.0.224 is not appropriate.

We are sometimes asked How many bits are in the mask? The question is answered by expressing the number of bits in the mask with relation to the class of address. For instance, if a mask of 255.255.254.0 is used with a class B address, there are seven bits in the mask. It may look like there are a total of 23 bits, which there are. To clearly express the subnetting, however, we must say that the mask is a seven-bit mask for a class B address. Only seven bits of the total 23 bits are used for subnetting. The remaining 16 bits come with the class B address.

This may seem like a silly little point but it can lead to a very bad miscommunication . If I tell you I have a six-bit mask, what does that mean? Without the class of address, the mask could be 255.252.0.0, 255.255.252.0, or 255.255.255.252. Each of these masks is a six-bit mask, but they apply to different classes of addresses and give us a completely different subnet picture.

Reserved Addresses

Earlier in the chapter we talked about certain reserved addresses. Specifically we said that the network address, network broadcast address, the subnet address, and the subnet broadcast address could not be assigned to any device or host. This is to avoid confusion on the part of the IP software that is responsible for transporting the IP datagrams. These addresses do not uniquely identify any particular device. IP devices may send datagrams using the broadcast address but the broadcast address means everyone. A single device cannot be everyone, it must have a unique address.

We need to remove the reserved addresses from our address calculation and do so by using a special formula to determine how many hosts are available in a subnet or network. If you know the number of bits in the host field of an address, you can calculate the number of devices in the network or subnet. The formula that we use is

2 n -2


In this formula, n represents the number of bits in the subnet or host field. We subtract two to remove the two reserved addresses from the calculation. In the following excerpt of the class C subnetting table, you can see the results of using this formula.

Subnets

Hosts

Mask

Subnet Bits

Host Bits

14

14

255.255.255.240

4

4

Using a subnet mask of 255.255.255.240, we have four bits in the subnet field. The number of bit patterns that exist in four bits is 2 4 or 16. They are as follows:

0000     0100     1000     1100

0001     0101     1001     1101

0010     0110     1010     1110

0011     0111     1011     1111

Removing the two reserved bit patterns, 0000 and 1111, from the possible subnet values leaves us with 14 subnet numbers to use. This same calculation also applies to the bits in the host field.

For IT Professionals Only

Subnet Zero and Subnet All Ones

RFC950 requires that subnet number zero and subnet all ones be restricted and not assigned to any subnet. Subnet zero contains all zero bits in the subnet field and subnet all ones contains all one bits in the subnet field. Early IP implementations often confused these addresses with broadcast addresses, and the designers of RFC950 decided to restrict these addresses to end the confusion. Today, the use of subnet zero and subnet all ones is allowed. The actual use depends on the IP software on the devices in use in those subnets. In certain cases, the use of these restricted subnets must be enabled in the IP devices before they can be used. Check with your vendor documentation to see if these restricted subnets are allowed in your network.

Summary

In this chapter we discussed the IPv4 32 bit address structure. We showed you the components of an IPv4 address, described the classes of addresses, and designated exactly how many addresses are available in each class.

You then learned why we subnet and how we subnet. We disclosed the contents of the subnet mask and how the subnet mask is created. You were shown the process used to convert decimal number to binary and binary numbers to decimal. The contents of subnet mask tables were made available and the process of selecting a subnet mask for a networking problem was described.

Finally, you were shown how to determine if two addresses were in the same subnet and which addresses were in a subnet. Additionally, we discussed what addresses could not be used on IP devices.

FAQs

Q: Can I use a mask like 255.255.255.139 in a class B network?

A: IP subnetting rules do not restrict you from using any sequence of bits to represent a subnet mask. The subnet field in the preceding mask includes all of the one bits in the last two octets. The bits in the last two octets are not contiguous. They all dont sit side by side.

255       139

11111111 10001011

This forces the address administrator to calculate each address individually. There is also no continuous range of addresses in each subnet. It is too confusing and too difficult to subnet using strange and wonderful masks like the preceding one. Select your masks from the tables in the chapter.

Q: I confuse my address with my mask. How can I tell the difference?

A: The mask will always have 255 in the first octet. The address will never have 255 in the first octet.

Q: How can I be sure that the mask I select for my network is correct?

A: Always a good question. The answer is You cannot! Even if you did the correct research and created the best possible mask with current information, changes in network design and network administration may force you to modify the addressing structure. That would mean that the mask you selected may not be appropriate. The best suggestion is to make sure there is plenty of room for growth in subnets and hosts in each subnet when you select your mask and create your addressing plan.

Q: Why do I need to know the decimal to binary conversion?

A: To understand fully how subnetting works, it is necessary to understand how the bits in the mask and the address are related. To see the relationship, it is often necessary to view the addresses in binary along with the binary representation of the mask. Without decimal to binary conversion, it is difficult to view the relationship.



IP Addressing and Subnetting, Including IPv6
IP Addressing and Subnetting, Including IPv6
ISBN: 672328704
EAN: N/A
Year: 1999
Pages: 15

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net