subnetCalc

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

subnetCalc

Description

This is a golang-based Cobra CLI application to calculate subnets when given an IP address and a subnet mask in CIDR notation. It will return the requested IP, subnet mask, host address range, network address, broadcast address, subnet bits, mask bits, mask size, maximum number of subnets, max hosts per subnet. It works as expected with IPv4, however IPv6 handling is questionable at best.

Usage

subnetCalc <ip address>/<subnet mask>

Examples

Human Readable
subnetCalc 10.12.34.56/19

            IP Address: 10.12.34.56
           Subnet Mask: 255.255.224.0

    Host Address Range: 10.12.32.1 - 10.12.63.254
       Network Address: 10.12.32.0
     Broadcast Address: 10.12.63.255
       Maximum Subnets: 2048
      Hosts Per Subnet: 8190
JSON Output
subnetCalc --json 10.12.34.56/19
{
  "broadcast_addr": "10.12.63.255",
  "cidr": "10.12.32.0/19",
  "first_ip": "10.12.32.1",
  "hosts_per_subnet": 8190,
  "ip_addr": "10.12.34.56",
  "last_ip": "10.12.63.254",
  "mask_bits": 19,
  "mask_size": 32,
  "max_subnets": 2048,
  "network_addr": "10.12.32.0",
  "subnet_bits": 11,
  "subnet_mask": "255.255.224.0"
}

Getting Started

To get started using subnetCalc, put the binary into your preferred OS's $PATH and run it from the command line.

Feedback

Bug reports, feature requests, and pull requests are welcome but may not be responded to in an even remotely timely manner.

Documentation

Overview

Copyright © 2023 Jake Rogers <code@supportoss.org>

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL