compute-subnet

1.0.2 • Public • Published

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i compute-subnet

      Weekly Downloads

      1

      Version

      1.0.2

      License

      MIT

      Unpacked Size

      4.8 kB

      Total Files

      4

      Last publish

      Collaborators

      • kritish-dhaubanjar