10

I'm reading a book that says that, historically, there have been three ways to interpret IP addresses:

  • Classful
  • Subnetting with subnet masks
  • Classless Inter-Domain Routing(CIDR), supernetting.

My question is: If CIDR is in use, why I never see IPs using CIDR slash notation? I can send UDP datagrams just using a plain IP and a port. Or am I making assumptions about the IP I use?

What Else
  • 101
  • 1
  • 3

7 Answers7

19

I can send UDP datagrams just using a plain IP and a port.

Subnet masks are only used by the sending host to determine if the destination is on the same network. They are meaningless everywhere else.

Ron Trunk
  • 68,291
  • 5
  • 66
  • 126
14

Yes, classful networking is long obsolete (since 1993).

CIDR is likely the predominant notation in professional networking (e.g. 10.0.0.0/8).

Explicit network masks (e.g. 10.0.0.0/255.0.0.0) are a bit bulky, so they've grown less popular. They are able to describe non-contiguous address ranges as per RFC 950 (e.g. 10.0.0.0/255.255.127.0 for 10.0.0.0/24 plus 10.0.128.0/24) but those are too obscure, largely unsupported to actually be used, and deprecated by RFC 1519/4632.

why I never see IPs using CIDR slash notation?

That depends on the situation. The prefix length is required when configuring a host in a subnet, and for routing table entries.

I can send UDP datagrams just using a plain IP and a port. Or am I making assumptions about the IP I use?

From the perspective of the application or user, the subnet mask is irrelevant. It is only relevant when the IP stack is looking up the required gateway by checking routing table entries, and for determining whether the destination is part of the local subnet (which is just a special result of checking the routing table). In any case, the destination's actual subnet mask is never known. It's the current hop's subnet mask or the prefix length in the routing table that matters.

Zac67
  • 90,111
  • 4
  • 75
  • 141
7

CIDR is in use. Classless routing is a ubiquitous fact of internet operation, regardless of how it may be expressed on a screen. CIDR notation for a block of IP addresses is the normal way to refer to them. It's used in written or spoken communications between technical people ("Please add the customer's slash-twenty-two to their BGP filter."). The vast majority of people, however, have no practical reason to use it or know what it means, and they do not.

Many examples exist, if you know where to look for them. A lot of internet server software uses CIDR notation in their documentation and in configuration files. Nearly anywhere that you can configure an access list (block IPs), or talk about routed networks, there will be an option to name them using CIDR notation.

For a few examples:

In the documentation for iptables, CIDR notation is in use without being specifically described as such:

       [!] -s, --source address[/mask][,...]
              Source specification. Address can be either a network name, a hostname, a network IP address (with /mask),

Postfix mail server has various features defined around specification of particular networks. An admin could distinguish between local and remote requests, enter a CIDR formatted network addresses in its "mynetworks" configuration directive in main.cf, something like mynetworks = 192.168.1.128/25

For another example active use of CIDR notation, here's a page from American Registry for Internet Numbers, with a fee schedule for IP allocations:

https://www.arin.net/resources/fees/fee_schedule/

So, why then, do so many more commonly used IP configuration interfaces, like Windows' "Local Area Connection" "Properties...") use a subnet mask? I think it's just an accident of history that Windows and Macs had their first network support added at a time when subnet mask format seemed more appropriate. Then there just wasn't enough reason to change it. In Windows 10, there is another display of the same configuration that's labeled "Edit IP Settings" and it has a field labeled "Network Prefix Length" of 24 when the subnet mask is 255.255.255.0. It's just two ways to describe a 32 bit integer comprised of 24 1's followed by 8 0's.

Regarding classful routing, there's no way for an internet router today to use that (maybe in a lab or a museum), but some vestigial relics of classful routing can still be seen. When IP ranges were designated for private use, they were made to be somewhat compatible with classful allocations. 10.0.0.0/8 could have been a valid class A network. 172.16.0.0/12 is a CIDR notation for 16 consecutive class B's, and similarly, addresses in 192.168.0.0/16 would be interpreted as being in one of 256 consecutive class C's, there.

jejese
  • 71
  • 1
3

If you never see IP addresses with slash notation, it is probably because you are an end user rather than a network manager.

You do not need to worry about slash notation to access a remote host, just the IP (or a DNS entry pointing to it). You do need to worry about it when configuring a router manually i.e. most things bigger than a home router. 99% of hosts don't use static addressing, so they don't worry about it either.

Sometimes people with out of the ordinary requirements like to configure addresses statically. I sometimes issue an address like 198.51.100.10/24 (less typing, although possibly imprecise). I never learn because they inevitably ask me what the subnet mask is, and I sigh and explain it to them.

richardb
  • 1,628
  • 9
  • 10
1

I think it would help to look at it like this:

  • A single IP address identifies a specific destination
  • A subnet mask or CIDR number identifies a potential range of IP addresses
  • When you combine an IP address and subnet mask or CIDR number, you get a specific range of IP addresses

You do not need to specify the subnet mask or CIDR number when sending a packet because you are sending it to a specific destination not a range of many destinations.

Various devices along the way will have routing tables whose entries contain IP address plus subnet mask or CIDR number combinations. These values are used to determine where your packet goes next. You don't need to tell them how to do this, because it's part of their configuration. Network administrators set these values up, and they're particular to specific network environments.

There are many ways in which what I just said is oversimplified to the point of incorrectness, but those complications should be studied after this basic understanding. Some examples where things get more complicated: broadcast and multicast addresses, router discovery and advertisement, network address translation (NAT).

kbolino
  • 111
  • 1
1

Yes CIDR notation is in use, but I don't think it makes sense to describe CIDR notation as an "IP format".

CIDR notation consists of an IP address, followed by a slash and then a number indicating the number of bits set in the mask.

CIDR notation is used in two ways.

The first is to identify a block of IP addresses. This block may represent a network or subnet, but it doesn't necessarily have to. In this format the address part of the notation is always the first address in the block (for a traditional IPv4 subnet the first address is reserved as the "network" address, but this doesn't apply to IP blocks in general).

The second is used when assigning an IP address to an interface (or viewing the addresses assigned to an interface) to specify both the IP address and the subnet mask in a more compact form.

It's important to realize though that the network or subnet mask, whether written in the oldschool way or written in CIDR notation, is not part of the address itself and is not something that applications normally care about.

End user network configuration tools still seem to use the traditional IP address/subnet mask format.

So generally you will only encounter CIDR notation if you are configuring things like routing and firewalls.

Peter Green
  • 13,882
  • 2
  • 23
  • 54
0

Network classes are becoming inefficient in ensuring reliable and efficient networks. This is why subnetting, supernetting, and CIDR were invented. The small problem with CIDR is that it can be a bit more complex for network administrators to work with.

Through classful addressing, you can easily find the subnet by examining the IP address.

With CIDR, you would have to explicitly define the network masks. So you need to keep an eye on more things at once if you want the network to work properly.

Zac67
  • 90,111
  • 4
  • 75
  • 141