[Python-Dev] Issues with Py3.1's new ipaddr
Nick Coghlan
ncoghlan at gmail.com
Wed Jun 3 14:49:18 CEST 2009
Paul Moore wrote:
> Note 1 - by the way, I use this form because I don't understand how
> the /24 notation works. I can get the subnet mask from ipconfig, so I
> use that.
<OT>
It's just a shorthand way of writing IPv4 net masks based on their
binary form:
/8 = 8 ones followed by 24 zeroes = 255.0.0.0
/16 = 16 ones followed by 16 zeroes = 255.255.0.0
/24 = 24 ones followed by 8 zeroes = 255.255.255.0
/30 = 30 ones followed by 2 zeroes = 255.255.255.252
/32 = 32 ones followed by no zeroes = 255.255.255.255
It's particularly convenient when you're dividing subnets up into chunks
that don't align with a byte boundary in the IPv4 address (e.g. /27 can
easily be recognised as giving a subnet containing 2**5 = 32 hosts, but
the subnet size is significantly less obvious when written using the
equivalent 255.255.255.224 netmask).
</OT>
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
More information about the Python-Dev
mailing list