SkillPilotAI

sipcalc

sipcalc is an offline IPv4 and IPv6 subnet calculator: give it an address and mask and it prints the network, broadcast, usable range, Cisco wildcard, splits and IPv6 details. It is the same maths your OS does for every packet to decide direct delivery or the router.

24.1 Why is it used?

  • Find the network, broadcast and usable host range of any address quickly and without mistakes.
  • Plan subnets: split a /24 into /26s, list neighbouring networks, convert wildcards to masks (ACLs).
  • IPv6 help: expand/compress addresses, address type, ip6.arpa reverse names, /48 to /64 splits.
  • Sends no packet: pure offline maths (except -d, which resolves a name).
OSInstall
Linuxapt install sipcalc (dnf: EPEL)
macOSbrew install sipcalc
WindowsNot native: use WSL

24.2 How it works: the subnet decides the path

  • /27 = 27 network bits and 5 host bits = 32 addresses.
  • All host bits 0 = network address (192.168.44.32); all host bits 1 = broadcast (192.168.44.63).
  • Lab: pc1 192.168.44.37/27 and pc2 192.168.44.50 share range .32-.63; pc3 192.168.44.70 is in the next subnet .64-.95.
Direct or via the router?
  1. 1.pc1 (192.168.44.37/27) wants to send a packet

  2. 2.OS applies the /27 mask: own range .32 - .63

  3. 3.pc2 .50 is inside: send directly through the switch

  4. 4.pc3 .70 is outside (range .64 - .95)

  5. 5.Send to gateway r1 .62, which forwards to pc3

ip route get and traceroute prove it: .50 direct, .70 via 192.168.44.62

Terminal
ip route get 192.168.44.50ip route get 192.168.44.70traceroute -n -q 1 -w 1 192.168.44.70sipcalc 192.168.44.70/27
Output
$ ip route get 192.168.44.50192.168.44.50 dev eth0 src 192.168.44.37$ ip route get 192.168.44.70192.168.44.70 via 192.168.44.62 dev eth0$ traceroute -n -q 1 -w 1 192.168.44.70 1  192.168.44.62  0.010 ms 2  192.168.44.70  0.017 ms$ sipcalc 192.168.44.70/27Network range - 192.168.44.64 - 192.168.44.95Usable range  - 192.168.44.65 - 192.168.44.94

24.3 Input forms

FormExample
address/prefixsipcalc 192.168.44.37/27
address + dotted masksipcalc 192.168.44.37 255.255.255.224
address + hex masksipcalc 192.168.44.37 0xffffffe0
interface namesipcalc eth0 (or -I eth0)
stdinprintf '...' | sipcalc -
several at oncesipcalc 10.0.0.0/8 172.16.0.0/12
IPv6sipcalc 2001:db8::1/64
Terminal
sipcalc 192.168.44.37/27
Output
$ sipcalc 192.168.44.37/27-[ipv4 : 192.168.44.37/27] - 0[CIDR]Host address         - 192.168.44.37Network address      - 192.168.44.32Network mask         - 255.255.255.224Network mask (bits)  - 27Network mask (hex)   - FFFFFFE0Broadcast address    - 192.168.44.63Cisco wildcard       - 0.0.0.31Addresses in network - 32Network range - 192.168.44.32 - 192.168.44.63Usable range  - 192.168.44.33 - 192.168.44.62
Terminal
sipcalc 192.168.44.37 255.255.255.224sipcalc 192.168.44.37 0xffffffe0ip -4 -br addr show eth0sipcalc eth0
Output
$ sipcalc 192.168.44.37 255.255.255.224-[ipv4 : 192.168.44.37 255.255.255.224] - 0Network mask (bits)  - 27Network range - 192.168.44.32 - 192.168.44.63$ sipcalc 192.168.44.37 0xffffffe0-[ipv4 : 192.168.44.37 0xffffffe0] - 0Network mask (bits)  - 27Network range - 192.168.44.32 - 192.168.44.63$ ip -4 -br addr show eth0eth0@if421   UP   192.168.44.37/27$ sipcalc eth0-[int-ipv4 : eth0] - 0Host address         - 192.168.44.37Network mask         - 255.255.255.224Usable range  - 192.168.44.33 - 192.168.44.62
Terminal
printf '10.1.0.0/16\n172.16.5.0/23\n' \  | sipcalc -sipcalc 10.0.0.0/8 172.16.0.0/12sipcalc 2001:db8::1/64
Output
$ printf '10.1.0.0/16\n172.16.5.0/23\n' | sipcalc --[ipv4 : 10.1.0.0/16] - 0Network range - 10.1.0.0 - 10.1.255.255-[ipv4 : 172.16.5.0/23] - 0Network range - 172.16.4.0 - 172.16.5.255$ sipcalc 10.0.0.0/8 172.16.0.0/12-[ipv4 : 10.0.0.0/8] - 0Usable range  - 10.0.0.1 - 10.255.255.254-[ipv4 : 172.16.0.0/12] - 0Usable range  - 172.16.0.1 - 172.31.255.254$ sipcalc 2001:db8::1/64-[ipv6 : 2001:db8::1/64] - 0[IPV6 INFO]Expanded Address - 2001:0db8:0000:0000:0000:0000:0000:0001Compressed address - 2001:db8::1Prefix length - 64Network range - 2001:0db8:0000:0000:0000:0000:0000:0000 -                2001:0db8:0000:0000:ffff:ffff:ffff:ffff

