A desktop application for calculating network configurations
Project description
LanCalc
LanCalc is a desktop application built with PyQt5, designed to calculate network configurations for Windows, macOS, and Linux systems.
It provides a user-friendly interface to compute essential network parameters such as network address, broadcast address, the minimum and maximum host addresses, and the number of hosts within a given subnet.
Support IPv4 address formats, subnet masks and prefixes. This tool is particularly useful for network administrators and IT professionals who require quick calculations of network parameters.
Quick Start
Installation
Install LanCalc Stable version:
pip3 install lancalc
Or install LanCalc from GitHub:
pip3 install git+https://github.com/lancalc/lancalc.git
Install PIP
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
python3 /tmp/get-pip.py
If the lancalc command is not found after installation, add the local packages path to PATH:
export PATH="$HOME/.local/bin:$PATH"
To permanently add to PATH, add this line to your ~/.bashrc or ~/.zshrc:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Running the Application
GUI Mode
After installation, launch the application with the command:
lancalc
CLI Mode
LanCalc also supports command-line interface for automation and scripting:
# Basic usage
lancalc 192.168.1.1/24
# JSON output for parsing
lancalc 192.168.1.1/24 --json
# Examples
lancalc 10.0.0.1/8
lancalc 172.16.0.1/16
lancalc 192.168.1.100/31 # Point-to-point network
lancalc 192.168.1.1/32 # Single host
Output Format
Text mode (default):
Network: 192.168.1.0
Prefix: /24
Netmask: 255.255.255.0
Broadcast: 192.168.1.255
Hostmin: 192.168.1.1
Hostmax: 192.168.1.254
Hosts: 254
JSON mode (--json):
{
"network": "192.168.1.0",
"prefix": "/24",
"netmask": "255.255.255.0",
"broadcast": "192.168.1.255",
"hostmin": "192.168.1.1",
"hostmax": "192.168.1.254",
"hosts": "254",
"comment": ""
}
Uninstall
pip3 uninstall -y lancalc
That's it! The application will start and automatically detect your current network settings.
For Developers
Prerequisites
Python 3.9+ is required.
For production use (CLI only):
pip3 install -r requirements.txt
For GUI support:
pip3 install -e .[gui]
For development:
pip3 install -e .[dev,gui]
Installation for Development
Clone the repository and install in development mode:
git clone https://github.com/lancalc/lancalc.git
Running from Source
python3 lancalc/main.py
Development Tools
pip3 install pre-commit flake8 pytest pytest-qt
pre-commit install
pre-commit run --all-files
pre-commit autoupdate
Running Tests
pytest -v
Test Build
pip3 install -e .
~/.local/bin/lancalc
Test Build Linux
pip3 install git+file://$(pwd)
export PATH="$HOME/.local/bin:$PATH"
lancalc
Test Build Windows
pip3 install "git+file://$(Get-Location)"
lancalc
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Notes
A /31 mask allows the use of 2 addresses. The first will be the network address, the last the broadcast address, and for connecting hosts we use these same addresses. Limitations when using a /31 prefix: Protocols that use L3 broadcast stop working. In fact, at present there are almost no protocols left that rely on L3 broadcast in their operation. The main currently relevant protocols, such as OSPF, IS-IS, EIGRP, and BGP, use multicast or unicast addresses instead. This limitation can even be seen as an advantage, because it increases resistance to DoS attacks based on broadcast traffic distribution. But not all devices support /31 prefixes. On Juniper and Cisco devices, you can safely use a /31 mask, although Cisco will issue a warning (% Warning: use /31 mask on non point-to-point interface cautiously). ZyXEL, however, does not allow you to select a /31 mask at all. As a result, there are additional limitations in network operation — from using equipment of different manufacturers to even using equipment from the same vendor but with different firmware versions. If you are not concerned by the above limitations, you can confidently save addresses by using the /31 prefix.
The use of the /31 prefix is described in detail in RFC 3021 — Using 31-Bit Prefixes on IPv4 Point-to-Point Links.
Special IPv4 Ranges and Cases
Special Network Types
- /31 networks: Show
2*in Hosts field - both addresses are usable (RFC 3021) - /32 networks: Show
1*in Hosts field - single host network - The asterisk (*) indicates special network types where all addresses are usable
Special IPv4 Address Ranges
LanCalc automatically detects and handles special IPv4 address ranges according to RFC specifications. For these ranges, host-related fields show "*" and a message field indicates the range type with RFC reference.
Supported Special Ranges
| Range | Type | RFC | Description |
|---|---|---|---|
| 127.0.0.0/8 | Loopback | RFC 3330 | Loopback addresses - not routable on the Internet |
| 169.254.0.0/16 | Link-local | RFC 3927 | Link-local addresses - not routable |
| 224.0.0.0/4 | Multicast | RFC 5771 | Multicast addresses - not for host addressing |
| 0.0.0.0/8 | Unspecified | RFC 1122 | Unspecified addresses - not for host addressing |
| 255.255.255.255/32 | Broadcast | RFC 919 | Limited broadcast address - not for host addressing |
Special Range Behavior
When you enter an address from a special range:
CLI Text Mode:
lancalc 127.0.0.1/8
Network: 127.0.0.0
Prefix: /8
Netmask: 255.0.0.0
Broadcast: *
Hostmin: 127.0.0.1
Hostmax: 127.255.255.254
Hosts: 16777214
Comment: RFC 3330 Loopback (https://github.com/lancalc/lancalc/blob/main/docs/RFC.md#rfc-3330---loopback-addresses)
CLI JSON Mode:
lancalc 224.0.0.1/4 --json
{
"network": "224.0.0.0",
"prefix": "/4",
"netmask": "240.0.0.0",
"broadcast": "*",
"hostmin": "*",
"hostmax": "*",
"hosts": "*",
"comment": "RFC 5771 Multicast (https://github.com/lancalc/lancalc/blob/main/docs/RFC.md#rfc-5771---multicast-addresses)"
}
GUI Mode:
- Host fields (Hostmin, Hostmax, Broadcast, Hosts) show "*"
- Status bar displays the special range message instead of version
- No special styling or warnings needed
JSON Fields
The JSON output includes the following fields:
comment: Description and RFC reference for special ranges (empty for normal unicast addresses)comment: Description and RFC reference for special ranges (empty for normal unicast addresses)hosts: Number of available host addresses in the specified subnet
These fields are always present, making the JSON output format consistent regardless of address type.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lancalc-0.1.8.tar.gz.
File metadata
- Download URL: lancalc-0.1.8.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
096115b8b06ae305b6fc356f03be98c6894b3f1df8bd9e0c54295ca07bf672bf
|
|
| MD5 |
0cddda6122f4f2b2b5a59faa088afa2a
|
|
| BLAKE2b-256 |
6b94fc347b522716244f1502729e698ce50fdba9a9bffa3fb3c75db390835237
|
Provenance
The following attestation bundles were made for lancalc-0.1.8.tar.gz:
Publisher:
publish.yml on lancalc/lancalc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lancalc-0.1.8.tar.gz -
Subject digest:
096115b8b06ae305b6fc356f03be98c6894b3f1df8bd9e0c54295ca07bf672bf - Sigstore transparency entry: 407430015
- Sigstore integration time:
-
Permalink:
lancalc/lancalc@cfe768b2006d297e82f9a9b15e180b7c933f397b -
Branch / Tag:
refs/tags/0.1.8 - Owner: https://github.com/lancalc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cfe768b2006d297e82f9a9b15e180b7c933f397b -
Trigger Event:
push
-
Statement type:
File details
Details for the file lancalc-0.1.8-py3-none-any.whl.
File metadata
- Download URL: lancalc-0.1.8-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ceef400714be46737c8536bdc75c238875b1d848196bbf52578a5302e61012e8
|
|
| MD5 |
29f0c020f7d9f930cf0e5d11b292a3fc
|
|
| BLAKE2b-256 |
0499d82d1472649ddd369fe65209d9b6343b8cd52b7d758cd4d23c06fa14985a
|
Provenance
The following attestation bundles were made for lancalc-0.1.8-py3-none-any.whl:
Publisher:
publish.yml on lancalc/lancalc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lancalc-0.1.8-py3-none-any.whl -
Subject digest:
ceef400714be46737c8536bdc75c238875b1d848196bbf52578a5302e61012e8 - Sigstore transparency entry: 407430024
- Sigstore integration time:
-
Permalink:
lancalc/lancalc@cfe768b2006d297e82f9a9b15e180b7c933f397b -
Branch / Tag:
refs/tags/0.1.8 - Owner: https://github.com/lancalc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cfe768b2006d297e82f9a9b15e180b7c933f397b -
Trigger Event:
push
-
Statement type: