Skip to content

CIDR Check tells you if two cidrs share the same host ip

Notifications You must be signed in to change notification settings

apgmckay/cidr-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CIDR-Checker

Your Workflow Name

Listen to Spotify

  ______   ______  _______   _______             __                  __                           
 /      \ /      |/       \ /       \           /  |                /  |                          
/$$$$$$  |$$$$$$/ $$$$$$$  |$$$$$$$  |  _______ $$ |____    ______  $$ |   __   ______    ______  
$$ |  $$/   $$ |  $$ |  $$ |$$ |__$$ | /       |$$      \  /      \ $$ |  /  | /      \  /      \ 
$$ |        $$ |  $$ |  $$ |$$    $$< /$$$$$$$/ $$$$$$$  |/$$$$$$  |$$ |_/$$/ /$$$$$$  |/$$$$$$  |
$$ |   __   $$ |  $$ |  $$ |$$$$$$$  |$$ |      $$ |  $$ |$$    $$ |$$   $$<  $$    $$ |$$ |  $$/ 
$$ \__/  | _$$ |_ $$ |__$$ |$$ |  $$ |$$ \_____ $$ |  $$ |$$$$$$$$/ $$$$$$  \ $$$$$$$$/ $$ |      
$$    $$/ / $$   |$$    $$/ $$ |  $$ |$$       |$$ |  $$ |$$       |$$ | $$  |$$       |$$ |      
 $$$$$$/  $$$$$$/ $$$$$$$/  $$/   $$/  $$$$$$$/ $$/   $$/  $$$$$$$/ $$/   $$/  $$$$$$$/ $$/       
                                                                                                  

A CIDR checker that can compare 2+n CIDR ranges and tell you if there is any overlap in their network ranges.

Currently written in Golang.

Use

CIDR checker is simple to use, it accepts 1 or more ips, seperated by spaces, in CIDR notation format and lets the user know if there are any overlapping CIDRs in that input. For example:

$ cidr-checker 10.0.1.0/24 10.0.2.0/24 10.0.3.0/24
2023/09/03 13:59:58 All good no overlapping CIDRs.

If you wish to read from stdin using cidr-checker please use xargs. For example:

echo "10.0.0.0/24 10.0.1.0/24 10.0.2.0/24" | xargs cidr-checker
2023/09/03 14:00:20 All good no overlapping CIDRs.

You can also check that a specified network address contains the supplied IPs:

$ cidr-checker --network 10.0.0.0/8 10.0.1.0/24 10.0.2.0/24 10.0.3.0/24

Build

You will need golang's tooling to install, once install.

go build . 

Install

To install this to your machine simply download the latest release from releases and copy into you bin path e.g. /usr/local/bin/.

Testing

Prerequisite

You must have Golang tooling installed.

Running

$ cd pkg/cidr_validators/
$ go test

About

CIDR Check tells you if two cidrs share the same host ip

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages