Re: [OT] CIDR Mask calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 12, 2006 at 10:38:05AM -0600, Ashley M. Kirchner wrote:
> ... I'm trying to figure out the CIDR mask or bits for a particular
> network.  Specifically: 219.128.0.0 - 219.137.255.255

The easiest way to do this is to convert to binary and look for the
first "variant bit"--the first bit that changes in the two address
ranges.  This marks the change from the network and device fields
of the subnet.

If you don't do decimal<>binary conversions in your head, a simple way
to do this to use 'dc', setting the output to base 2.  For instance:

  $ dc
  2
  o
  128
  p
  10000000
  255
  p
  11111111

Anyway, the addresses you gave, converted to binary, are:

  219.128.0.0    : 11011011.10000000.00000000.00000000
  219.137.255.255: 11011011.10001001.11111111.11111111
                               ^
The last bit that is invariant between the two is marked with the caret;
converting back to a decimal dotted-quad (you can use 'dc' again--to set
the input to binary, simply change the 'o' operand in the above example
to an 'i', then input the binary value and print.)

  Mask
  255.240.0.0    : 11111111.11110000.00000000.00000000

or, in conventional notation, 219.128.0.0/12.

Cheers,
--
	Dave Ihnat
	President, DMINET Consulting, Inc.
	dihnat@xxxxxxxxxx

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux