Using Prefixes to Represent a Subnet Mask

As discussed, subnet masks identify the number of bits in an address that represent the network, subnet, and host portions of the address. Another way of indicating this information is to use a prefix. A prefix is a slash (/) followed by a numeric value that is the number of bits in the network and subnet portion of the address. In other words, it is the number of contiguous 1s in the subnet mask. For example, assume you are using a subnet mask of 255.255.255.0. The binary representation of this mask is 11111111.11111111.11111111.00000000, which is 24 1s followed by eight 0s. Thus, the prefix is /24, for the 24 bits of network and subnet information, the number of 1s in the mask.

Table B-4 shows some examples of the different ways you can represent a prefix and subnet mask.

Table B-4 Representing Subnet Masks

IP Address/Prefix

Subnet Mask in Decimal

Subnet Mask in Binary

192.168.112.0/21

255.255.248.0

11111111.11111111.11111000.00000000

172.16.0.0/16

255.255.0.0

11111111.11111111.00000000.00000000

10.1.1.0/27

255.255.255.224

11111111.11111111.11111111.11100000

It is important to know how to write subnet masks and prefixes because Cisco routers use both, as shown in Example B-1. You will typically be asked to input a subnet mask when configuring an IP address, but the output generated using show commands typically displays an IP address with a prefix.

Example B-1 Examples of Subnet Mask and Prefix Use on Cisco Routers

p1r3#show run

<Output Omitted> interface Ethernet® ip address 10.64.4.1 255.255.255.0

Example B-1 Examples of Subnet Mask and Prefix Use on Cisco Routers (Continued)

interface Serial0

ip address 10.1.3.2 255.255.255.0 <Output Omitted>

p1r3#show interface ethernet0

Ethernet0 is administratively down, line protocol is down

Hardware is Lance, address is 00e0.b05a.d504 (bia 00e0.b05a.d504) Internet address is 10.64.4.1/24 <Output Omitted>

p1r3#show interface serial0

Serial0 is down, line protocol is down Hardware is HD64570 Internet address is 10.1.3.2/24 <Output Omitted>

This section reviews IPv4 access lists. It includes the following topics:

■ IP access list overview

■ IP standard access lists

■ IP extended access lists

■ Restricting virtual terminal access

■ Verifying access list configuration

Continue reading here: IP Standard Access Lists

Was this article helpful?

+1 -1

Readers' Questions

  • tommy
    What is masking in networking?
    4 months ago
  • Masking is a networking technique used to hide the identity of a user or device on a network. It is commonly used when trying to obscure the identity of a user behind a network router or firewall to prevent unauthorized access to data or services. Masking can also be used to hide a device or user's IP address from other networks.
    • tanja
      What is a submet mask?
      4 months ago
    • A subnet mask is a 32-bit number that is used to divide an IP address into network and host portions. It is used in conjunction with an IP address to determine which part of the address represents the network and which part represents the host. The subnet mask contains a series of 1s followed by a series of 0s, with the 1s indicating the network portion and the 0s indicating the host portion.
      • cooper hughes
        What is the purpose of subnetting?
        10 months ago
      • The purpose of subnetting is to divide a network into smaller, more efficient subnetworks or subnets. By breaking down a large network into smaller sections, it is easier to manage and can reduce the risk of network outages due to issues such as broadcast storms or malware. Subnetting also allows for improved security and allows administrators to set different security policies per subnet. It also allows for better bandwidth management and can help limit the size of individual broadcast domains.
        • matthew
          What is the prefix length notation for the subnet mask 255.255.255.224?
          10 months ago
        • Matilda
          What is the purpose of subnet masking?
          10 months ago
        • Subnet masking is used to divide a network into multiple subnets, or smaller networks. It is used to control the traffic between different networks and to create effective network routing. Subnet masks also allow network devices such as routers to identify the network and subnet of an IP address.
          • elias
            What is another term for the subnet mask?
            10 months ago
          • Network Mask
            • frank
              How to find subnet prefix length ipv4?
              10 months ago
            • To find the subnet prefix length for an IPv4 address, you need to look at the IP address to determine the number of bits that are used for the subnet mask. The subnet mask is expressed as a series of numbers such as 255.255.255.0. Each number represents a set of eight bits, and each set of eight bits is referred to as an octet. The number of bits that are ‘on’ in the subnet mask (represented as ones) is the prefix length. For example, if the subnet mask of an IPv4 address is 255.255.255.0, the prefix length is 24, since the first three octets are all 255, which is 8 bits per octet, and 8+8+8 is 24.