0

I'm new to networking and have a question about subnet masks. Imagine we have a class B IP address. I know how to calculate the subnet mask. My question is: What is the last subnet mask that we can use for this IP. In case of subnetting, can we use 255.255.255.255 for this IP as the subnet mask or the last subnet mask that we can use is 255.255.255.252?

I mean can we use all 32 bits in the creation of the subnet mask or we can only use 30 bits?

4

Most Network vendors work quite well with /31 Prefixes as smallest possible Non-Host-only network - a.k.a. Point-to-Point link.

As in /30 it is possible to interconnect two Routers with a /31 network, but am consuming only 50% of my IP address space.

This /31 is specified in RFC3021 https://tools.ietf.org/rfc/rfc3021.txt

I use /31 for IPv4 on Cisco, Juniper and Nokia Boxes as well as /127 Prefixes in my IPv6 Topology. The only boxes i had problems with /31 were Forigate firewalls.

| improve this answer | |
4

First of all, network classes are obsolete. In fact, they have been so since before you were born. Let them die in peace.

You can use any subnet mask from /1 to /32 for an IP. It depends on the size of the subnet the IP is on.

| improve this answer | |
1

On /32

/32 (255.255.255.255) does not have room for any bits for the subnet portion of the IP address, so it can be considered a special or even degenerate subnet consisting of only 1 IP address, namely the IP address like 128.42.5.4, and no network address, no broadcast address. But it can be useful to refer to a solitary IP address.

On /30

In normal subnets (but see an exception below), there would be a network address (subnet portion of the IP address consisting of all zeros) and a broadcast address (subnet portion of the IP address consisting of all ones). So if there are n bits in the subnet portion of the IP address, then there are 2^n-2 possible regular IP addresses that can be allocated in this subnet (minus 2 for the network and broadcast addresses).

So /30 (255.255.255.252) is the smallest subnet in this sense, that it has 2 regular IP addresses that can be used besides the network and broadcast addresses (but see the description of /31 below).

In your example, if it is /30, we would have:

  • network address: 128.42.5.4 (00 in last two bits)
  • broadcast address: 128.42.5.7 (11 in last two bits)
  • 2 regular IP addresses 128.42.5.5 and 128.42.5.6

There's also /31

You may wonder, for small subnets, do we really need to waste two IP addresses for broadcast and network? Especially for point-to-point subnets with just one interface on each end, RFC 3021 allows /31 (255.255.255.254) that consists of only two IP addresses, no network address and no broadcast address.

In your example, if it is /31, we would have:

  • 1st regular IP address: 128.42.5.4 (0 in last bit)
  • 2nd regular IP address: 128.42.5.5 (1 in last bit)

Would there be any problems with routers interpreting these as network address or broadcast address? Not if they follow RFC3021 (which most routers do), and make exceptions for /31 networks.

Hence, it is popular for a point-to-point link which can use an IP address at each end. It saves 2 IP addresses for each time /31 is used rather than /30.

| improve this answer | |
  • 3
    "So /30 (255.255.255.252) is the smallest normal subnet, with 2 regular IP addresses that can be used besides the network and broadcast addresses." That simply is not true. Other than Microsoft, most vendors have adopted the 20-year old RFC 3021, Using 31-Bit Prefixes on IPv4 Point-to-Point Links. Compared to /31 networks, /30 networks waste half the addresses. Broadcast is redundant when all traffic is destined to all the other devices (the only other device) on the ink anyway, so /31 works well on point-to-point networks. – Ron Maupin Jun 29 at 18:43
  • @RonMaupin Thanks very much for your kind comment; I had a long day and had a mental block. Have corrected and updated my answer. – auspicious99 Jun 30 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.