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

Was this article helpful?

0 0

Post a comment