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
    Network address classes are dead (please let them rest in peace), killed in 1993, two years before the commercial Internet in 1995) by RFCs 1517, 1518, and 1519, which defined CIDR (Classless Inter-Domain Routing). We have not had classful networking in this century. Your book is out of date. – Ron Maupin Feb 25 '22 at 14:45
  • 7
    @WhatElse "If CIDR is in use, why I never see IPs using CIDR slash notation?" perhaps because you are still in the book-reading phase of learning about networking?

    If you delve more into the practical side, you will start to see CIDR. For example: sign up for a cloud provider, create some virtual machines, and then create security rules to define what traffic is allowed in/out of these virtual machines. Most clouds accept CIDR as part of these rule definitions.

    – Tyler Church Feb 25 '22 at 21:34
  • 8
    Because you're talking about hosts not networks. You don't need to know anything about netmask/prefix-length to talk to a specific host. – Ricky Feb 26 '22 at 02:23
  • 1
    @RonMaupin It seems to me that your comment may be unfair on the authors. "Historically there was classful addressing" (my gloss) is a perfectly valid statement. It's only out of date if it presents it as something still relevant, rather than saying "now forget about it, nobody cares about classful addressing any more". – richardb Feb 26 '22 at 15:14
  • @richardb,, my comment above says nothing like network classes are still relevant. In fact, it begins with, "Network address classes are dead" and it ends with, "We have not had classful networking in this century." Where do I imply that network classes are still relevant? – Ron Maupin Feb 26 '22 at 16:55
  • @RonMaupin You absolutely do not. What I am saying is that, without seeing it in context, it's not clear that the book's authors implied it either. Especially given that they used the word "historically". – richardb Feb 26 '22 at 17:49
  • @richardb, what a modern book should communicate is that we use CIDR and VLSM today, then explain how to subnet and aggregate (supernetting is really not a proper term for aggregation). Perhaps in a later, separate note, it can explain historic address classes, saying this bears no relevance to modern networking and is only presented for a historic perspective, but learning how to do modern subnetting and aggregation is a prerequisite before learning about address classes to avoid confusion. Including it with the other ways before a full understanding leads people to give weight to the octets. – Ron Maupin Feb 26 '22 at 18:13
  • @richardb, I only say that because of the deprogramming I must do with people coming out of network education courses and those who learn from books. It seems all of them start with network address classes, and it skews the thinking when they try to learn to subnet and aggregate in the real world. I think the courses and books should ignore network address classes until after people learn proper subnetting and aggregation, not present it before or with subnetting. – Ron Maupin Feb 26 '22 at 18:18
  • @RonMaupin I understand your POV. Personally, I only find it really objectionable that certifications (still?) expect you to know these things. No doubt, you have had to flog this particular dead horse far more often than me though. – richardb Feb 26 '22 at 18:25
  • @richardb, that is why I start this two-part answer the way I do, and the mention of address classes is left to the very last section of the second part, and it explains what network address classes actually were, not the common usage you hear today. – Ron Maupin Feb 26 '22 at 18:29
  • Did any answer help you? If so, you should accept the answer so that the question does not keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer. – Ron Maupin Dec 19 '22 at 19:10

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
  • 67,450
  • 5
  • 65
  • 126
  • So the mask is implicit in the IP? An example, I want to send a UDP datagram to a named host, I look up the IP via DNS, is the IP given to me the address of the host with the mask already applied? I say this because as a sender I never use that appended number that determines the number of bits that represent the network and differentiates them from the bits that represent the host within the network. – What Else Feb 25 '22 at 14:52
  • 7
    is the IP given to me the address of the host with the mask already applied? No, there is no "implicit" mask. The sender uses the mask of its interface to determine if the destination is on the same subnet or not. – Ron Trunk Feb 25 '22 at 15:21
  • 1
    @WhatElse, when the IP of the host is given to you, your computer then uses the subnet mask of its network adapter to answer the question "is the IP address in my subnet?". If the answer is "yes", your computer sends the packet directly to the destination; if it's "no", your computer sends the packet to the router to be relayed to the destination. The subnet mask of the destination never comes into play. – Mark Feb 26 '22 at 00:44
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
  • 84,333
  • 4
  • 69
  • 133
  • Are non-contiguous netmasks actually supported by any specification? (Let's say any non-ancient one.) I always the impression that they weren't, that they were something that basically only comes up if you read the behaviour with an intent for trolling... – ilkkachu Feb 27 '22 at 21:02
  • 1
    @ilkkachu Well, I've used them decades ago (for routing masks, not for actual subnets) but haven't attempted to for a very long time. Support on current system is very low to non-existent. I did use the same concept for switch ACLs pretty recently though. – Zac67 Feb 27 '22 at 21:19
  • 1
    @ilkkachu I've added references for non-contiguous netmasks and their eventual obsolence to my answer (didn't want to hide them in a comment). – Zac67 Feb 28 '22 at 10:05
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,598
  • 8
  • 10
  • I just wrote the whole thing off (CIDR) as shorthand for the subnet mask anyway, each octet is up to 8 bits, not too hard to figure out that /24 is 3 of those, even when saying it it's easier to say /16 than it is to say "two five five dot two five five"! Anyway I'm not sure it's always right to view it as shorthand, but in my mind I can just substitute a subnet mask with a / value, and left the definition at that, in the fantasy that is my reality! – Dan Chase Feb 26 '22 at 18:12
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,303
  • 2
  • 21
  • 47
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
  • 84,333
  • 4
  • 69
  • 133