Networking & Communications
IPv4 Membership
Check whether two IPv4 addresses belong to the same subnet.
Networking & Communications
Check whether two IPv4 addresses belong to the same subnet.
App id: NET-04. Reference version 1.0.
How to fill it
Fill the inputs. The tool shows the outputs.
On the tool screen, Calc is the working sheet. Presets stores values you reuse. Reference is the formula, assumptions, and provenance below.
Formula
same subnet if (IP_A AND mask) = (IP_B AND mask)Inputs
| Name | Unit |
|---|---|
| IP A | ipv4 |
| IP B | ipv4 |
| Prefix length (optional) | 1 |
| Subnet mask (optional) | ipv4 |
Outputs
| Name | Unit |
|---|---|
| Same subnet (1 = yes) (hero result) | 1 |
| Network A | ipv4 |
| Network B | ipv4 |
Diagnose
Observations are context. They do not pass or fail a structure. See Diagnose.
| When | Observation | Severity |
|---|---|---|
Same subnet (1 = yes) = 1 | Same subnet | info |
Otherwise | Different subnet | caution |
Assumptions
- Provide a prefix length or a dotted-decimal mask. If both are given they must agree.
Provenance
- IPv4 network membership is the AND of each address with the subnet mask.