The slash after an IP Address - CIDR Notation

152

79

What does the "/16" means in here : "192.168.0.0/16", for example.

4m1nh4j1

Posted 2013-10-23T15:57:09.410

Reputation: 875

You might find this cheat sheet useful: https://www.aelius.com/njh/subnet_sheet.html Also this subnet calculator: https://www.calculator.net/ip-subnet-calculator.html

– CellPointNetworks – 2018-09-24T08:15:09.353

Answers

169

A simple explanation:

The /<number> is how a computer can quickly calculate what is part of its network and what is not. It represents the bit length of the subnet mask, as indicated above. The subnet mask is like masking when painting. You place a mask over what you DO NOT want to paint on. The subnet mask is a way to calculate the network portion of the address space and the host address space. The network address space is assigned to you, the host address space you define which device receives what address in the host space.

A computer performs binary math of ANDing the IP address and the network mask.

IP Address 10.10.15.10/16

Step 1) Translate the IP address 4 octets into binary: 00001010.00001010.00001111.00001010

Step 2) Translate the Subnet mask 4 octets into binary, which is easy using CIDR: 11111111.11111111.00000000.00000000

Step 3) Perform the ANDing operation on the two addresses. This will give you the Network Address for the subnet.

ANDing rules are as follows:

  • 1 AND 1 = 1
  • 0 AND 1 = 0
  • 0 AND 0 = 0
  • 1 AND 0 = 0
         00001010.00001010.00001111.00001010
     AND 11111111.11111111.00000000.00000000
         ———————————————————————————————————
         00001010.00001010.00000000.00000000

Step 4) Convert it back to decimal: 10.10.0.0

So now a computer knows that any address from 10.10.0.0 to 10.10.255.255 is part of its network and any other address is not.

It's like a binary network gang thing, you are in or you are not.

user3159

Posted 2013-10-23T15:57:09.410

Reputation: 1 726

5I love the visualization of painting masking tape – El Guapo – 2017-02-14T15:33:19.713

What does being "part of its network" mean? What is accomplished when you take a segment of IPs and call them the inside and the rest the outside? – Cory Klein – 2017-10-16T21:05:46.127

138

The slash and the number following it is just a shorthand way to write a subnet mask. It's called CIDR (Classless Inter-Domain Routing) notation. It's also commonly referred to as the prefix length.

The number after the slash represents the number of consecutive 1's in the subnet mask. For example, 192.168.10.0/24 is equal to the network 192.168.10.0 with a 255.255.255.0 subnet mask. If you convert 255.255.255.0 to binary, you end up with 24 consecutive 1's:

11111111.11111111.11111111.00000000

Another example could be 10.0.0.0/8. 8 consecutive 1's in the subnet mask gives you 11111111.00000000.00000000.00000000 or 255.0.0.0.

For more information, see RFC 4632, Section 3.1.

John Jensen

Posted 2013-10-23T15:57:09.410

Reputation: 7 584

4The best answer. Thanks for sharing. – Soundararajan – 2016-09-28T11:56:21.373

24

The slash following the IP address is the abbreviation for the subnet mask.

The binary version of a subnet mask is going to be comprised of ones and zeros just as the binary verison of an IP address would be, however, the ones in a subnet mask are all consecutive. The amount of ones in the subnet mask is equal to the number of the abbreviation.

For example, the /16 subnet mask you asked about would have 16 ones in a row, the rest of the numbers being zeros. 11111111.11111111.00000000.00000000. When converted from the base 2 number system of binary into the base 10 number system of the decimal version of the IP address, it therefore equals 255.255.0.0.

A /9 subnet mask would be 11111111.10000000.00000000.00000000, or 255.128.0.0.

A /30 subnet mask would be 11111111.11111111.11111111.11111100, or 255.255.255.252 which is great for creating a network that only accounts for 2 routers or layer 3 switches because there are only 4 total IP addresses and only 2 of those are usable host IP addresses.

A lot can be done with subnetting, but subnetting is a whole new monster to tackle if you are just getting started.

MooseBalm

Posted 2013-10-23T15:57:09.410

Reputation: 557

4

Please be aware that this page still talks about Classful addresses, which have been replaced by Classless Inter-Domain Routing (RFC1519/RFC4632) in 1993.

– Sander Steffann – 2013-10-23T18:54:10.990

Mistake on my part. I grabbed the first diagram I could find that spelled out exactly what each of them meant in the simplest fashion. – MooseBalm – 2013-10-23T19:07:17.740

3

@4m1nh4j1 It's a bit short on pretty pictures, but check out the subnetting explanation over on Server Fault. The /x style is discussed about halfway down, under "More Terminology"

– voretaq7 – 2013-10-23T19:15:56.630

4

one another simple explanation can be, how many address you can have in one range.

ex: you have an ip a.b.c.d/x. So a,b,c,d individually can have values 0-255 so which gives us 2^3(max length is 3) = 8. so one part of ip can have 8 bits.

So now if we write ip like 10.10.0.0/x so now x/8 = total number fixed blocks we have.

ex: if we have /16 so 16/8 = 2 this means we have 2 blocks free so now ip would be 10.10.0.0 so here first two blocks are fixed and we can have 0-255 in each last two blocks so 256*256 = 65536(address we can have) and in netmask would be 255.255.0.0

now lets say we had /18 which is not completely divisible by 8, so 18/8 = 2(fixed blocks) and 2 is left so now divide 256 twice which is 256/2 = 128, 128/2 = 64 so we got 64 now 256-64 = 192. so now our netmask would be 255.255.192.0 which means we can have 64*256 address.

further, if it was /24 this means 24/8 = 3 three blocks are fixed and one is variable. netmask is 255.255.255.0 and if we had /8 this means 8/8 = 1 one block is fixed. so 255.0.0.0

Umesh Kaushik

Posted 2013-10-23T15:57:09.410

Reputation: 149

3

192.168.0.0 is private IP address starting range address (192.168.0.0 up to 192.168.255.255 Small network). It means you have used sixteen bits for network address out of thirty two bits and bits are remaining for host addressing. for these remaining sixteen bits can be used for sub netting based on your network design and other sub netting steps illustrate in above posts.

Jatinder Brar

Posted 2013-10-23T15:57:09.410

Reputation: 137

So if i understood correctly it goes like this:

192.168.0.0/24 means hosts with IP addresses within the range of 192.168.0.1 and 192.168.0.254; another example would be: 192.168.0.0/16 means hosts with IP addresses within the range of 192.168.0.1 and 192.168.254.254 – Fernando Gabrieli – 2018-07-01T01:49:35.567

Right. You understood the point. – Jatinder Brar – 2018-07-01T02:51:27.790

2

It represents the subnet (subnetwork) mask.

1) Re-write the IP address as computers read it.

192.168.0.0 converts to binary/base2/'bits' as 11000000.10101000.00000000.00000000

2) The number of bits (from left to right) that represent the subnet address is specified as 16 ('/16').

16 bits, or 11000000.10101000 (192.168) is the network address and 0.0, or 00000000.00000000, is the host address - in this case a broadcast address.

It's referred to a mask because you are telling the computer to ignore that number of bits when calculating the host address, or perhaps that the network wears those number of bits as it's identifier, or mask.

Ron Royston

Posted 2013-10-23T15:57:09.410

Reputation: 3 237