mrkeck Sharing the Love

30Apr/110

IPv4 CIDR Shortcut Formulas

Hosts: 2^(32-CIDR)

IPv4 CIDR to Mask:
IPv4 CIDR (24-32): 255.255.255.256-2^(32-CIDR)
IPv4 CIDR (16-23): 255.255.256-2^(24-CIDR).0
IPv4 CIDR (08-15): 255.256-2^(16-CIDR).0.0
IPv4 CIDR (00-07): 256-2^(8-CIDR).0.0.0

Ex1:
a.b.c.d/24=255.255.255.(256-2(32-CIDR))
256-2^(32-24)=256-2^(8)=256-256=0
Thus, the mask is 255.255.255.0

Ex2:
a.b.c.0/18=255.255.(256-2^(24-CIDR)).0
256-2^(24-18)=256-2^(6)=256-64=192
Thus, the mask is 255.255.192.0

Ex3:
a.b.0.0/12=255.(256-2(16-CIDR)).0.0
256-2^(16-12)=256-2^(4)=256-16=240
Thus, the mask is 255.240.0.0

Ex4:
a.0.0.0/2=(256-2^(8-CIDR)).0.0.0
256-2^(8-2)=256-2^(6)=256-64=192
Thus, the mask is 192.0.0.0

 

Filed under: Networking No Comments