24.4 Options

OptionWhat it does
-aAll info: classful, CIDR, neighbouring networks, bitmaps
-b / -xCIDR bitmap / classful bitmap
-s NSplit an IPv4 network into /N subnets
-n NShow N networks starting from the current one
-uUsable range per split network
-wWildcard to mask
-dResolve a name (all A/AAAA records)
-t / -r / -e / -S NIPv6 info / reverse DNS / v4-in-v6 / split IPv6
-i / -c / -4 / -6 / -ICIDR info, classful only, force family, interface
Terminal
sipcalc -a 192.168.44.37/27sipcalc -b 192.168.44.37/27
Output
$ sipcalc -a 192.168.44.37/27[Classful]Network address      - 192.168.44.0Network class        - CNetwork mask         - 255.255.255.0Broadcast address    - 192.168.44.255[CIDR]Network address      - 192.168.44.32...[Networks]Network - 192.168.44.0    - 192.168.44.31Network - 192.168.44.32   - 192.168.44.63 (current)Network - 192.168.44.64   - 192.168.44.95Network - 192.168.44.96   - 192.168.44.127Network - 192.168.44.128  - 192.168.44.159Network - 192.168.44.160  - 192.168.44.191Network - 192.168.44.192  - 192.168.44.223Network - 192.168.44.224  - 192.168.44.255$ sipcalc -b 192.168.44.37/27[CIDR bitmaps]Host address - 11000000.10101000.00101100.00100101Network address - 11000000.10101000.00101100.00100000Network mask - 11111111.11111111.11111111.11100000Broadcast address - 11000000.10101000.00101100.00111111
Terminal
sipcalc -s 26 192.168.44.0/24sipcalc -n 3 192.168.44.0/26sipcalc -u -s 26 192.168.44.0/24
Output
$ sipcalc -s 26 192.168.44.0/24[Split network]Network - 192.168.44.0    - 192.168.44.63Network - 192.168.44.64   - 192.168.44.127Network - 192.168.44.128  - 192.168.44.191Network - 192.168.44.192  - 192.168.44.255$ sipcalc -n 3 192.168.44.0/26[Networks]Network - 192.168.44.0    - 192.168.44.63 (current)Network - 192.168.44.64   - 192.168.44.127Network - 192.168.44.128  - 192.168.44.191$ sipcalc -u -s 26 192.168.44.0/24Usable range  - 192.168.44.1 - 192.168.44.62Usable range  - 192.168.44.65 - 192.168.44.126Usable range  - 192.168.44.129 - 192.168.44.190Usable range  - 192.168.44.193 - 192.168.44.254
Terminal
sipcalc -w 0.0.15.255sipcalc -d example.com/24
Output
$ sipcalc -w 0.0.15.255-[ipv4 : 0.0.15.255] - 0[WILDCARD]Wildcard             - 0.0.15.255Network mask         - 255.255.240.0Network mask (bits)  - 20$ sipcalc -d example.com/24-[ipv4 : example.com/24] - 0Host address  - 172.66.147.243Network range - 172.66.147.0 - 172.66.147.255-[ipv4 : example.com/24] - 1Host address  - 104.20.23.154-[ipv6 : example.com/24] - 2Compressed address - 2606:4700:10::6814:179a-[ipv6 : example.com/24] - 3Compressed address - 2606:4700:10::ac42:93f3
Terminal
sipcalc -t fe80::1sipcalc -r 2001:db8::10sipcalc -e ::ffff:192.168.44.37/128sipcalc -S 64 2001:db8:abcd::/48
Output
$ sipcalc -t fe80::1Expanded Address - fe80:0000:0000:0000:0000:0000:0000:0001Compressed address - fe80::1Address type - Link-Local Unicast Addresses$ sipcalc -r 2001:db8::10[IPV6 DNS]Reverse DNS (ip6.arpa) -0.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.$ sipcalc -e ::ffff:192.168.44.37/128[V4INV6]Compr. v4inv6 address - ::ffff:192.168.44.37Comment - IPv4-mapped IPv6 address$ sipcalc -S 64 2001:db8:abcd::/48 | head -8[Split network]Network - 2001:0db8:abcd:0000:0000:0000:0000:0000 -          2001:0db8:abcd:0000:ffff:ffff:ffff:ffffNetwork - 2001:0db8:abcd:0001:0000:0000:0000:0000 -          2001:0db8:abcd:0001:ffff:ffff:ffff:ffff

