2013年4月29日 星期一

複習IP網段

Binary Number System
2^0 = 1
2^1 = 2
2^2 = 2 x 2 = 4
2^3 = 2 x 2 x 2 = 8
2^4 = 2 x 2 x 2 x 2 = 16
2^5 = 32
2^6 = 64
2^7 = 128
2^8 = 256
Binary system number is based on power of two (2^n).

1 x 2 = 2 | half the size
2 x 2 = 4 | A
4 x 2 = 8 | |
8 x 2 = 16 | |
16 x 2 = 32 | |
32 x 2 = 64 | |
64 x 2 = 128 V |
128 x 2 = 256 double the size |

In terms of subnetting,
1   = /32 = 255.255.255.255
2   = /31 = 255.255.255.254
4   = /30 = 255.255.255.252
8   = /29 = 255.255.255.248
16  = /28 = 255.255.255.240
32  = /27 = 255.255.255.224
64  = /26 = 255.255.255.192
128 = /25 = 255.255.255.128
256 = /24 = 255.255.255.0

In terms of IP address quantity
/32: 2^0 = 1                        =   1 IP address within the subnet
/31: 2^1 = 2 of /32 = 2 x   1 =   2 =   2 IP addresses within the subnet
/30: 2^2 = 2 of /31 = 2 x   2 =   4 =   4 IP addresses within the subnet
/29: 2^3 = 2 of /30 = 2 x   4 =   8 =   8 IP addresses within the subnet
/28: 2^4 = 2 of /29 = 2 x   8 =  16 =  16 IP addresses within the subnet 
/27: 2^5 = 2 of /28 = 2 x  16 =  32 =  32 IP addresses within the subnet
/26: 2^6 = 2 of /27 = 2 x  32 =  64 =  64 IP addresses within the subnet
/25: 2^7 = 2 of /26 = 2 x  64 = 128 = 128 IP addresses within the subnet
/24: 2^8 = 2 of /25 = 2 x 128 = 256 = 256 IP addresses within the subnet
Side Note:

Some people refer the xxx.xxx.xxx.xxx notation as octet (8-based number system). There are four octets in the notation. To separate the octets, there are dots between them. I call them 4-tuple octet.

For /24 to /32 subnets, the 1st three octets remain the same. The only octet that changes is the 4th octet (the last octet).

Subnet Mask

Subnetting always relates to something called Subnet Mask. Subnet Mask is the way an IP address represent which subnet it is under.

To show you how a subnet mask looks like, let's review the previous table.
1   = /32 = 255.255.255.255
2   = /31 = 255.255.255.254
4   = /30 = 255.255.255.252
8   = /29 = 255.255.255.248
16  = /28 = 255.255.255.240
32  = /27 = 255.255.255.224
64  = /26 = 255.255.255.192
128 = /25 = 255.255.255.128
256 = /24 = 255.255.255.0

As mentioned, there are octets separated by dots that I called 4-tuple octet. This 4-tuple octet is commonly known as Subnet Mask.

Another format of displaying subnet mask is by using CIDR (Classless Inter-Domain Routing) format. Where the 4-tuple octet format is shown on the above table rightmost column, the CIDR format is shown on the above table leftmost column. To clarify, check out following table.
IP Address Quantity    CIDR format subnet mask      4-tuple octet format subnet mask
    Within Subnet             (Prefix)   
         1                      /32                         255.255.255.255
         2                      /31                         255.255.255.254
         4                      /30                         255.255.255.252
         8                      /29                         255.255.255.248
        16                      /28                         255.255.255.240
        32                      /27                         255.255.255.224
        64                      /26                         255.255.255.192
       128                      /25                         255.255.255.128
       256                      /24                         255.255.255.0
資料來源:可參考(http://www.dslreports.com/faq/8426)

沒有留言:

張貼留言