All Projects → mhausenblas → Cidrchk

mhausenblas / Cidrchk

CLI tool for CIDR range operations (check, generate)

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Cidrchk

Gomphs
A tool to ping multiple hosts at once with a CLI and web-based overview
Stars: ✭ 54 (-47.57%)
Mutual labels:  ipv6, ipv4
Ship
A simple, handy network addressing multitool with plenty of features
Stars: ✭ 81 (-21.36%)
Mutual labels:  ipv6, ipv4
Hev Socks5 Server
A simple, lightweight socks5 server for Unix (Linux/BSD/macOS)
Stars: ✭ 33 (-67.96%)
Mutual labels:  ipv6, ipv4
Nsupdate.info
Dynamic DNS service
Stars: ✭ 720 (+599.03%)
Mutual labels:  ipv6, ipv4
Ipnetwork
A library to work with CIDRs in rust
Stars: ✭ 64 (-37.86%)
Mutual labels:  ipv6, ipv4
Vflow
Enterprise Network Flow Collector (IPFIX, sFlow, Netflow) from Verizon Media
Stars: ✭ 776 (+653.4%)
Mutual labels:  ipv6, ipv4
Minidyndns
A simple DynDNS server with an build in HTTP interface to update IPs
Stars: ✭ 101 (-1.94%)
Mutual labels:  ipv6, ipv4
Enet Csharp
Reliable UDP networking library
Stars: ✭ 464 (+350.49%)
Mutual labels:  ipv6, ipv4
The Bits And Bytes Of Computer Networking
Networking , N/W layer, Transport and Application Layer, Networking Service, Internet, Troubleshooting , N/W future
Stars: ✭ 87 (-15.53%)
Mutual labels:  ipv6, ipv4
Ansible Role Firewall
A role to manage iptables rules which doesn't suck.
Stars: ✭ 81 (-21.36%)
Mutual labels:  ipv6, ipv4
Internet.nl
Internet standards compliance test suite
Stars: ✭ 56 (-45.63%)
Mutual labels:  ipv6, ipv4
Iptables semantics
Verified iptables Firewall Ruleset Analysis
Stars: ✭ 85 (-17.48%)
Mutual labels:  ipv6, ipv4
Netaddr
A network address manipulation library for Python
Stars: ✭ 648 (+529.13%)
Mutual labels:  ipv6, ipv4
Commons Ip Math
Stars: ✭ 54 (-47.57%)
Mutual labels:  ipv6, ipv4
Ddos Deflate
Fork of DDoS Deflate with fixes, improvements and new features.
Stars: ✭ 568 (+451.46%)
Mutual labels:  ipv6, ipv4
Edgeos Blacklist
Automatically updates IP blacklist for EdgeOS (supports IPv4 & IPv6)
Stars: ✭ 34 (-66.99%)
Mutual labels:  ipv6, ipv4
Plibsys
Highly portable C system library: threads and synchronization primitives, sockets (TCP, UDP, SCTP), IPv4 and IPv6, IPC, hash functions (MD5, SHA-1, SHA-2, SHA-3, GOST), binary trees (RB, AVL) and more. Native code performance.
Stars: ✭ 402 (+290.29%)
Mutual labels:  ipv6, ipv4
Ipwhois
Retrieve and parse whois data for IPv4 and IPv6 addresses
Stars: ✭ 432 (+319.42%)
Mutual labels:  ipv6, ipv4
Ineter
Fast Java library for working with IP addresses, ranges, and subnets
Stars: ✭ 39 (-62.14%)
Mutual labels:  ipv6, ipv4
Packetsender
Network utility for sending / receiving TCP, UDP, SSL
Stars: ✭ 1,349 (+1209.71%)
Mutual labels:  ipv6, ipv4

cidrchk

release

A CLI tool to assist you with CIDR ranges and IPs.

Install it

You can download the latest binary for Linux (Intel and Arm), macOS, and Windows.

For example, to install cidrchk from binary on macOS, do the following:

curl -L https://github.com/mhausenblas/cidrchk/releases/latest/download/cidrchk_darwin_amd64.tar.gz \
    -o cidrchk.tar.gz && \
    tar xvzf cidrchk.tar.gz cidrchk && \
    mv cidrchk /usr/local/bin && \
    rm cidrchk*

Use it

cidrchk can do three things for you: 1. check CIDR ranges for inclusion, 2. check for CIDR range overlaps, and 3. generate all IPs in a CIDR range.

Note that cidrchk uses OPA Rego to perform CIDR operation, to be precise the built-in Net functions.

Check for CIDR range inclusion

To check if a CIDR range contains an IP or another CIDR range:

$ cidrchk contains 192.168.0.0/16 192.168.0.42
yes

This also works for IPv6 addresses, for example:

$ cidrchk contains \
          0:0:0:0:0:ffff:c0a8:0/30 \
          0:3:ffff:ffff:ffff:ffff:ffff:ffff
yes

Check for CIDR range overlaps

To check if two CIDR ranges overlap you can do:

$ cidrchk overlaps 192.168.0.0/16 192.168.1.0/24
yes

Generate IPs from CIDR range

To expand a CIDR range, that is, to generate all IPs in it do the following:

$ cidrchk expand 192.168.0.0/30 | jq .
{
  "cidr": "192.168.0.0/30",
  "ips": [
    [
      "192.168.0.0",
      "192.168.0.1",
      "192.168.0.2",
      "192.168.0.3"
    ]
  ]
}

One can also answer questions like "How many IP addresses are there in a CIDR range", for example:

$ cidrchk expand 192.168.0.0/16 | jq '.ips[] | length'
65536
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].