Differences
This shows you the differences between two versions of the page.
— | cidr [2016/05/09 22:36] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== CIDR ====== | ||
+ | * [[Networking]] | ||
+ | |||
+ | You use CIDR notation to get the # of IP addresses that are available in that block. It does not, however, specify where the range has to begin or end -- the only requirement is that they be sequential. | ||
+ | |||
+ | Say, for example, that you wanted to assign 8 IP addresses for friends when coming to visit for a LAN party. You also want them to start at the 192.168.1.16 IP address. That means they'd get .16 through .23 as their own. Here's what the CIDR would look like: | ||
+ | |||
+ | < | ||
+ | 192.168.1.16/ | ||
+ | </ | ||
+ | |||
+ | The mathematical formula for determining the size of the **range** of IP addresses is: | ||
+ | |||
+ | < | ||
+ | 2 ^ (32 - /$x) | ||
+ | </ | ||
+ | |||
+ | where $x represents the /29 above. | ||
+ | |||
+ | Using that case, 32-29 is 3, so 2 to the power of 3 (or, 2x2x2) is 8. | ||
+ | |||
+ | See [[https:// | ||
+ | |||
+ | You can move the starting around point all you want, but they are still going to be assigned the same number of IP addresses. | ||
+ | |||
+ | So, if you wanted them to have 75 through 82, here's the notation: | ||
+ | |||
+ | < | ||
+ | 192.168.1.75/ | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | |||
+ | So here's the IP addresses they'd have: | ||
+ | |||
+ | < | ||
+ | 192.168.1.75 | ||
+ | 192.168.1.76 | ||
+ | 192.168.1.77 | ||
+ | 192.168.1.78 | ||
+ | 192.168.1.79 | ||
+ | 192.168.1.80 | ||
+ | 192.168.1.81 | ||
+ | 192.168.1.82 | ||
+ | </ | ||
+ | |||
+ | Now, let's look at expanding past the '' | ||
+ | |||
+ | So if you wrote '' | ||
+ | |||
+ | < | ||
+ | 192.168.1.1 | ||
+ | 192.168.1.2 | ||
+ | ... | ||
+ | ... | ||
+ | 192.168.2.254 | ||
+ | 192.168.2.255 | ||
+ | </ | ||
+ | |||
+ | Now, remember that everything is increased by the power of 2, so your options are always going to be doubled: | ||
+ | |||
+ | < | ||
+ | 2^0 = 1 | ||
+ | 2^2 = 2 | ||
+ | 2^3 = 8 | ||
+ | 2^4 = 16 | ||
+ | 2^5 = 32 | ||
+ | 2^6 = 64 | ||
+ | 2^7 = 128 | ||
+ | 2^8 = 256 | ||
+ | 2^9 = 512 | ||
+ | 2^10 = 1024 | ||
+ | 2^11 = 2048 | ||
+ | 2^12 = 4096 | ||
+ | 2^13 = 8192 | ||
+ | 2^14 = 16384 | ||
+ | 2^15 = 32768 | ||
+ | 2^16 = 65536 | ||
+ | </ | ||
+ | |||
+ | With that in mind, you can easily know that whatever # of IP addresses available you have in your range, the next amount number available is going to be double what you currently have. | ||
+ | |||
+ | That is, if you have '' | ||
+ | |||
+ | The opposite is also true, going from '' | ||
+ | |||
+ | The reason this can get confusing, trying to keep track of which numbers are higher or lower, remember that the higher the number on the CIDR, the lower the amount of possible IPs. Instinct may tell you that ''/ | ||
+ | |||
+ | < | ||
+ | 192.168.1.0/ | ||
+ | 192.168.1.0/ | ||
+ | </ | ||
+ | |||
+ | The power of '' |