Subnetting

Subnetting allows the network or IP address administrator to maximize the use of an IP address space within the network. A subnet mask borrows bits from an IP address's host portion and uses the bits to define new networks. If subnetting is implemented, IP addresses have three sections:

► Host Address

Note: All IP addresses have a mask associated with them, either implied (default) or defined. There are three address representations: dotted decimal, bitcount, and hexadecimal.

The subnet or network defines the arbitrary segmentation performed by the network administrator. The subnet allows the creation of a hierarchical routing network.

A subnet mask is a 32-bit decimal number that is used to identify a network and its host addresses. Subnet masks can be the classful kind, as shown earlier in Table 5.1.

Class A, B, and C network addressing schemes are not much use in today's complex Internetworks unless you extend the mask or use variable length subnetting to avoid wasting IP address space. The phrase variable length subnetmask (VLSM) refers to the fact one network can be configured with different subnet masks. For example, a network could be configured to have one mask that allows only two hosts and another mask that can be extended to allow 512 hosts. VLSM ensures that IP addressing is not wasted. Think of a serial line that contains two routers. Why assign a Class C address for two nodes? Instead, you could assign an address (subnet) that contains only two hosts; the mask 255.255.255.252 can be used to accomplish this.

To determine the number of hosts or subnets available on a network, you need to examine the IP addresses in binary. To determine the number of hosts or subnets you can assign to a network, you apply the formula 2n-2, where n equals the number of borrowed bits. Why are two subnets subtracted? Because one address is reserved to identify the subnet and the other is used to send broadcasts (bits that are set to all 0s or all 1s are used for broadcasts). Determining how many hosts or subnets you can assign to a network is best explained with examples.

Let's assume the subnet mask 255.255.255.240 has been applied to your network. How many subnets are available when assigning the subnet address of 131.108.1.0?

Looking at the subnet mask, you can interpret the 240 as 11110000 in binary. Hence, 4 bits have been borrowed from the host portion of the IP address to form a subnet. Therefore, the subnet mask formula would be 24-2, which equates to 14 subnets (2*2*2*2=16-2=14). Why do we take away 2 subnets? The reason is that they are used to represent the subnet and the broadcast address. Bits that are set to all 0s are the network (wire address) and all 1s are used for broadcasts. This can be shown in the following:

131.108.1.0 255.255.255.240

In this subnet and subnet mask, note that:

Network address 131.108.1.0

First usable host address

131.108.1

1

Last usable host address

131.108.1

,14

Directed Broadcast address

131.108.1

,15

Broadcast address 255.255.255.255

Similarly, consider the mask 255.255.255.192. How many end nodes could reside on the network? Note that 192 in binary is 11000000. Hence, two bits have been borrowed, so the end nodes can use the last six bits. The formula would be 26-2, which equates to 62 hosts.

Note: When using a 26-bit subnet mask, you need to use the ip subnet command to access all of the subnets that the mask allows!

It is vital that you have a good understanding of how an IP address' network and host portion is calculated. You should be able to calculate the number of hosts on a network using any IP addressing scheme.

For additional review, let's look at a couple more examples of how to calculate the host and subnet portion of any given class of address.

Given the host address of 131.108.1.93/24, what is the subnet and broadcast address?

You need to know what a network address such as 131.108.1.0/24 means. In this example, the address is the equivalent of the network 131.108.1.0 with a subnet mask of 255.255.255.0, or 24 bits of subnetting.

The notation 131.108.1.93/24 means that the subnet mask uses 24 bits, or the equivalent of a subnet mask represented as 255.255.255.0 in dotted format. Therefore, 131.108.1.93/24 is the same as 131.108.1.93 255.255.255.0. In binary, 131.108.1.93 is:

10000011.01101100.00000001.01011101

And the mask, 255.255.255.0 in binary is:

11111111.11111111.11111111.00000000

Performing a logical AND operation on the host address and subnet mask will provide you with the subnet mask, which has been derived as 255.255.255.0, or a Class C address. To determine the subnet, you must perform a logical AND function on the host. Logical AND means that 1 and 1 equates to 1 only. The remaining options are 0 AND 0 is 0, 0 AND 1 is 0. The logical AND operation provides the following:

