Skip to main content

A CLI utility for working with classless IP addresses

Project description

Copyright 2016 Caleb Evans
Released under the MIT license

Build Status Coverage Status

CIDR Brewer is a command-line utility which displays information for classless IP addresses (such as subnet mask and network ID) so you don’t need to perform the calculations yourself.


You can install CIDR Brewer via pip (ideally globally):

pip install cidr-brewer


To use, run cidr-brewer from the command line with one or two IP addresses.

One IP address

If you pass a single IP address using slash notation, CIDR Brewer will compute the subnet mask, network ID, broadcast ID, and the range of valid/available IP addresses.

$ ./
Given IP address:  11000000.10101000.00010011.01100100
Subnet mask:    11111111.11111111.11111111.10000000
Network ID:    11000000.10101000.00010011.00000000
Broadcast ID:     11000000.10101000.00010011.01111111
First Available Address:       11000000.10101000.00010011.00000001
Last Available Address:     11000000.10101000.00010011.01111110
Subnet Size: 2^7 - 2 = 126

Additionally, if you supply a list of block sizes, CIDR Brewer will compute the same information for each sub-block.

$ ./ --block-sizes 16 64 16 32
Given IP address:  00101010.01110010.10011000.10000000
Block 1:
   Block Size: 2^6 = 64
   Network ID:  00101010.01110010.10011000.10000000
   Broadcast ID:     00101010.01110010.10011000.10111111
   First Available Address:     00101010.01110010.10011000.10000001
   Last Available Address:     00101010.01110010.10011000.10111110
   Subnet Size: 2^6 - 2 = 62
Block 2:
   Block Size: 2^5 = 32
   Network ID:  00101010.01110010.10011000.11000000
   Broadcast ID:     00101010.01110010.10011000.11011111
   First Available Address:     00101010.01110010.10011000.11000001
   Last Available Address:     00101010.01110010.10011000.11011110
   Subnet Size: 2^5 - 2 = 30
Block 3:
   Block Size: 2^4 = 16
   Network ID:  00101010.01110010.10011000.11100000
   Broadcast ID:     00101010.01110010.10011000.11101111
   First Available Address:     00101010.01110010.10011000.11100001
   Last Available Address:     00101010.01110010.10011000.11101110
   Subnet Size: 2^4 - 2 = 14
Block 4:
   Block Size: 2^4 = 16
   Network ID:  00101010.01110010.10011000.11110000
   Broadcast ID:     00101010.01110010.10011000.11111111
   First Available Address:     00101010.01110010.10011000.11110001
   Last Available Address:     00101010.01110010.10011000.11111110
   Subnet Size: 2^4 - 2 = 14

Two IP addresses

If you pass two IP addresses (without slash notation), CIDR Brewer will also compute the largest subnet mask needed for communication between the two addresses.

$ ./
Given IP addresses:       10101100.00010000.00001011.01001010       10101100.00010000.00001011.01001110
Largest subnet mask allowing communication:
   29 bits    11111111.11111111.11111111.11111000
Network ID:    10101100.00010000.00001011.01001000
Broadcast ID:       10101100.00010000.00001011.01001111
First Available Address:       10101100.00010000.00001011.01001001
Last Available Address:       10101100.00010000.00001011.01001110
Subnet Size: 2^3 - 2 = 6

If you pass two IP addresses (with slash notation), CIDR Brewer will also indicate if the IP addresses can already communicate on their respective subnets.

$ ./
Given IP addresses:   01111101.00101111.00100000.10101010    01111101.00101111.00100000.00110101
Can these IP addresses communicate?
Largest subnet mask allowing communication:
   24 bits      11111111.11111111.11111111.00000000
Network ID:     01111101.00101111.00100000.00000000
Broadcast ID:      01111101.00101111.00100000.11111111
First Available Address:        01111101.00101111.00100000.00000001
Last Available Address:      01111101.00101111.00100000.11111110
Subnet Size: 2^8 - 2 = 254


The /examples directory contains example IP addresses for you to test against the utility.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cidr-brewer, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size cidr-brewer-1.0.0.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page