REST API · JSON

>_ API Documentation

The exact API subnet.abadawod.dev's own frontend uses. No API key required — see the rate limit note below.

← back to site
base url: https://subnet.abadawod.dev/api
rate limit: 60 requests / minute per IP, shared across all endpoints below — a 429 response means you're over it
auth: none — all endpoints are public
note: both /subnet and /subnet.php work — the .php extension is optional
Three layers build on each other: subnet and vlsm do raw address math. enterprise applies that same VLSM logic twice — once to size sites within a base network, once to size departments within each site — so nothing overlaps at either level. topology and vpn_gen then connect those sites with WAN links and IPSec tunnels. config_gen turns any of the above into real Cisco/FortiGate CLI, and save_design / load_design persist a finished result under a short code.
GET/subnet
Full IPv4 subnet breakdown for a single address and prefix length. Handles RFC 3021 (/31) and single-host (/32) blocks correctly.
nametypedescription
ipstringrequiredIPv4 address, e.g. 192.168.1.10
cidrintegerrequiredPrefix length, 0–32
$ curl "https://subnet.abadawod.dev/api/subnet?ip=192.168.1.10&cidr=24"
{
  "ip": "192.168.1.10",
  "cidr_notation": "192.168.1.0/24",
  "subnet_mask": "255.255.255.0",
  "wildcard_mask": "0.0.0.255",
  "network_address": "192.168.1.0",
  "broadcast_address": "192.168.1.255",
  "first_host": "192.168.1.1",
  "last_host": "192.168.1.254",
  "total_addresses": 256,
  "usable_hosts": 254,
  "ip_class": "C",
  "address_type": "Private",
  "note": null
}
GET/vlsm
Real VLSM allocation — sizes each subnet to the smallest block that fits its host requirement, largest-first, with zero wasted space between blocks.
nametypedescription
basestringrequiredBase network in CIDR form, e.g. 10.0.0.0/24
hostsstringrequiredComma-separated host counts, e.g. 50,20,2
$ curl "https://subnet.abadawod.dev/api/vlsm?base=10.0.0.0/24&hosts=50,20,2"
{
  "base_network": "10.0.0.0/24",
  "subnets": [
    { "hosts_requested": 50, "cidr": 26, "network": "10.0.0.0/26", "usable_hosts": 62, ... },
    { "hosts_requested": 20, "cidr": 27, "network": "10.0.0.64/27", "usable_hosts": 30, ... },
    { "hosts_requested": 2,  "cidr": 30, "network": "10.0.0.96/30", "usable_hosts": 2,  ... }
  ],
  "addresses_used": 100,
  "addresses_available": 256,
  "addresses_remaining": 156
}
GET/config_gen
Generates Cisco Router, Cisco Switch, or FortiGate CLI configuration for a given subnet — interface, ACL (standard or extended), DHCP, OSPF, NAT, SSH, NTP, syslog, HSRP, AAA/TACACS+, trunking, port security, DHCP snooping, security profiles, or HA, depending on device and include options.
nametypedescription
ip, cidrstring, intrequiredThe subnet this device config is for
devicestringrequiredcisco_router · cisco_switch · fortigate
interfacestringoptionalInterface name, e.g. GigabitEthernet0/1
descriptionstringoptionalUsed for the ACL name, DHCP pool name, VLAN name, etc.
includestringoptionalComma list. Router: acl,dhcp,ospf,nat,route,ssh,ntp,syslog,hsrp,aaa. Switch: trunk,port_security,dhcp_snooping,ntp,syslog,aaa. FortiGate: dhcp,route,security,ha,ntp,syslog
acl_typestringoptionalcisco_router only — standard (source only) or extended (source+destination, default)
vlanintoptionalcisco_switch only — VLAN ID (default 10)
stp_modestringoptionalcisco_switch only — rapid-pvst (default) · pvst · mst
ntp_server, syslog_server, aaa_serverstringoptionalTarget servers for the ntp/syslog/aaa include options — falls back to a placeholder if omitted
hsrp_group, hsrp_priorityintoptionalcisco_router only — HSRP group number (default 1) and priority (default 110)
hostname, wan_interface, route_next_hop, ssh_username, ssh_domain, trunk_interfacestringoptionalFine-tune specific sections — see source for defaults
$ curl "https://subnet.abadawod.dev/api/config_gen?ip=10.0.0.0&cidr=26&device=cisco_router&description=Sales-LAN&include=acl,dhcp,ntp,syslog&acl_type=extended&syslog_server=192.168.1.5"
{ "device": "cisco_router", "network": "10.0.0.0/26", "config": "! ── Identity ──\nhostname R1\n..." }
POST/enterprise
Two-level VLSM: sizes and allocates sites within an enterprise base, then departments within each site — nothing overlaps at either level.
{
  "base": "10.0.0.0/16",
  "sites": [
    { "name": "Riyadh HQ", "departments": [
      { "name": "Sales", "hosts": 50 },
      { "name": "IT", "hosts": 20 }
    ]}
  ]
}
$ curl -X POST https://subnet.abadawod.dev/api/enterprise \
  -H "Content-Type: application/json" \
  -d '{"base":"10.0.0.0/16","sites":[{"name":"HQ","departments":[{"name":"Sales","hosts":50}]}]}'
{
  "base_network": "10.0.0.0/16",
  "sites": [ { "name": "HQ", "network": "10.0.0.0/26", "departments": [ {...} ] } ],
  "addresses_used": 64, "addresses_available": 65536, "addresses_remaining": 65472
}
POST/topology
Allocates one WAN link (/30 or /31) per connection between sites, from a pool kept separate from LAN space. Supports hub-and-spoke, manual point-to-point, and full/partial mesh.
{
  "wan_base": "203.0.113.0/28",
  "link_size": 30,
  "topology": "hub_spoke",
  "sites": ["Riyadh HQ", "Jeddah Branch"],
  "hub": "Riyadh HQ"
}
// topology: hub_spoke | point_to_point | mesh_full | mesh_partial
// "hub" required for hub_spoke; "links": [["A","B"], ...] required for point_to_point / mesh_partial
{
  "wan_base": "203.0.113.0/28", "topology": "hub_spoke", "link_size": 30,
  "links": [ { "site_a": "Riyadh HQ", "site_b": "Jeddah Branch", "network": "203.0.113.0/30", "ip_a": "203.0.113.1", "ip_b": "203.0.113.2", "broadcast": "203.0.113.3" } ],
  "addresses_used": 4, "addresses_available": 16, "addresses_remaining": 12
}
GET/vpn_gen
Generates an IPSec site-to-site VPN tunnel config (Cisco IOS or FortiGate) between two WAN link endpoints, protecting traffic between two LAN blocks. Uses a placeholder PSK that must be replaced before deployment.
nametypedescription
devicestringrequiredcisco_router · fortigate
local_ip, remote_ipstringrequiredTunnel endpoint addresses (from a topology link)
local_network, remote_networkstringrequiredThe two LAN blocks in CIDR form, e.g. 10.0.0.0/25
local_name, remote_namestringoptionalSite names, used to build the ACL/tunnel identifier
$ curl "https://subnet.abadawod.dev/api/vpn_gen?device=cisco_router&local_ip=203.0.113.1&remote_ip=203.0.113.2&local_network=10.0.0.0/25&remote_network=10.0.1.0/25"
POST/summarize
Finds the smallest single supernet (summary route) covering a list of networks, and warns if it covers extra address space beyond your inputs.
{ "networks": ["10.0.0.0/26", "10.0.1.0/26", "10.0.2.0/26", "10.0.3.0/26"] }
{
  "input_networks": ["10.0.0.0/26","10.0.1.0/26","10.0.2.0/26","10.0.3.0/26"],
  "summary_route": "10.0.0.0/24", "summary_mask": "255.255.255.0",
  "covers_addresses": 256, "input_addresses": 256, "extra_addresses_covered": 0,
  "note": "This summary covers exactly your input networks with no extra address space."
}
POST/audit
Diagnostic check for an existing IP plan (not a new design) — flags overlapping ranges, exact duplicate entries, and reports free address gaps between the given networks.
{ "networks": ["10.0.0.0/24", "10.0.0.128/25", "10.0.2.0/25"] }
{
  "networks_checked": ["10.0.0.0/24","10.0.0.128/25","10.0.2.0/25"],
  "conflicts": [ { "a": "10.0.0.0/24", "b": "10.0.0.128/25" } ],
  "duplicates": [],
  "gaps": [ { "start": "10.0.1.0", "end": "10.0.1.255", "size": 256 } ],
  "clean": false, "total_networks": 3
}
GET/cloud_subnet
AWS VPC and Azure VNet subnets reserve 5 addresses per subnet (network, gateway/DNS/future-use, and broadcast) — first usable host is network+4. GCP VPC reserves only 4 (network, gateway, second-to-last, and broadcast) — first usable host is network+2.
nametypedescription
ip, cidrstring, intrequiredThe subnet to calculate (max /28)
providerstringrequiredaws · azure · gcp
$ curl "https://subnet.abadawod.dev/api/cloud_subnet?ip=10.0.0.0&cidr=24&provider=aws"
{
  "provider": "aws", "cidr_notation": "10.0.0.0/24",
  "first_usable_host": "10.0.0.4", "last_usable_host": "10.0.0.254",
  "total_addresses": 256, "reserved_count": 5, "usable_hosts": 251,
  "reserved_addresses": { "10.0.0.0": "Network address", "10.0.0.1": "Reserved by AWS for the VPC router", ... }
}
POST/save_design
Stores an already-computed enterprise (+ optional topology) result under a short code. Nothing is recalculated — reloading returns exactly what was saved.
{ "enterprise": { ...result from /enterprise }, "topology": { ...result from /topology, optional } }
{ "short_code": "x7k2p9" }
GET/load_design
Retrieves a previously saved design by its short code.
nametypedescription
codestringrequiredThe short code returned by save_design
$ curl "https://subnet.abadawod.dev/api/load_design?code=x7k2p9"