10000011.01101100.00000001.01011101 IP ADDRESS 11111111.11111111.11111111.00000000 Subnet Mask EQUALS NETWORK 10000011.01101100.0000001.0000000

ALERT

ALERT

10000011.01101100.0000001.0000000 is a 131.108.1.0 subnet address. To determine the broadcast address, you need the decimal equivalent of all one bits (11111111), which is 255; hence, the broadcast address of a 131.108.1.0 subnet is 131.108.1.255.

Finally, let's look at a Class A host address of 10.99.34.50. Using a Class C mask, what is the network portion and how many hosts can reside on this network?

The logical AND function is performed once more. A Class C mask is 255.255.255.0 when represented in decimal format. Therefore, 10.99.34.50 and 255.255.255.0 in binary is

00001010.01100011.00100010.00110010 11111111.11111111.11111111.00000000

A logical AND between the address and mask yields:

00001010.01100011.00100010.00000000

00001010.01100011.00100010.00000000 indicates a subnet of 10.99.34.0. The number of hosts available on a Class C mask is 28-2, or 254 hosts, because 2 addresses are used to identify the subnet and the directed broadcast address. A directed broadcast address is sent to all hosts on the subnet only. (10.99.34.0 is the subnet and 10.99.34.255 is a directed broadcast address for all users on the local subnet.)

Table 5.2 provides a useful guide that can help you to prepare for the exam. Table 5.2 displays the decimal value and binary value of a subnet number followed by the number of available subnets. The number of hosts that can reside on each subnet follows.

Note: Try some subnet examples on your own and then compare them to a subnet calculator freely available on the Internet. Cisco's Web site (www.cisco.com/ techtools/ip_addr.html) has a subnet calculator.

Table 5.2 Common subnets.

