0

I am beginner in networking and trying to understand subnetting. What I understood is that

CIDR notation (Classless Inter-Domain Routing) is an alternate method of representing a subnet mask. It is simply a count of the number of network bits (bits that are set to 1) in the subnet mask.

Meaning that a CIDR in this form 10.0.0.0/30 means that

  1. The networkID is 10.0.0.0 and the subnet mask 255.255.255.253
  2. The subnet has two host addresses (10.0.0.1 and 10.0.0.2 ) and one broadcast address 10.0.0.3
  3. Does the CIDR mean anything else than the two points mentioned above ? and What is the default gateway address in this case ?

The following notations confuses me. Sometimes I see

  1. 10.0.0.2/30, 10.0.0.3/30 (for instance, IP 10.0.0.3 exits in the two networks )
  2. or 10.0.0.0/30 and 10.0.0.0/8
  3. Wouldn't there be an intersection between networks in this case, in other words, meaning same IP addresses exit in two different networks?
Greg Askew
  • 35,880
  • 5
  • 54
  • 82
NNN
  • 1
  • 1
    This [question and answer](https://networkengineering.stackexchange.com/questions/7106/how-do-you-calculate-the-prefix-network-subnet-and-host-numbers) from our sister site Network Engineering SE may help you. – Ron Trunk Sep 24 '20 at 12:50
  • One small comment on item #1: the mask should be 255.255.255.252 – Ron Trunk Sep 24 '20 at 12:56

2 Answers2

3

For your first question:

Well CIDR is just another notation for the Subnet Mask. So i think your question is more about the subnet mask. The Subnet mask exists, to let you determine the network prefix and the host identifier out of an ip address.
That's the only thing the subnet mask is really here fore. Of course you can then conclude more out of this information, which includes:

  • Boradcast Address
  • Network range
  • Choose Gateway address
  • Check if two peers are in the same network
  • Routing configuration

About your question regarding the gateway: Usually in inside networks the gateway address, is the first address of a network (10.0.0.1), however i have also seen networks, where the last address of the network is the gateway address (10.0.0.2). But the most corporations choose the first network address for the gateway ip address. But technically, you could use any ip adress in the network for your gateway address. It's just a convention and not a technically necessity.

For your second question: You are absolutely right, these two ip addresses can not communicate with each other. Every ip address is unique in his network. To see if two ip addresses are in the same network and can communicate with each other, you just need to calculate the network prefix and see if it matches. So there you found already another purpose of the subnet mask: You can check if two ip addresses are on the same network.

Lorem ipsum
  • 892
  • 5
  • 15
1

Many questions in one and not so easy to refer to different sections as there are multiple numbered lists...

CIDR notation (Classless Inter-Domain Routing) is an alternate method of representing a subnet mask. It is simply a count of the number of network bits (bits that are set to 1) in the subnet mask.

Indeed, this is the information it contains.

Meaning that a CIDR in this form 10.0.0.0/30 means that

  1. The networkID is 10.0.0.0 and the subnet mask 255.255.255.253

Actually 10.0.0.0 and netmask 255.255.255.252, but I get the impression that you probably have the right idea regarding this part even if the numbers were wrong here.

And regarding the question, yes, this is all that it means.

(It's not necessarily used with a network id specifically, it can be any address depending on the context. Just like you can specify eg a host address with netmask, depending on the context.)

  1. The subnet has tow host addresses (10.0.0.1 and 10.0.0.2 ) and one broadcast address 10.0.0.3

I suppose, yes. The information it directly conveys (see 1), has the same implications regardless if it's written as 10.0.0.0/30 or network: 10.0.0.0, netmask: 255.255.255.252.

  1. Does the CIDR mean anything else than the two points mentioned above ? and What is the default gateway address in this case ?

No, it doesn't mean anything else.

Just like your netmask version of the same information, it doesn't say anything about what address might be the default gateway (if such a thing is even relevant).

The following notations confuses me. Sometimes I see

  1. 10.0.0.2/30, 10.0.0.3/30 (for instance, IP 10.0.0.3 exits in the two networks )
  2. or 10.0.0.0/30 and 10.0.0.0/8
  3. Wouldn't there be an intersection between networks in this case, in other words, meaning same IP addresses exit in two different networks?

There are several aspects to consider here:

  • You can trivially rephrase this second block of questions using "netmask notation" if you like (as per 1 in the previous set of questions). I don't know if that might change anything regarding your understanding of the scenarios that you are describing?
    Either way, as I see it, there is nothing specific to CIDR notation going on here.

  • When you say 10.0.0.2/30, 10.0.0.3/30 these might well refer to addresses in the exact same network if that fits the context.

  • Your example uses RFC1918 addresses, which is fine if that is what is part of the scenario that you ask about. But these private addresses are duplicated in many networks across the world, meaning there's nothing strange about these private addresses being used in different/conflicting ways in separated networks.

  • You wouldn't generally want the same IP address being used on two different network links in the same network (the RFC1918 situation is a factor here, with reuse in separated networks as per the above), but do keep in mind that the notation is also used in other contexts than just on-link addresses.
    Example: Maybe on router1 you route 10.0.0.0/16 to router2, and router2 then might have 10.0.0.0/24 on one network link and 10.0.1.0/24 on another.
    Addresses in both these /24 networks match the 10.0.0.0/16 route, but there is no conflict there; eg 10.0.0.7 exists in exactly one place and 1.0.1.7 exists in exactly one (other) place.

Håkan Lindqvist
  • 35,011
  • 5
  • 69
  • 94