24.5 Output fields

  • Network address / Broadcast address: host bits all 0 / all 1.
  • Network mask (dotted, bits, hex) and Cisco wildcard (inverse mask, used in ACLs).
  • Addresses in network (32 for /27), Network range (all) and Usable range (minus network and broadcast).
  • IPv6: Expanded / Compressed address, Address type, Prefix length, V4INV6, Reverse DNS (ip6.arpa).
Terminal
sipcalc -a 2001:db8::1/64sipcalc 192.168.44.37/27 \  | grep -E 'Usable|Broadcast'
Output
$ sipcalc -a 2001:db8::1/64-[ipv6 : 2001:db8::1/64] - 0[IPV6 INFO]Compressed address - 2001:db8::1Address type - Aggregatable Global Unicast Addresses[V4INV6]Compr. v4inv6 address - 2001:db8::0.0.0.1[IPV6 DNS]Reverse DNS (ip6.arpa) -1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.-$ sipcalc 192.168.44.37/27 | grep -E 'Usable|Broadcast'Broadcast address    - 192.168.44.63Usable range  - 192.168.44.33 - 192.168.44.62

24.6 Common mistakes

  • Thinking /27 gives 32 hosts: network (.32) and broadcast (.63) are not for hosts, so 30 are usable, and the router gateway is one of those 30.
  • Assuming two hosts in the same /24 range are on the same subnet when the prefix is /27 (.37 and .70 are in different subnets).
  • Mixing up mask and wildcard: 0.0.15.255 is a wildcard = mask 255.255.240.0 (/20).

24.7 Interview tips

  • Network/broadcast: prefix = network bits; host bits all 0 = network, all 1 = broadcast; in between = usable.
  • 192.168.44.70/27: range 192.168.44.64 - 192.168.44.95, so it cannot talk to pc1 (.37) directly; it goes via the router.
  • Usable hosts = 2^(32 - prefix) - 2 for IPv4 (except /31 and /32).
  • Verify with sipcalc or ipcalc, especially for IPv6 and subnet splits.