Skip to content

kritish-dhaubanjar/compute-subnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Usage

const { computeSubnet } = require("./compute-subnet");

const cidr = 20;
const ip = [192, 168, 0, 10];

const subnet = computeSubnet(ip, cidr);

Formatting

const {
  count,
  subnetMask,
  wildcardMask,
  hostAddresses,
  networkAddress,
  broadcastAddress,
} = subnet;

console.table({
  cidr,
  ip: ip.join("."),
});

console.table({
  subnet: subnetMask.join("."),
  wildcard: wildcardMask.join("."),
  network: networkAddress.join("."),
  broadcast: broadcastAddress.join("."),
  hosts: `${hostAddresses.start.join(".")} - ${hostAddresses.end.join(".")}`,
  count,
});

Output

image

About

A utility to compute subnetworks from cidr notation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published