https://github.com/gvicentin/sc
Subnet Calculator CLI
https://github.com/gvicentin/sc
c cli networking subnetting
Last synced: 9 months ago
JSON representation
Subnet Calculator CLI
- Host: GitHub
- URL: https://github.com/gvicentin/sc
- Owner: gvicentin
- License: mit
- Created: 2022-07-10T14:26:53.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-27T18:00:05.000Z (about 3 years ago)
- Last Synced: 2025-03-17T19:47:02.458Z (over 1 year ago)
- Topics: c, cli, networking, subnetting
- Language: C
- Homepage:
- Size: 41 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Subnet Calculator (sc)



A command line tool that enables subnet network calculations using **CIDR notation**.
To use it, you can type your range directly in CIDR notation, and see the IP
information about that range.
This simple subnet calculator is **written in C**. It was created as a study about using
bitwise operators and basic IPv4 subnetting (Networking course).
## Installing
Check the release page if you don't want to build from
the source code.
```sh
# Clone repository and compile
git clone https://github.com/gvicentin/sc.git && cd sc/
make
```
Make sure to include the binary on your `$PATH`.
For example.
```sh
# Copy binary and create symbolic link
LOCALBIN="${HOME}/.local/bin"
cp bin/sc-0.1.0 $LOCALBIN
cd $LOCALBIN && ln -s sc-0.1.0 sc
```
## Usage
Use the command passing the IP in the CIDR notation,
e.g. `sc 172.16.65.23/20`.
```sh
sc 172.16.65.23/20
====================================
| SUBNET CALC |
====================================
IP: 172.16.65.23
IP Hex: AC104117
IP Long: 2886746391
CIDR Block: 172.16.64.0/20
Broadcast: 172.16.79.255
------------------------------------
Mask: 255.255.240.0
Mask Hex: FFFFF000
Mask Long: 4294963200
Mask Bits: 20
Num of Hosts: 4096
```
## Local development
To run unit tests, simply do the following.
```sh
make test
```