Readers' Questions

  • COREY
    When using the route command at a command prompt, which entry indicates the default route?
    18 days ago
  • The default route entry in the route command is indicated by "0.0.0.0" as the destination or network, with the gateway IP address as the next hop.
    • Johanna
      How to find netmask of ip address?
      18 days ago
    • To find the netmask of an IP address, you can follow these steps:
      1. Identify the IP address you want to find the netmask for.
      2. If the IP address is in decimal format (e.g., 192.168.0.1), convert it to binary representation. Each part of the IP address should be converted to its 8-bit binary form.- For example, 192.168.0.1 would be converted to 11000000.10101000.00000000.000000
      3. Count the number of consecutive 1s in the binary representation.- For example, 11000000.10101000.00000000.00000
      4. 001 has a continuous block of 1s in the first 24 bits.
      5. The number of consecutive 1s determines the netmask.- In this example, the netmask would be
      6. 24 (or 255.255.255.0 in decimal format).Alternatively, you can use online netmask calculators or command-line tools to find the netmask of an IP address.
      • christina
        What is the purpose of configuring a default gateway address on a host?
        2 months ago
      • The purpose of configuring a default gateway address on a host is to enable it to communicate with devices on other networks. A host, such as a computer or a network device, sends data packets to other machines on the same network directly. However, if the destination IP address is on a different network, the host needs to send the data to its default gateway, which acts as a bridge between different networks. The default gateway is usually the IP address of the router that connects to the local network and the outside world. When a host receives a data packet intended for a different network, it checks its routing table. If it doesn't find an entry for that specific network, it sends the packet to the default gateway. The gateway then forwards the packet to the appropriate network until it reaches the destination. In simple terms, configuring a default gateway allows a host to access resources on other networks by sending data through the appropriate router.
        • nina anderson
          Is broadcast address same as gateway?
          4 months ago
        • No, a broadcast address is a network address that is used to send data to all devices on a particular network, while a gateway is a device on a network that acts as an entrance to other networks.
          • christine
            What is a gateway adress?
            4 months ago
          • A gateway address, also known as a default gateway, is a network node that serves as an access point or IP router to other networks in the Internet or private network. A gateway address is typically a private IP address.
            • martina
              How set default gateway in subnetting?
              5 months ago
              1. To set a default gateway in subnetting, open the Network and Sharing Center in the Control Panel.
              2. Select Change adapter settings from the list of options.
              3. Right click the network adapter that you want to configure, then select Properties.
              4. Select Internet Protocol Version 4 (TCP/IPv4) from the list of items, then click Properties.
              5. Select Use the following IP address and fill out the appropriate IP address for the network adapter. Make sure to select the correct subnet mask for the IP address being used.
              6. Select Use the following gateway address and fill out the IP address of the router or the gateway of the network.
              7. Click OK to save the settings.You have now successfully set a default gateway in subnetting.
              • rahel sebhat
                How to find default gateway number?
                10 months ago
              • The default gateway number can be found using the following steps:
                1. Open the Command Prompt.
                2. Type in the command “ipconfig” and press Enter.
                3. Look for the “Default Gateway” line. The number following the colon is your default gateway number.
                • Amilcare
                  How many usable hosts are available given a class c ip address with the default subnet mask?
                  10 months ago
                • With a class C IP address and the default subnet mask of 255.255.255.0, there are 254 usable hosts available.
                  • MULU
                    How to find subnet mask on router?
                    10 months ago
                    1. Log in to your router's web-based configuration page.
                    2. Look for the Network Settings or LAN Settings.
                    3. Find the IP address information listed.
                    4. Look for the Subnet Mask. This will typically be a series of numbers (e.g. 255.255.255.0).
                    5. Make a note of the Subnet Mask, then click Save or Apply to save your changes.
                    • mungo underhill
                      How to find ip address subnet mask and gateway?
                      10 months ago
                    • The most common way to find your IP address, subnet mask and gateway is to go to the Command Prompt on your computer and type in "ipconfig" (without the quotes). This will display a list of information regarding your network, including your IP Address, Subnet Mask and default Gateway.
                      • Katja
                        What is netmask and gateway?
                        10 months ago
                      • Netmask: A netmask is used in network configurations to determine which parts of an IP address belong to the network and which parts belong to the hosts. It is also used to determine what subnet an IP address belongs to. Gateway: A gateway is a device or software process that connects two networks together. It acts as an access point for users on one network to access information from other networks. Examples of gateways include routers and firewalls.
                        • Bildad
                          What is the network address and subnet mask of a default route?
                          10 months ago
                        • The network address and subnet mask of a default route is typically 0.0.0.0/0.
                          • Luce
                            How to calculate default getway?
                            1 year ago
                          • The default gateway is the IP address of the router on a network. To calculate the default gateway, use the IP address of the router combined with the subnet mask. The formula for calculating the default gateway is as follows: Default gateway = IP address of router AND Subnet mask
                            • gildo
                              How to calculate the default gateway?
                              1 year ago
                            • The default gateway is typically the IP address of your router. To calculate it, look up the subnet mask of your network and determine the network address. Then, take the network address and add one to the last octet. The result of this calculation is the default gateway for your network.
                              • zahra kinfe
                                What is the subnet mask of your network default gate way?
                                1 year ago
                              • The subnet mask and default gateway of a network depend on the specific router or modem being used. For most home and small office networks, the default subnet mask is usually 255.255.255.0 and the default gateway is usually the router's IP address.
                                • NEGISTI
                                  How to calculate gateway of this IP ?
                                  1 year ago
                                • To calculate the gateway of an IP address, use the following formula: Gateway = (IP address & Subnet Mask) | (~ Subnet Mask) For example, if the IP address is 192.168.1.2 and the subnet mask is 255.255.255.0, the gateway is: Gateway = (192.168.1.2 & 255.255.255.0) | (~ 255.255.255.0) = (192.168.1.0) | (0.0.0.255) = 192.168.1.255

                                  Decimal

                                  Subnets

                                  Hosts

                                  252 (11111100)

                                  64 subnets

                                  2 hosts

                                  248 (11111000)

                                  32 subnets

                                  6 hosts

                                  240 (11110000)

                                  16 subnets

                                  14 hosts

                                  224 (11100000)

                                  8 subnets

                                  30 hosts

                                  192 (11000000)

                                  4 subnets

                                  62 hosts

                                  128 (10000000)

                                  2 subnets

                                  126 hosts

                                  Now that we've covered the IP addressing and the formats that are used to represent IP addresses, let's move on to a more advanced IP routing concept—Classless Interdomain Routing (CIDR).

                                  Continue reading here: ARP and RARP

                                  Was this article helpful?

                                  +3 -8