0.0
Low commit activity in last 3 years
No release in over a year
A subnet calculator (only tested for class C and class B networks)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.0, >= 1.0.1
>= 0.4.0, ~> 0.4
 Project Readme

Introducing the subnet_calc gem

require 'subnet_calc'

sc = SubnetCalc.new hosts: 40
sc.to_h #=> {:class_type=>"C", :magic_number=>64, :hosts=>62, :subnet_mask=

puts sc.to_s

Output:

Subnet calculator
=================

Inputs: 

  hosts: 40

Summary
-------

* Network class: C
* magic number: 64
* hosts per subnet: 62
* subnet mask: 255.255.255.192
* subnet bitmask: 11111111.11111111.11111111.11000000
* prefix bit-length: 26
* range: 192.168.0.1-192.168.0.62

* subnet_bits: 2
* maximum subnets: 4



Breakdown
---------

4th octet:

  | 128 | 64  | 32  | 16  | 8   | 4   | 2   | 1   |
  |:----|:----|:----|:----|:----|:----|:----|:----|
  | 1   | 1   | 0   | 0   | 0   | 0   | 0   | 0   |
  | /25 | /26 | /27 | /28 | /29 | /30 | /31 | /32 |


### Subnets


  | Network | 1st | last | broadcast |
  |:--------|:----|:-----|:----------|
  | 0       | 1   | 62   | 63        |
  | 64      | 65  | 126  | 127       |
  | 128     | 129 | 190  | 191       |
  | 192     | 193 | 254  | 255       |


-----------------------------------------------

Resources

subnetting subnet calc gem network